mirror of
https://github.com/wxWidgets/Phoenix.git
synced 2026-01-06 12:00:13 +01:00
Some minor cleanup
This commit is contained in:
@@ -49,7 +49,7 @@ def numCPUs():
|
|||||||
else: # OSX:
|
else: # OSX:
|
||||||
p = subprocess.Popen("sysctl -n hw.ncpu", shell=True, stdout=subprocess.PIPE)
|
p = subprocess.Popen("sysctl -n hw.ncpu", shell=True, stdout=subprocess.PIPE)
|
||||||
return p.stdout.read()
|
return p.stdout.read()
|
||||||
|
|
||||||
# Windows:
|
# Windows:
|
||||||
if "NUMBER_OF_PROCESSORS" in os.environ:
|
if "NUMBER_OF_PROCESSORS" in os.environ:
|
||||||
ncpus = int(os.environ["NUMBER_OF_PROCESSORS"]);
|
ncpus = int(os.environ["NUMBER_OF_PROCESSORS"]);
|
||||||
@@ -76,7 +76,7 @@ def getVisCVersion():
|
|||||||
# TODO: Add more tests to get the other versions...
|
# TODO: Add more tests to get the other versions...
|
||||||
else:
|
else:
|
||||||
return 'FIXME'
|
return 'FIXME'
|
||||||
|
|
||||||
|
|
||||||
def exitIfError(code, msg):
|
def exitIfError(code, msg):
|
||||||
if code != 0:
|
if code != 0:
|
||||||
@@ -85,23 +85,23 @@ def exitIfError(code, msg):
|
|||||||
raise builder.BuildError(msg)
|
raise builder.BuildError(msg)
|
||||||
else:
|
else:
|
||||||
sys.exit(1)
|
sys.exit(1)
|
||||||
|
|
||||||
|
|
||||||
def getWxRelease(wxRoot=None):
|
def getWxRelease(wxRoot=None):
|
||||||
if not wxRoot:
|
if not wxRoot:
|
||||||
global wxRootDir
|
global wxRootDir
|
||||||
wxRoot = wxRootDir
|
wxRoot = wxRootDir
|
||||||
|
|
||||||
configureText = open(os.path.join(wxRoot, "configure.in"), "r").read()
|
configureText = open(os.path.join(wxRoot, "configure.in"), "r").read()
|
||||||
majorVersion = re.search("wx_major_version_number=(\d+)", configureText).group(1)
|
majorVersion = re.search("wx_major_version_number=(\d+)", configureText).group(1)
|
||||||
minorVersion = re.search("wx_minor_version_number=(\d+)", configureText).group(1)
|
minorVersion = re.search("wx_minor_version_number=(\d+)", configureText).group(1)
|
||||||
|
|
||||||
versionText = "%s.%s" % (majorVersion, minorVersion)
|
versionText = "%s.%s" % (majorVersion, minorVersion)
|
||||||
|
|
||||||
if int(minorVersion) % 2:
|
if int(minorVersion) % 2:
|
||||||
releaseVersion = re.search("wx_release_number=(\d+)", configureText).group(1)
|
releaseVersion = re.search("wx_release_number=(\d+)", configureText).group(1)
|
||||||
versionText += ".%s" % (releaseVersion)
|
versionText += ".%s" % (releaseVersion)
|
||||||
|
|
||||||
return versionText
|
return versionText
|
||||||
|
|
||||||
|
|
||||||
@@ -112,7 +112,7 @@ def getFrameworkName(options):
|
|||||||
name += "Cocoa"
|
name += "Cocoa"
|
||||||
else:
|
else:
|
||||||
name += "Carbon"
|
name += "Carbon"
|
||||||
return name
|
return name
|
||||||
|
|
||||||
|
|
||||||
def getPrefixInFramework(options, wxRoot=None):
|
def getPrefixInFramework(options, wxRoot=None):
|
||||||
@@ -144,7 +144,7 @@ def macFixupInstallNames(destdir, prefix, buildDir=None):
|
|||||||
cmd = 'install_name_tool -change %s/lib/%s %s/lib/%s %s/lib/%s' % \
|
cmd = 'install_name_tool -change %s/lib/%s %s/lib/%s %s/lib/%s' % \
|
||||||
(destdir+prefix,dep, prefix,dep, destdir+prefix,lib)
|
(destdir+prefix,dep, prefix,dep, destdir+prefix,lib)
|
||||||
print(cmd)
|
print(cmd)
|
||||||
run(cmd)
|
run(cmd)
|
||||||
os.chdir(pwd)
|
os.chdir(pwd)
|
||||||
|
|
||||||
|
|
||||||
@@ -160,7 +160,7 @@ def getoutput(cmd):
|
|||||||
output = None
|
output = None
|
||||||
output = sp.stdout.read()
|
output = sp.stdout.read()
|
||||||
if sys.version_info > (3,):
|
if sys.version_info > (3,):
|
||||||
outputEncoding = 'cp1252' if sys.platform == 'win32' else 'utf-8'
|
outputEncoding = 'cp1252' if sys.platform == 'win32' else 'utf-8'
|
||||||
output = output.decode(outputEncoding)
|
output = output.decode(outputEncoding)
|
||||||
output = output.rstrip()
|
output = output.rstrip()
|
||||||
rval = sp.wait()
|
rval = sp.wait()
|
||||||
@@ -169,7 +169,7 @@ def getoutput(cmd):
|
|||||||
print("Command '%s' failed with exit code %d." % (cmd, rval))
|
print("Command '%s' failed with exit code %d." % (cmd, rval))
|
||||||
sys.exit(rval)
|
sys.exit(rval)
|
||||||
return output
|
return output
|
||||||
|
|
||||||
|
|
||||||
def main(wxDir, args):
|
def main(wxDir, args):
|
||||||
global wxRootDir
|
global wxRootDir
|
||||||
@@ -178,26 +178,26 @@ def main(wxDir, args):
|
|||||||
global configure_opts
|
global configure_opts
|
||||||
global wxBuilder
|
global wxBuilder
|
||||||
global nmakeCommand
|
global nmakeCommand
|
||||||
|
|
||||||
wxRootDir = wxDir
|
wxRootDir = wxDir
|
||||||
|
|
||||||
contribDir = os.path.join("contrib", "src")
|
contribDir = os.path.join("contrib", "src")
|
||||||
installDir = None
|
installDir = None
|
||||||
|
|
||||||
VERSION = tuple([int(i) for i in getWxRelease().split('.')[:2]])
|
VERSION = tuple([int(i) for i in getWxRelease().split('.')[:2]])
|
||||||
|
|
||||||
if sys.platform.startswith("win"):
|
if sys.platform.startswith("win"):
|
||||||
contribDir = os.path.join(wxRootDir, "contrib", "build")
|
contribDir = os.path.join(wxRootDir, "contrib", "build")
|
||||||
|
|
||||||
if sys.platform.startswith("win"):
|
if sys.platform.startswith("win"):
|
||||||
toolkit = "msvc"
|
toolkit = "msvc"
|
||||||
else:
|
else:
|
||||||
toolkit = "autoconf"
|
toolkit = "autoconf"
|
||||||
|
|
||||||
defJobs = str(numCPUs())
|
defJobs = str(numCPUs())
|
||||||
defFwPrefix = '/Library/Frameworks'
|
defFwPrefix = '/Library/Frameworks'
|
||||||
|
|
||||||
option_dict = {
|
option_dict = {
|
||||||
"clean" : (False, "Clean all files from the build directory"),
|
"clean" : (False, "Clean all files from the build directory"),
|
||||||
"debug" : (False, "Build the library in debug symbols"),
|
"debug" : (False, "Build the library in debug symbols"),
|
||||||
"builddir" : ("", "Directory where the build will be performed for autoconf builds."),
|
"builddir" : ("", "Directory where the build will be performed for autoconf builds."),
|
||||||
@@ -207,10 +207,10 @@ def main(wxDir, args):
|
|||||||
"installdir" : ("", "Directory where built wxWidgets will be installed"),
|
"installdir" : ("", "Directory where built wxWidgets will be installed"),
|
||||||
"gtk3" : (False, "On Linux build for gtk3 (default gtk2)"),
|
"gtk3" : (False, "On Linux build for gtk3 (default gtk2)"),
|
||||||
"mac_distdir" : (None, "If set on Mac, will create an installer package in the specified dir."),
|
"mac_distdir" : (None, "If set on Mac, will create an installer package in the specified dir."),
|
||||||
"mac_universal_binary"
|
"mac_universal_binary"
|
||||||
: ("", "Comma separated list of architectures to include in the Mac universal binary"),
|
: ("", "Comma separated list of architectures to include in the Mac universal binary"),
|
||||||
"mac_framework" : (False, "Install the Mac build as a framework"),
|
"mac_framework" : (False, "Install the Mac build as a framework"),
|
||||||
"mac_framework_prefix"
|
"mac_framework_prefix"
|
||||||
: (defFwPrefix, "Prefix where the framework should be installed. Default: %s" % defFwPrefix),
|
: (defFwPrefix, "Prefix where the framework should be installed. Default: %s" % defFwPrefix),
|
||||||
"cairo" : (False, "Enable dynamically loading the Cairo lib for wxGraphicsContext on MSW"),
|
"cairo" : (False, "Enable dynamically loading the Cairo lib for wxGraphicsContext on MSW"),
|
||||||
"no_config" : (False, "Turn off configure step on autoconf builds"),
|
"no_config" : (False, "Turn off configure step on autoconf builds"),
|
||||||
@@ -226,7 +226,7 @@ def main(wxDir, args):
|
|||||||
"verbose" : (False, "Print commands as they are run, (to aid with debugging this script)"),
|
"verbose" : (False, "Print commands as they are run, (to aid with debugging this script)"),
|
||||||
"jom" : (False, "Use jom.exe instead of nmake for MSW builds."),
|
"jom" : (False, "Use jom.exe instead of nmake for MSW builds."),
|
||||||
}
|
}
|
||||||
|
|
||||||
parser = optparse.OptionParser(usage="usage: %prog [options]", version="%prog 1.0")
|
parser = optparse.OptionParser(usage="usage: %prog [options]", version="%prog 1.0")
|
||||||
|
|
||||||
keys = option_dict.keys()
|
keys = option_dict.keys()
|
||||||
@@ -235,39 +235,39 @@ def main(wxDir, args):
|
|||||||
action = "store"
|
action = "store"
|
||||||
if type(default) == bool:
|
if type(default) == bool:
|
||||||
action = "store_true"
|
action = "store_true"
|
||||||
parser.add_option("--" + opt, default=default, action=action, dest=opt,
|
parser.add_option("--" + opt, default=default, action=action, dest=opt,
|
||||||
help=option_dict[opt][1])
|
help=option_dict[opt][1])
|
||||||
|
|
||||||
options, arguments = parser.parse_args(args=args)
|
options, arguments = parser.parse_args(args=args)
|
||||||
|
|
||||||
global verbose
|
global verbose
|
||||||
if options.verbose:
|
if options.verbose:
|
||||||
verbose = True
|
verbose = True
|
||||||
|
|
||||||
# compiler / build system specific args
|
# compiler / build system specific args
|
||||||
buildDir = options.builddir
|
buildDir = options.builddir
|
||||||
args = []
|
args = []
|
||||||
installDir = options.installdir
|
installDir = options.installdir
|
||||||
prefixDir = options.prefix
|
prefixDir = options.prefix
|
||||||
|
|
||||||
if toolkit == "autoconf":
|
if toolkit == "autoconf":
|
||||||
if not buildDir:
|
if not buildDir:
|
||||||
buildDir = os.getcwd()
|
buildDir = os.getcwd()
|
||||||
configure_opts = []
|
configure_opts = []
|
||||||
if options.features != "":
|
if options.features != "":
|
||||||
configure_opts.extend(options.features.split(" "))
|
configure_opts.extend(options.features.split(" "))
|
||||||
|
|
||||||
if options.unicode:
|
if options.unicode:
|
||||||
configure_opts.append("--enable-unicode")
|
configure_opts.append("--enable-unicode")
|
||||||
|
|
||||||
if options.debug:
|
if options.debug:
|
||||||
configure_opts.append("--enable-debug")
|
configure_opts.append("--enable-debug")
|
||||||
|
|
||||||
if options.osx_cocoa:
|
if options.osx_cocoa:
|
||||||
configure_opts.append("--with-osx_cocoa")
|
configure_opts.append("--with-osx_cocoa")
|
||||||
elif options.osx_carbon:
|
elif options.osx_carbon:
|
||||||
configure_opts.append("--with-osx_carbon")
|
configure_opts.append("--with-osx_carbon")
|
||||||
|
|
||||||
if options.gtk3:
|
if options.gtk3:
|
||||||
configure_opts.append("--with-gtk=3")
|
configure_opts.append("--with-gtk=3")
|
||||||
|
|
||||||
@@ -297,9 +297,9 @@ def main(wxDir, args):
|
|||||||
# TODO: there should be a command line option to set the SDK...
|
# TODO: there should be a command line option to set the SDK...
|
||||||
if sys.platform.startswith("darwin"):
|
if sys.platform.startswith("darwin"):
|
||||||
for xcodePath in getXcodePaths():
|
for xcodePath in getXcodePaths():
|
||||||
sdks = [ xcodePath+"/SDKs/MacOSX10.{}.sdk".format(n)
|
sdks = [ xcodePath+"/SDKs/MacOSX10.{}.sdk".format(n)
|
||||||
for n in range(5, 15) ]
|
for n in range(5, 15) ]
|
||||||
|
|
||||||
# use the lowest available sdk on the build machine
|
# use the lowest available sdk on the build machine
|
||||||
for sdk in sdks:
|
for sdk in sdks:
|
||||||
if os.path.exists(sdk):
|
if os.path.exists(sdk):
|
||||||
@@ -313,8 +313,8 @@ def main(wxDir, args):
|
|||||||
if prefixDir:
|
if prefixDir:
|
||||||
prefixDir = os.path.abspath(prefixDir)
|
prefixDir = os.path.abspath(prefixDir)
|
||||||
configure_opts.append("--prefix=" + prefixDir)
|
configure_opts.append("--prefix=" + prefixDir)
|
||||||
|
|
||||||
|
|
||||||
if options.wxpython:
|
if options.wxpython:
|
||||||
configure_opts.extend(wxpy_configure_opts)
|
configure_opts.extend(wxpy_configure_opts)
|
||||||
if options.debug:
|
if options.debug:
|
||||||
@@ -322,16 +322,16 @@ def main(wxDir, args):
|
|||||||
configure_opts.append("--enable-debug_gdb")
|
configure_opts.append("--enable-debug_gdb")
|
||||||
configure_opts.append("--disable-optimise")
|
configure_opts.append("--disable-optimise")
|
||||||
configure_opts.remove("--enable-optimise")
|
configure_opts.remove("--enable-optimise")
|
||||||
|
|
||||||
|
|
||||||
if options.rebake:
|
if options.rebake:
|
||||||
retval = run("make -f autogen.mk")
|
retval = run("make -f autogen.mk")
|
||||||
exitIfError(retval, "Error running autogen.mk")
|
exitIfError(retval, "Error running autogen.mk")
|
||||||
|
|
||||||
if options.mac_framework:
|
if options.mac_framework:
|
||||||
# TODO: Should options.install be automatically turned on if the
|
# TODO: Should options.install be automatically turned on if the
|
||||||
# mac_framework flag is given?
|
# mac_framework flag is given?
|
||||||
|
|
||||||
# framework builds always need to be monolithic
|
# framework builds always need to be monolithic
|
||||||
if not "--enable-monolithic" in configure_opts:
|
if not "--enable-monolithic" in configure_opts:
|
||||||
configure_opts.append("--enable-monolithic")
|
configure_opts.append("--enable-monolithic")
|
||||||
@@ -340,7 +340,7 @@ def main(wxDir, args):
|
|||||||
# plus the framework specific dir structure.
|
# plus the framework specific dir structure.
|
||||||
prefixDir = getPrefixInFramework(options)
|
prefixDir = getPrefixInFramework(options)
|
||||||
configure_opts.append("--prefix=" + prefixDir)
|
configure_opts.append("--prefix=" + prefixDir)
|
||||||
|
|
||||||
# the framework build adds symlinks above the installDir + prefixDir folder
|
# the framework build adds symlinks above the installDir + prefixDir folder
|
||||||
# so we need to wipe from the framework root instead of inside the prefixDir.
|
# so we need to wipe from the framework root instead of inside the prefixDir.
|
||||||
frameworkRootDir = os.path.abspath(os.path.join(installDir + prefixDir, "..", ".."))
|
frameworkRootDir = os.path.abspath(os.path.join(installDir + prefixDir, "..", ".."))
|
||||||
@@ -348,30 +348,30 @@ def main(wxDir, args):
|
|||||||
if os.path.exists(frameworkRootDir):
|
if os.path.exists(frameworkRootDir):
|
||||||
shutil.rmtree(frameworkRootDir)
|
shutil.rmtree(frameworkRootDir)
|
||||||
|
|
||||||
if options.mac_universal_binary:
|
if options.mac_universal_binary:
|
||||||
if options.mac_universal_binary == 'default':
|
if options.mac_universal_binary == 'default':
|
||||||
if options.osx_cocoa:
|
if options.osx_cocoa:
|
||||||
configure_opts.append("--enable-universal_binary=i386,x86_64")
|
configure_opts.append("--enable-universal_binary=i386,x86_64")
|
||||||
else:
|
else:
|
||||||
configure_opts.append("--enable-universal_binary")
|
configure_opts.append("--enable-universal_binary")
|
||||||
else:
|
else:
|
||||||
configure_opts.append("--enable-universal_binary=%s" % options.mac_universal_binary)
|
configure_opts.append("--enable-universal_binary=%s" % options.mac_universal_binary)
|
||||||
|
|
||||||
|
|
||||||
print("Configure options: " + repr(configure_opts))
|
print("Configure options: " + repr(configure_opts))
|
||||||
wxBuilder = builder.AutoconfBuilder()
|
wxBuilder = builder.AutoconfBuilder()
|
||||||
if not options.no_config and not options.clean:
|
if not options.no_config and not options.clean:
|
||||||
olddir = os.getcwd()
|
olddir = os.getcwd()
|
||||||
if buildDir:
|
if buildDir:
|
||||||
os.chdir(buildDir)
|
os.chdir(buildDir)
|
||||||
exitIfError(wxBuilder.configure(dir=wxRootDir, options=configure_opts),
|
exitIfError(wxBuilder.configure(dir=wxRootDir, options=configure_opts),
|
||||||
"Error running configure")
|
"Error running configure")
|
||||||
os.chdir(olddir)
|
os.chdir(olddir)
|
||||||
|
|
||||||
if options.config_only:
|
if options.config_only:
|
||||||
print("Exiting after configure")
|
print("Exiting after configure")
|
||||||
return
|
return
|
||||||
|
|
||||||
elif toolkit in ["msvc", "msvcProject"]:
|
elif toolkit in ["msvc", "msvcProject"]:
|
||||||
flags = {}
|
flags = {}
|
||||||
buildDir = os.path.abspath(os.path.join(wxRootDir, "build", "msw"))
|
buildDir = os.path.abspath(os.path.join(wxRootDir, "build", "msw"))
|
||||||
@@ -381,12 +381,12 @@ def main(wxDir, args):
|
|||||||
flags["wxUSE_UNICODE"] = "1"
|
flags["wxUSE_UNICODE"] = "1"
|
||||||
if VERSION < (2,9):
|
if VERSION < (2,9):
|
||||||
flags["wxUSE_UNICODE_MSLU"] = "1"
|
flags["wxUSE_UNICODE_MSLU"] = "1"
|
||||||
|
|
||||||
if options.cairo:
|
if options.cairo:
|
||||||
if not os.environ.get("CAIRO_ROOT"):
|
if not os.environ.get("CAIRO_ROOT"):
|
||||||
print("WARNING: Expected CAIRO_ROOT set in the environment!")
|
print("WARNING: Expected CAIRO_ROOT set in the environment!")
|
||||||
flags["wxUSE_CAIRO"] = "1"
|
flags["wxUSE_CAIRO"] = "1"
|
||||||
|
|
||||||
if options.wxpython:
|
if options.wxpython:
|
||||||
flags["wxDIALOG_UNIT_COMPATIBILITY "] = "0"
|
flags["wxDIALOG_UNIT_COMPATIBILITY "] = "0"
|
||||||
flags["wxUSE_DEBUGREPORT"] = "0"
|
flags["wxUSE_DEBUGREPORT"] = "0"
|
||||||
@@ -401,27 +401,27 @@ def main(wxDir, args):
|
|||||||
# Remove this when Windows XP finally dies, or when there is a
|
# Remove this when Windows XP finally dies, or when there is a
|
||||||
# solution for ticket #13116...
|
# solution for ticket #13116...
|
||||||
flags["wxUSE_COMPILER_TLS"] = "0"
|
flags["wxUSE_COMPILER_TLS"] = "0"
|
||||||
|
|
||||||
if VERSION < (2,9):
|
if VERSION < (2,9):
|
||||||
flags["wxUSE_DIB_FOR_BITMAP"] = "1"
|
flags["wxUSE_DIB_FOR_BITMAP"] = "1"
|
||||||
|
|
||||||
if VERSION >= (2,9):
|
if VERSION >= (2,9):
|
||||||
flags["wxUSE_UIACTIONSIMULATOR"] = "1"
|
flags["wxUSE_UIACTIONSIMULATOR"] = "1"
|
||||||
|
|
||||||
|
|
||||||
mswIncludeDir = os.path.join(wxRootDir, "include", "wx", "msw")
|
mswIncludeDir = os.path.join(wxRootDir, "include", "wx", "msw")
|
||||||
setup0File = os.path.join(mswIncludeDir, "setup0.h")
|
setup0File = os.path.join(mswIncludeDir, "setup0.h")
|
||||||
with open(setup0File, "rb") as f:
|
with open(setup0File, "rb") as f:
|
||||||
setupText = f.read()
|
setupText = f.read()
|
||||||
if PY3:
|
if PY3:
|
||||||
setupText = setupText.decode('utf-8')
|
setupText = setupText.decode('utf-8')
|
||||||
|
|
||||||
for flag in flags:
|
for flag in flags:
|
||||||
setupText, subsMade = re.subn(flag + "\s+?\d", "%s %s" % (flag, flags[flag]), setupText)
|
setupText, subsMade = re.subn(flag + "\s+?\d", "%s %s" % (flag, flags[flag]), setupText)
|
||||||
if subsMade == 0:
|
if subsMade == 0:
|
||||||
print("Flag %s wasn't found in setup0.h!" % flag)
|
print("Flag %s wasn't found in setup0.h!" % flag)
|
||||||
sys.exit(1)
|
sys.exit(1)
|
||||||
|
|
||||||
with open(os.path.join(mswIncludeDir, "setup.h"), "wb") as f:
|
with open(os.path.join(mswIncludeDir, "setup.h"), "wb") as f:
|
||||||
if PY3:
|
if PY3:
|
||||||
setupText = setupText.encode('utf-8')
|
setupText = setupText.encode('utf-8')
|
||||||
@@ -435,7 +435,7 @@ def main(wxDir, args):
|
|||||||
args.append("UNICODE=1")
|
args.append("UNICODE=1")
|
||||||
if VERSION < (2,9):
|
if VERSION < (2,9):
|
||||||
args.append("MSLU=1")
|
args.append("MSLU=1")
|
||||||
|
|
||||||
if options.wxpython:
|
if options.wxpython:
|
||||||
args.append("OFFICIAL_BUILD=1")
|
args.append("OFFICIAL_BUILD=1")
|
||||||
args.append("COMPILER_VERSION=%s" % getVisCVersion())
|
args.append("COMPILER_VERSION=%s" % getVisCVersion())
|
||||||
@@ -443,12 +443,12 @@ def main(wxDir, args):
|
|||||||
args.append("MONOLITHIC=0")
|
args.append("MONOLITHIC=0")
|
||||||
args.append("USE_OPENGL=1")
|
args.append("USE_OPENGL=1")
|
||||||
args.append("USE_GDIPLUS=1")
|
args.append("USE_GDIPLUS=1")
|
||||||
|
|
||||||
if not options.debug:
|
if not options.debug:
|
||||||
args.append("BUILD=release")
|
args.append("BUILD=release")
|
||||||
else:
|
else:
|
||||||
args.append("BUILD=debug")
|
args.append("BUILD=debug")
|
||||||
|
|
||||||
if options.shared:
|
if options.shared:
|
||||||
args.append("SHARED=1")
|
args.append("SHARED=1")
|
||||||
|
|
||||||
@@ -456,61 +456,61 @@ def main(wxDir, args):
|
|||||||
args.append(
|
args.append(
|
||||||
"CPPFLAGS=/I%s" %
|
"CPPFLAGS=/I%s" %
|
||||||
os.path.join(os.environ.get("CAIRO_ROOT", ""), 'include\\cairo'))
|
os.path.join(os.environ.get("CAIRO_ROOT", ""), 'include\\cairo'))
|
||||||
|
|
||||||
if options.jom:
|
if options.jom:
|
||||||
nmakeCommand = 'jom.exe'
|
nmakeCommand = 'jom.exe'
|
||||||
|
|
||||||
wxBuilder = builder.MSVCBuilder(commandName=nmakeCommand)
|
wxBuilder = builder.MSVCBuilder(commandName=nmakeCommand)
|
||||||
|
|
||||||
if toolkit == "msvcProject":
|
if toolkit == "msvcProject":
|
||||||
args = []
|
args = []
|
||||||
if options.shared or options.wxpython:
|
if options.shared or options.wxpython:
|
||||||
args.append("wx_dll.dsw")
|
args.append("wx_dll.dsw")
|
||||||
else:
|
else:
|
||||||
args.append("wx.dsw")
|
args.append("wx.dsw")
|
||||||
|
|
||||||
# TODO:
|
# TODO:
|
||||||
wxBuilder = builder.MSVCProjectBuilder()
|
wxBuilder = builder.MSVCProjectBuilder()
|
||||||
|
|
||||||
|
|
||||||
if not wxBuilder:
|
if not wxBuilder:
|
||||||
print("Builder not available for your specified platform/compiler.")
|
print("Builder not available for your specified platform/compiler.")
|
||||||
sys.exit(1)
|
sys.exit(1)
|
||||||
|
|
||||||
if options.clean:
|
if options.clean:
|
||||||
print("Performing cleanup.")
|
print("Performing cleanup.")
|
||||||
wxBuilder.clean(dir=buildDir, options=args)
|
wxBuilder.clean(dir=buildDir, options=args)
|
||||||
|
|
||||||
sys.exit(0)
|
sys.exit(0)
|
||||||
|
|
||||||
if options.extra_make:
|
if options.extra_make:
|
||||||
args.append(options.extra_make)
|
args.append(options.extra_make)
|
||||||
|
|
||||||
if not sys.platform.startswith("win"):
|
if not sys.platform.startswith("win"):
|
||||||
args.append("--jobs=" + options.jobs)
|
args.append("--jobs=" + options.jobs)
|
||||||
exitIfError(wxBuilder.build(dir=buildDir, options=args), "Error building")
|
exitIfError(wxBuilder.build(dir=buildDir, options=args), "Error building")
|
||||||
|
|
||||||
if options.install:
|
if options.install:
|
||||||
extra=None
|
extra=None
|
||||||
if installDir:
|
if installDir:
|
||||||
extra = ['DESTDIR='+installDir]
|
extra = ['DESTDIR='+installDir]
|
||||||
wxBuilder.install(dir=buildDir, options=extra)
|
wxBuilder.install(dir=buildDir, options=extra)
|
||||||
|
|
||||||
if options.install and options.mac_framework:
|
if options.install and options.mac_framework:
|
||||||
|
|
||||||
def renameLibrary(libname, frameworkname):
|
def renameLibrary(libname, frameworkname):
|
||||||
reallib = libname
|
reallib = libname
|
||||||
links = []
|
links = []
|
||||||
while os.path.islink(reallib):
|
while os.path.islink(reallib):
|
||||||
links.append(reallib)
|
links.append(reallib)
|
||||||
reallib = "lib/" + os.readlink(reallib)
|
reallib = "lib/" + os.readlink(reallib)
|
||||||
|
|
||||||
#print("reallib is %s" % reallib)
|
#print("reallib is %s" % reallib)
|
||||||
run("mv -f %s lib/%s.dylib" % (reallib, frameworkname))
|
run("mv -f %s lib/%s.dylib" % (reallib, frameworkname))
|
||||||
|
|
||||||
for link in links:
|
for link in links:
|
||||||
run("ln -s -f %s.dylib %s" % (frameworkname, link))
|
run("ln -s -f %s.dylib %s" % (frameworkname, link))
|
||||||
|
|
||||||
frameworkRootDir = prefixDir
|
frameworkRootDir = prefixDir
|
||||||
if installDir:
|
if installDir:
|
||||||
print("installDir = %s" % installDir)
|
print("installDir = %s" % installDir)
|
||||||
@@ -525,7 +525,7 @@ def main(wxDir, args):
|
|||||||
version_full = getoutput("bin/wx-config --version")
|
version_full = getoutput("bin/wx-config --version")
|
||||||
basename = getoutput("bin/wx-config --basename")
|
basename = getoutput("bin/wx-config --basename")
|
||||||
configname = getoutput("bin/wx-config --selected-config")
|
configname = getoutput("bin/wx-config --selected-config")
|
||||||
|
|
||||||
os.makedirs("Resources")
|
os.makedirs("Resources")
|
||||||
wxplist = dict(
|
wxplist = dict(
|
||||||
CFBundleDevelopmentRegion="English",
|
CFBundleDevelopmentRegion="English",
|
||||||
@@ -539,26 +539,26 @@ def main(wxDir, args):
|
|||||||
CFBundleShortVersionString=version_full,
|
CFBundleShortVersionString=version_full,
|
||||||
CFBundleInfoDictionaryVersion="6.0",
|
CFBundleInfoDictionaryVersion="6.0",
|
||||||
)
|
)
|
||||||
|
|
||||||
import plistlib
|
import plistlib
|
||||||
plistlib.writePlist(wxplist, os.path.join(frameworkRootDir, "Resources", "Info.plist"))
|
plistlib.writePlist(wxplist, os.path.join(frameworkRootDir, "Resources", "Info.plist"))
|
||||||
|
|
||||||
# we make wx the "actual" library file and link to it from libwhatever.dylib
|
# we make wx the "actual" library file and link to it from libwhatever.dylib
|
||||||
# so that things can link to wx and survive minor version changes
|
# so that things can link to wx and survive minor version changes
|
||||||
renameLibrary("lib/lib%s-%s.dylib" % (basename, version), fwname)
|
renameLibrary("lib/lib%s-%s.dylib" % (basename, version), fwname)
|
||||||
run("ln -s -f lib/%s.dylib %s" % (fwname, fwname))
|
run("ln -s -f lib/%s.dylib %s" % (fwname, fwname))
|
||||||
|
|
||||||
run("ln -s -f include Headers")
|
run("ln -s -f include Headers")
|
||||||
|
|
||||||
for lib in ["GL", "STC", "Gizmos", "Gizmos_xrc"]:
|
for lib in ["GL", "STC", "Gizmos", "Gizmos_xrc"]:
|
||||||
libfile = "lib/lib%s_%s-%s.dylib" % (basename, lib.lower(), version)
|
libfile = "lib/lib%s_%s-%s.dylib" % (basename, lib.lower(), version)
|
||||||
if os.path.exists(libfile):
|
if os.path.exists(libfile):
|
||||||
frameworkDir = "framework/wx%s/%s" % (lib, version)
|
frameworkDir = "framework/wx%s/%s" % (lib, version)
|
||||||
if not os.path.exists(frameworkDir):
|
if not os.path.exists(frameworkDir):
|
||||||
os.makedirs(frameworkDir)
|
os.makedirs(frameworkDir)
|
||||||
renameLibrary(libfile, "wx" + lib)
|
renameLibrary(libfile, "wx" + lib)
|
||||||
run("ln -s -f ../../../%s %s/wx%s" % (libfile, frameworkDir, lib))
|
run("ln -s -f ../../../%s %s/wx%s" % (libfile, frameworkDir, lib))
|
||||||
|
|
||||||
for lib in glob.glob("lib/*.dylib"):
|
for lib in glob.glob("lib/*.dylib"):
|
||||||
if not os.path.islink(lib):
|
if not os.path.islink(lib):
|
||||||
corelibname = "lib/lib%s-%s.0.dylib" % (basename, version)
|
corelibname = "lib/lib%s-%s.0.dylib" % (basename, version)
|
||||||
@@ -566,8 +566,8 @@ def main(wxDir, args):
|
|||||||
run("install_name_tool -change %s %s %s" % (os.path.join(frameworkRootDir, corelibname), os.path.join(prefixDir, corelibname), lib))
|
run("install_name_tool -change %s %s %s" % (os.path.join(frameworkRootDir, corelibname), os.path.join(prefixDir, corelibname), lib))
|
||||||
|
|
||||||
os.chdir("include")
|
os.chdir("include")
|
||||||
|
|
||||||
header_template = """
|
header_template = """
|
||||||
#ifndef __WX_FRAMEWORK_HEADER__
|
#ifndef __WX_FRAMEWORK_HEADER__
|
||||||
#define __WX_FRAMEWORK_HEADER__
|
#define __WX_FRAMEWORK_HEADER__
|
||||||
|
|
||||||
@@ -579,42 +579,42 @@ def main(wxDir, args):
|
|||||||
header_dir = "wx-%s/wx" % version
|
header_dir = "wx-%s/wx" % version
|
||||||
for include in glob.glob(header_dir + "/*.h"):
|
for include in glob.glob(header_dir + "/*.h"):
|
||||||
headers += "#include <wx/" + os.path.basename(include) + ">\n"
|
headers += "#include <wx/" + os.path.basename(include) + ">\n"
|
||||||
|
|
||||||
framework_header = open("%s.h" % fwname, "w")
|
framework_header = open("%s.h" % fwname, "w")
|
||||||
framework_header.write(header_template % headers)
|
framework_header.write(header_template % headers)
|
||||||
framework_header.close()
|
framework_header.close()
|
||||||
|
|
||||||
run("ln -s -f %s wx" % header_dir)
|
run("ln -s -f %s wx" % header_dir)
|
||||||
os.chdir("wx-%s/wx" % version)
|
os.chdir("wx-%s/wx" % version)
|
||||||
run("ln -s -f ../../../lib/wx/include/%s/wx/setup.h setup.h" % configname)
|
run("ln -s -f ../../../lib/wx/include/%s/wx/setup.h setup.h" % configname)
|
||||||
|
|
||||||
os.chdir(os.path.join(frameworkRootDir, ".."))
|
os.chdir(os.path.join(frameworkRootDir, ".."))
|
||||||
run("ln -s -f %s Current" % getWxRelease())
|
run("ln -s -f %s Current" % getWxRelease())
|
||||||
os.chdir("..")
|
os.chdir("..")
|
||||||
run("ln -s -f Versions/Current/Headers Headers")
|
run("ln -s -f Versions/Current/Headers Headers")
|
||||||
run("ln -s -f Versions/Current/Resources Resources")
|
run("ln -s -f Versions/Current/Resources Resources")
|
||||||
run("ln -s -f Versions/Current/%s %s" % (fwname, fwname))
|
run("ln -s -f Versions/Current/%s %s" % (fwname, fwname))
|
||||||
|
|
||||||
# sanity check to ensure the symlink works
|
# sanity check to ensure the symlink works
|
||||||
os.chdir("Versions/Current")
|
os.chdir("Versions/Current")
|
||||||
|
|
||||||
# put info about the framework into wx-config
|
# put info about the framework into wx-config
|
||||||
os.chdir(frameworkRootDir)
|
os.chdir(frameworkRootDir)
|
||||||
text = file('lib/wx/config/%s' % configname).read()
|
text = file('lib/wx/config/%s' % configname).read()
|
||||||
text = text.replace("MAC_FRAMEWORK=", "MAC_FRAMEWORK=%s" % getFrameworkName(options))
|
text = text.replace("MAC_FRAMEWORK=", "MAC_FRAMEWORK=%s" % getFrameworkName(options))
|
||||||
if options.mac_framework_prefix not in ['/Library/Frameworks',
|
if options.mac_framework_prefix not in ['/Library/Frameworks',
|
||||||
'/System/Library/Frameworks']:
|
'/System/Library/Frameworks']:
|
||||||
text = text.replace("MAC_FRAMEWORK_PREFIX=",
|
text = text.replace("MAC_FRAMEWORK_PREFIX=",
|
||||||
"MAC_FRAMEWORK_PREFIX=%s" % options.mac_framework_prefix)
|
"MAC_FRAMEWORK_PREFIX=%s" % options.mac_framework_prefix)
|
||||||
file('lib/wx/config/%s' % configname, 'w').write(text)
|
file('lib/wx/config/%s' % configname, 'w').write(text)
|
||||||
|
|
||||||
# The framework is finished!
|
# The framework is finished!
|
||||||
print("wxWidgets framework created at: " +
|
print("wxWidgets framework created at: " +
|
||||||
os.path.join( installDir,
|
os.path.join( installDir,
|
||||||
options.mac_framework_prefix,
|
options.mac_framework_prefix,
|
||||||
'%s.framework' % fwname))
|
'%s.framework' % fwname))
|
||||||
|
|
||||||
|
|
||||||
# adjust the install_name if needed
|
# adjust the install_name if needed
|
||||||
if sys.platform.startswith("darwin") and \
|
if sys.platform.startswith("darwin") and \
|
||||||
options.install and \
|
options.install and \
|
||||||
@@ -633,7 +633,7 @@ def main(wxDir, args):
|
|||||||
|
|
||||||
if os.path.exists(options.mac_distdir):
|
if os.path.exists(options.mac_distdir):
|
||||||
shutil.rmtree(options.mac_distdir)
|
shutil.rmtree(options.mac_distdir)
|
||||||
|
|
||||||
packagedir = os.path.join(options.mac_distdir, "packages")
|
packagedir = os.path.join(options.mac_distdir, "packages")
|
||||||
os.makedirs(packagedir)
|
os.makedirs(packagedir)
|
||||||
basename = os.path.basename(prefixDir.split(".")[0])
|
basename = os.path.basename(prefixDir.split(".")[0])
|
||||||
@@ -648,14 +648,13 @@ def main(wxDir, args):
|
|||||||
cmd = packageMakerPath + ' '.join(args)
|
cmd = packageMakerPath + ' '.join(args)
|
||||||
print("cmd = %s" % cmd)
|
print("cmd = %s" % cmd)
|
||||||
run(cmd)
|
run(cmd)
|
||||||
|
|
||||||
os.chdir(options.mac_distdir)
|
os.chdir(options.mac_distdir)
|
||||||
|
|
||||||
run('hdiutil create -srcfolder %s -volname "%s" -imagekey zlib-level=9 %s.dmg' % (packagedir, packageName, packageName))
|
run('hdiutil create -srcfolder %s -volname "%s" -imagekey zlib-level=9 %s.dmg' % (packagedir, packageName, packageName))
|
||||||
|
|
||||||
shutil.rmtree(packagedir)
|
shutil.rmtree(packagedir)
|
||||||
|
|
||||||
if __name__ == '__main__':
|
if __name__ == '__main__':
|
||||||
exitWithException = False # use sys.exit instead
|
exitWithException = False # use sys.exit instead
|
||||||
main(sys.argv[0], sys.argv[1:])
|
main(sys.argv[0], sys.argv[1:])
|
||||||
|
|
||||||
|
|||||||
@@ -69,7 +69,7 @@ class Builder:
|
|||||||
|
|
||||||
for dir in dirs:
|
for dir in dirs:
|
||||||
if os.path.isfile(os.path.join(dir, self.name)):
|
if os.path.isfile(os.path.join(dir, self.name)):
|
||||||
return True
|
return True
|
||||||
|
|
||||||
else:
|
else:
|
||||||
result = os.system("which %s" % self.name)
|
result = os.system("which %s" % self.name)
|
||||||
@@ -93,7 +93,7 @@ class Builder:
|
|||||||
if projectFile:
|
if projectFile:
|
||||||
result.append(projectFile)
|
result.append(projectFile)
|
||||||
return result
|
return result
|
||||||
|
|
||||||
def clean(self, dir=None, projectFile=None, options=[]):
|
def clean(self, dir=None, projectFile=None, options=[]):
|
||||||
"""
|
"""
|
||||||
dir = the directory containing the project file
|
dir = the directory containing the project file
|
||||||
@@ -125,7 +125,7 @@ class Builder:
|
|||||||
# Important Note: if extending args, check it first!
|
# Important Note: if extending args, check it first!
|
||||||
# NoneTypes are not iterable and will crash the clean, build, or install!
|
# NoneTypes are not iterable and will crash the clean, build, or install!
|
||||||
# Very very irritating when this happens right at the end.
|
# Very very irritating when this happens right at the end.
|
||||||
if options:
|
if options:
|
||||||
args.extend(options)
|
args.extend(options)
|
||||||
result = runInDir(args, dir)
|
result = runInDir(args, dir)
|
||||||
return result
|
return result
|
||||||
@@ -179,7 +179,7 @@ class AutoconfBuilder(GNUMakeBuilder):
|
|||||||
if configdir == parentdir:
|
if configdir == parentdir:
|
||||||
break
|
break
|
||||||
|
|
||||||
configdir = parentdir
|
configdir = parentdir
|
||||||
else:
|
else:
|
||||||
configure_cmd = config_cmd
|
configure_cmd = config_cmd
|
||||||
break
|
break
|
||||||
@@ -211,10 +211,10 @@ class MSVCBuilder(Builder):
|
|||||||
result = []
|
result = []
|
||||||
if projectFile:
|
if projectFile:
|
||||||
result.extend(['-f', projectFile])
|
result.extend(['-f', projectFile])
|
||||||
|
|
||||||
return result
|
return result
|
||||||
|
|
||||||
|
|
||||||
class MSVCProjectBuilder(Builder):
|
class MSVCProjectBuilder(Builder):
|
||||||
def __init__(self):
|
def __init__(self):
|
||||||
Builder.__init__(self, commandName="VCExpress.exe", formatName="msvcProject")
|
Builder.__init__(self, commandName="VCExpress.exe", formatName="msvcProject")
|
||||||
|
|||||||
@@ -34,7 +34,7 @@ runSilently = False
|
|||||||
#----------------------------------------------------------------------
|
#----------------------------------------------------------------------
|
||||||
|
|
||||||
class Configuration(object):
|
class Configuration(object):
|
||||||
|
|
||||||
##SIP = SIPdefault # Where is the sip binary?
|
##SIP = SIPdefault # Where is the sip binary?
|
||||||
SIPINC = 'sip/siplib' # Use our local copy of sip.h
|
SIPINC = 'sip/siplib' # Use our local copy of sip.h
|
||||||
SIPGEN = 'sip/gen' # Where the generated .sip files go
|
SIPGEN = 'sip/gen' # Where the generated .sip files go
|
||||||
@@ -67,10 +67,10 @@ class Configuration(object):
|
|||||||
# monolithic DLL or as a collection of DLLs. This flag controls
|
# monolithic DLL or as a collection of DLLs. This flag controls
|
||||||
# which set of libs will be used on Windows. (For other platforms
|
# which set of libs will be used on Windows. (For other platforms
|
||||||
# it is automatic via using wx-config.)
|
# it is automatic via using wx-config.)
|
||||||
|
|
||||||
WXDLLVER = None
|
WXDLLVER = None
|
||||||
# Version part of wxWidgets LIB/DLL names
|
# Version part of wxWidgets LIB/DLL names
|
||||||
|
|
||||||
COMPILER = 'msvc'
|
COMPILER = 'msvc'
|
||||||
# Used to select which compiler will be used on Windows. This not
|
# Used to select which compiler will be used on Windows. This not
|
||||||
# only affects distutils, but also some of the default flags and
|
# only affects distutils, but also some of the default flags and
|
||||||
@@ -83,18 +83,18 @@ class Configuration(object):
|
|||||||
|
|
||||||
NO_SCRIPTS = False
|
NO_SCRIPTS = False
|
||||||
# Don't install the tools/script files
|
# Don't install the tools/script files
|
||||||
|
|
||||||
PKGDIR = 'wx'
|
PKGDIR = 'wx'
|
||||||
# The name of the top-level package
|
# The name of the top-level package
|
||||||
|
|
||||||
# ---------------------------------------------------------------
|
# ---------------------------------------------------------------
|
||||||
# Basic initialization and configuration code
|
# Basic initialization and configuration code
|
||||||
|
|
||||||
def __init__(self, noWxConfig=False):
|
def __init__(self, noWxConfig=False):
|
||||||
self.CLEANUP = list()
|
self.CLEANUP = list()
|
||||||
|
|
||||||
self.resetVersion()
|
self.resetVersion()
|
||||||
|
|
||||||
# change the PORT default for wxMac
|
# change the PORT default for wxMac
|
||||||
if sys.platform[:6] == "darwin":
|
if sys.platform[:6] == "darwin":
|
||||||
self.WXPORT = 'osx_cocoa'
|
self.WXPORT = 'osx_cocoa'
|
||||||
@@ -111,7 +111,7 @@ class Configuration(object):
|
|||||||
|
|
||||||
self.WXPLAT2 = None
|
self.WXPLAT2 = None
|
||||||
self.WXDIR = wxDir()
|
self.WXDIR = wxDir()
|
||||||
|
|
||||||
self.includes = [phoenixDir() + '/sip/siplib', # to get our version of sip.h
|
self.includes = [phoenixDir() + '/sip/siplib', # to get our version of sip.h
|
||||||
phoenixDir() + '/src', # for any hand-written headers
|
phoenixDir() + '/src', # for any hand-written headers
|
||||||
]
|
]
|
||||||
@@ -126,22 +126,22 @@ class Configuration(object):
|
|||||||
'-I', os.path.join(phoenixDir(), 'src'),
|
'-I', os.path.join(phoenixDir(), 'src'),
|
||||||
'-I', os.path.join(phoenixDir(), 'sip', 'gen'),
|
'-I', os.path.join(phoenixDir(), 'sip', 'gen'),
|
||||||
])
|
])
|
||||||
|
|
||||||
if noWxConfig:
|
if noWxConfig:
|
||||||
# this is as far as we go for now
|
# this is as far as we go for now
|
||||||
return
|
return
|
||||||
|
|
||||||
# otherwise do the rest of it
|
# otherwise do the rest of it
|
||||||
self.finishSetup()
|
self.finishSetup()
|
||||||
|
|
||||||
|
|
||||||
def finishSetup(self, wx_config=None, debug=None):
|
def finishSetup(self, wx_config=None, debug=None):
|
||||||
if wx_config is not None:
|
if wx_config is not None:
|
||||||
self.WX_CONFIG = wx_config
|
self.WX_CONFIG = wx_config
|
||||||
|
|
||||||
if debug is not None:
|
if debug is not None:
|
||||||
self.debug = debug
|
self.debug = debug
|
||||||
|
|
||||||
#---------------------------------------
|
#---------------------------------------
|
||||||
# MSW specific settings
|
# MSW specific settings
|
||||||
if os.name == 'nt' and self.COMPILER == 'msvc':
|
if os.name == 'nt' and self.COMPILER == 'msvc':
|
||||||
@@ -149,18 +149,18 @@ class Configuration(object):
|
|||||||
# from the wxWidgets makefiles for MSVC, other compilers settings
|
# from the wxWidgets makefiles for MSVC, other compilers settings
|
||||||
# will probably vary...
|
# will probably vary...
|
||||||
self.WXPLAT = '__WXMSW__'
|
self.WXPLAT = '__WXMSW__'
|
||||||
|
|
||||||
if os.environ.get('CPU', None) in ['AMD64', 'X64']:
|
if os.environ.get('CPU', None) in ['AMD64', 'X64']:
|
||||||
self.VCDLL = 'vc%s_x64_dll' % getVisCVersion()
|
self.VCDLL = 'vc%s_x64_dll' % getVisCVersion()
|
||||||
else:
|
else:
|
||||||
self.VCDLL = 'vc%s_dll' % getVisCVersion()
|
self.VCDLL = 'vc%s_dll' % getVisCVersion()
|
||||||
|
|
||||||
self.includes += ['include',
|
self.includes += ['include',
|
||||||
opj(self.WXDIR, 'lib', self.VCDLL, 'msw' + self.libFlag()),
|
opj(self.WXDIR, 'lib', self.VCDLL, 'msw' + self.libFlag()),
|
||||||
opj(self.WXDIR, 'include'),
|
opj(self.WXDIR, 'include'),
|
||||||
opj(self.WXDIR, 'contrib', 'include'),
|
opj(self.WXDIR, 'contrib', 'include'),
|
||||||
]
|
]
|
||||||
|
|
||||||
self.defines = [ ('WIN32', None),
|
self.defines = [ ('WIN32', None),
|
||||||
('_WINDOWS', None),
|
('_WINDOWS', None),
|
||||||
(self.WXPLAT, None),
|
(self.WXPLAT, None),
|
||||||
@@ -168,45 +168,45 @@ class Configuration(object):
|
|||||||
('ISOLATION_AWARE_ENABLED', None),
|
('ISOLATION_AWARE_ENABLED', None),
|
||||||
#('NDEBUG',), # using a 1-tuple makes it do an undef
|
#('NDEBUG',), # using a 1-tuple makes it do an undef
|
||||||
]
|
]
|
||||||
|
|
||||||
self.libs = []
|
self.libs = []
|
||||||
self.libdirs = [ opj(self.WXDIR, 'lib', self.VCDLL) ]
|
self.libdirs = [ opj(self.WXDIR, 'lib', self.VCDLL) ]
|
||||||
if self.MONOLITHIC:
|
if self.MONOLITHIC:
|
||||||
self.libs += makeLibName('')
|
self.libs += makeLibName('')
|
||||||
else:
|
else:
|
||||||
self.libs += [ 'wxbase' + self.WXDLLVER + self.libFlag(),
|
self.libs += [ 'wxbase' + self.WXDLLVER + self.libFlag(),
|
||||||
'wxbase' + self.WXDLLVER + self.libFlag() + '_net',
|
'wxbase' + self.WXDLLVER + self.libFlag() + '_net',
|
||||||
self.makeLibName('core')[0],
|
self.makeLibName('core')[0],
|
||||||
]
|
]
|
||||||
|
|
||||||
self.libs += ['kernel32', 'user32', 'gdi32', 'comdlg32',
|
self.libs += ['kernel32', 'user32', 'gdi32', 'comdlg32',
|
||||||
'winspool', 'winmm', 'shell32', 'oldnames', 'comctl32',
|
'winspool', 'winmm', 'shell32', 'oldnames', 'comctl32',
|
||||||
'odbc32', 'ole32', 'oleaut32', 'uuid', 'rpcrt4',
|
'odbc32', 'ole32', 'oleaut32', 'uuid', 'rpcrt4',
|
||||||
'advapi32', 'wsock32']
|
'advapi32', 'wsock32']
|
||||||
|
|
||||||
self.cflags = [ '/UNDEBUG',
|
self.cflags = [ '/UNDEBUG',
|
||||||
'/Gy',
|
'/Gy',
|
||||||
'/EHsc',
|
'/EHsc',
|
||||||
# '/GX-' # workaround for internal compiler error in MSVC on some machines
|
# '/GX-' # workaround for internal compiler error in MSVC on some machines
|
||||||
]
|
]
|
||||||
self.lflags = None
|
self.lflags = None
|
||||||
|
|
||||||
# Other MSVC flags...
|
# Other MSVC flags...
|
||||||
# Uncomment these to have debug info for all kinds of builds
|
# Uncomment these to have debug info for all kinds of builds
|
||||||
#self.cflags += ['/Od', '/Z7']
|
#self.cflags += ['/Od', '/Z7']
|
||||||
#self.lflags = ['/DEBUG', ]
|
#self.lflags = ['/DEBUG', ]
|
||||||
|
|
||||||
|
|
||||||
#---------------------------------------
|
#---------------------------------------
|
||||||
# Posix (wxGTK, wxMac or mingw32) settings
|
# Posix (wxGTK, wxMac or mingw32) settings
|
||||||
elif os.name == 'posix' or COMPILER == 'mingw32':
|
elif os.name == 'posix' or COMPILER == 'mingw32':
|
||||||
self.Verify_WX_CONFIG()
|
self.Verify_WX_CONFIG()
|
||||||
self.includes += ['include']
|
self.includes += ['include']
|
||||||
self.defines = [ #('NDEBUG',), # using a 1-tuple makes it do an undef
|
self.defines = [ #('NDEBUG',), # using a 1-tuple makes it do an undef
|
||||||
]
|
]
|
||||||
self.libdirs = []
|
self.libdirs = []
|
||||||
self.libs = []
|
self.libs = []
|
||||||
|
|
||||||
self.cflags = self.getWxConfigValue('--cxxflags')
|
self.cflags = self.getWxConfigValue('--cxxflags')
|
||||||
self.cflags = self.cflags.split()
|
self.cflags = self.cflags.split()
|
||||||
if self.debug:
|
if self.debug:
|
||||||
@@ -214,11 +214,11 @@ class Configuration(object):
|
|||||||
self.cflags.append('-O0')
|
self.cflags.append('-O0')
|
||||||
else:
|
else:
|
||||||
self.cflags.append('-O3')
|
self.cflags.append('-O3')
|
||||||
|
|
||||||
lflags = self.getWxConfigValue('--libs')
|
lflags = self.getWxConfigValue('--libs')
|
||||||
self.MONOLITHIC = (lflags.find("_xrc") == -1)
|
self.MONOLITHIC = (lflags.find("_xrc") == -1)
|
||||||
self.lflags = lflags.split()
|
self.lflags = lflags.split()
|
||||||
|
|
||||||
self.WXBASENAME = self.getWxConfigValue('--basename')
|
self.WXBASENAME = self.getWxConfigValue('--basename')
|
||||||
self.WXRELEASE = self.getWxConfigValue('--release')
|
self.WXRELEASE = self.getWxConfigValue('--release')
|
||||||
self.WXPREFIX = self.getWxConfigValue('--prefix')
|
self.WXPREFIX = self.getWxConfigValue('--prefix')
|
||||||
@@ -228,13 +228,13 @@ class Configuration(object):
|
|||||||
# wxMac settings
|
# wxMac settings
|
||||||
if sys.platform[:6] == "darwin":
|
if sys.platform[:6] == "darwin":
|
||||||
self.WXPLAT = '__WXMAC__'
|
self.WXPLAT = '__WXMAC__'
|
||||||
|
|
||||||
if self.WXPORT == 'osx_carbon':
|
if self.WXPORT == 'osx_carbon':
|
||||||
# Flags and such for a Darwin (Max OS X) build of Python
|
# Flags and such for a Darwin (Max OS X) build of Python
|
||||||
self.WXPLAT2 = '__WXOSX_CARBON__'
|
self.WXPLAT2 = '__WXOSX_CARBON__'
|
||||||
else:
|
else:
|
||||||
self.WXPLAT2 = '__WXOSX_COCOA__'
|
self.WXPLAT2 = '__WXOSX_COCOA__'
|
||||||
|
|
||||||
self.libs = ['stdc++']
|
self.libs = ['stdc++']
|
||||||
if not self.ARCH == "":
|
if not self.ARCH == "":
|
||||||
for arch in self.ARCH.split(','):
|
for arch in self.ARCH.split(','):
|
||||||
@@ -242,11 +242,11 @@ class Configuration(object):
|
|||||||
self.cflags.append(arch)
|
self.cflags.append(arch)
|
||||||
self.lflags.append("-arch")
|
self.lflags.append("-arch")
|
||||||
self.lflags.append(arch)
|
self.lflags.append(arch)
|
||||||
|
|
||||||
if not os.environ.get('CC') or not os.environ.get('CXX'):
|
if not os.environ.get('CC') or not os.environ.get('CXX'):
|
||||||
self.CC = os.environ["CC"] = self.getWxConfigValue('--cc')
|
self.CC = os.environ["CC"] = self.getWxConfigValue('--cc')
|
||||||
self.CXX = os.environ["CXX"] = self.getWxConfigValue('--cxx')
|
self.CXX = os.environ["CXX"] = self.getWxConfigValue('--cxx')
|
||||||
|
|
||||||
# We want to use the linker command from wx to make sure
|
# We want to use the linker command from wx to make sure
|
||||||
# we get the right sysroot, but we also need to ensure that
|
# we get the right sysroot, but we also need to ensure that
|
||||||
# the other linker flags that distutils wants to use are
|
# the other linker flags that distutils wants to use are
|
||||||
@@ -261,14 +261,14 @@ class Configuration(object):
|
|||||||
# Strip this argument and the next one:
|
# Strip this argument and the next one:
|
||||||
del LDSHARED[index:index+2]
|
del LDSHARED[index:index+2]
|
||||||
except ValueError:
|
except ValueError:
|
||||||
break
|
break
|
||||||
LDSHARED = ' '.join(LDSHARED)
|
LDSHARED = ' '.join(LDSHARED)
|
||||||
# Combine with wx's ld command and stash it in the env
|
# Combine with wx's ld command and stash it in the env
|
||||||
# where distutils will get it later.
|
# where distutils will get it later.
|
||||||
LDSHARED = self.getWxConfigValue('--ld').replace(' -o', '') + ' ' + LDSHARED
|
LDSHARED = self.getWxConfigValue('--ld').replace(' -o', '') + ' ' + LDSHARED
|
||||||
os.environ["LDSHARED"] = LDSHARED
|
os.environ["LDSHARED"] = LDSHARED
|
||||||
|
|
||||||
|
|
||||||
# wxGTK settings
|
# wxGTK settings
|
||||||
else:
|
else:
|
||||||
# Set flags for other Unix type platforms
|
# Set flags for other Unix type platforms
|
||||||
@@ -293,23 +293,23 @@ class Configuration(object):
|
|||||||
portcfg = ''
|
portcfg = ''
|
||||||
else:
|
else:
|
||||||
raise SystemExit("Unknown WXPORT value: " + self.WXPORT)
|
raise SystemExit("Unknown WXPORT value: " + self.WXPORT)
|
||||||
|
|
||||||
self.cflags += portcfg.split()
|
self.cflags += portcfg.split()
|
||||||
|
|
||||||
# Some distros (e.g. Mandrake) put libGLU in /usr/X11R6/lib, but
|
# Some distros (e.g. Mandrake) put libGLU in /usr/X11R6/lib, but
|
||||||
# wx-config doesn't output that for some reason. For now, just
|
# wx-config doesn't output that for some reason. For now, just
|
||||||
# add it unconditionally but we should really check if the lib is
|
# add it unconditionally but we should really check if the lib is
|
||||||
# really found there or wx-config should be fixed.
|
# really found there or wx-config should be fixed.
|
||||||
if self.WXPORT != 'msw':
|
if self.WXPORT != 'msw':
|
||||||
self.libdirs.append("/usr/X11R6/lib")
|
self.libdirs.append("/usr/X11R6/lib")
|
||||||
|
|
||||||
# Move the various -I, -D, etc. flags we got from the config scripts
|
# Move the various -I, -D, etc. flags we got from the config scripts
|
||||||
# into the distutils lists.
|
# into the distutils lists.
|
||||||
self.cflags = self.adjustCFLAGS(self.cflags, self.defines, self.includes)
|
self.cflags = self.adjustCFLAGS(self.cflags, self.defines, self.includes)
|
||||||
self.lflags = self.adjustLFLAGS(self.lflags, self.libdirs, self.libs)
|
self.lflags = self.adjustLFLAGS(self.lflags, self.libdirs, self.libs)
|
||||||
|
|
||||||
self.cflags.insert(0, '-UNDEBUG')
|
self.cflags.insert(0, '-UNDEBUG')
|
||||||
|
|
||||||
if self.debug and self.WXPORT == 'msw' and self.COMPILER != 'mingw32':
|
if self.debug and self.WXPORT == 'msw' and self.COMPILER != 'mingw32':
|
||||||
self.defines.append( ('_DEBUG', None) )
|
self.defines.append( ('_DEBUG', None) )
|
||||||
|
|
||||||
@@ -322,11 +322,11 @@ class Configuration(object):
|
|||||||
if val:
|
if val:
|
||||||
name = name+'='+val
|
name = name+'='+val
|
||||||
self.wafDefines.append(name)
|
self.wafDefines.append(name)
|
||||||
|
|
||||||
|
|
||||||
# ---------------------------------------------------------------
|
# ---------------------------------------------------------------
|
||||||
# Helper functions
|
# Helper functions
|
||||||
|
|
||||||
def resetVersion(self):
|
def resetVersion(self):
|
||||||
# load the version numbers into this instance's namespace
|
# load the version numbers into this instance's namespace
|
||||||
versionfile = opj(os.path.split(__file__)[0], 'version.py')
|
versionfile = opj(os.path.split(__file__)[0], 'version.py')
|
||||||
@@ -340,15 +340,15 @@ class Configuration(object):
|
|||||||
f = open('REV.txt')
|
f = open('REV.txt')
|
||||||
self.VER_FLAGS += f.read().strip()
|
self.VER_FLAGS += f.read().strip()
|
||||||
f.close()
|
f.close()
|
||||||
|
|
||||||
self.VERSION = "%s.%s.%s%s" % (self.VER_MAJOR,
|
self.VERSION = "%s.%s.%s%s" % (self.VER_MAJOR,
|
||||||
self.VER_MINOR,
|
self.VER_MINOR,
|
||||||
self.VER_RELEASE,
|
self.VER_RELEASE,
|
||||||
self.VER_FLAGS)
|
self.VER_FLAGS)
|
||||||
|
|
||||||
self.WXDLLVER = '%d%d' % (self.VER_MAJOR, self.VER_MINOR)
|
self.WXDLLVER = '%d%d' % (self.VER_MAJOR, self.VER_MINOR)
|
||||||
|
|
||||||
|
|
||||||
def parseCmdLine(self):
|
def parseCmdLine(self):
|
||||||
self.debug = '--debug' in sys.argv or '-g' in sys.argv
|
self.debug = '--debug' in sys.argv or '-g' in sys.argv
|
||||||
|
|
||||||
@@ -439,12 +439,12 @@ class Configuration(object):
|
|||||||
else:
|
else:
|
||||||
# TODO: Python3 version using os.walk generator
|
# TODO: Python3 version using os.walk generator
|
||||||
return []
|
return []
|
||||||
|
|
||||||
|
|
||||||
def find_data_files(self, srcdir, *wildcards, **kw):
|
def find_data_files(self, srcdir, *wildcards, **kw):
|
||||||
# get a list of all files under the srcdir matching wildcards,
|
# get a list of all files under the srcdir matching wildcards,
|
||||||
# returned in a format to be used for install_data
|
# returned in a format to be used for install_data
|
||||||
|
|
||||||
def walk_helper(arg, dirname, files):
|
def walk_helper(arg, dirname, files):
|
||||||
if '.svn' in dirname:
|
if '.svn' in dirname:
|
||||||
return
|
return
|
||||||
@@ -454,12 +454,12 @@ class Configuration(object):
|
|||||||
wc_name = opj(dirname, wc)
|
wc_name = opj(dirname, wc)
|
||||||
for f in files:
|
for f in files:
|
||||||
filename = opj(dirname, f)
|
filename = opj(dirname, f)
|
||||||
|
|
||||||
if fnmatch.fnmatch(filename, wc_name) and not os.path.isdir(filename):
|
if fnmatch.fnmatch(filename, wc_name) and not os.path.isdir(filename):
|
||||||
names.append(filename)
|
names.append(filename)
|
||||||
if names:
|
if names:
|
||||||
lst.append( (dirname, names ) )
|
lst.append( (dirname, names ) )
|
||||||
|
|
||||||
file_list = []
|
file_list = []
|
||||||
recursive = kw.get('recursive', True)
|
recursive = kw.get('recursive', True)
|
||||||
if recursive:
|
if recursive:
|
||||||
@@ -469,8 +469,8 @@ class Configuration(object):
|
|||||||
srcdir,
|
srcdir,
|
||||||
[os.path.basename(f) for f in glob.glob(opj(srcdir, '*'))])
|
[os.path.basename(f) for f in glob.glob(opj(srcdir, '*'))])
|
||||||
return file_list
|
return file_list
|
||||||
|
|
||||||
|
|
||||||
def makeLibName(self, name, checkMonolithic=False, isMSWBase=False):
|
def makeLibName(self, name, checkMonolithic=False, isMSWBase=False):
|
||||||
if checkMonolithic and self.MONOLITHIC:
|
if checkMonolithic and self.MONOLITHIC:
|
||||||
return []
|
return []
|
||||||
@@ -482,8 +482,8 @@ class Configuration(object):
|
|||||||
else:
|
else:
|
||||||
libname = 'wx%s%s%s' % (basename, self.WXDLLVER, self.libFlag())
|
libname = 'wx%s%s%s' % (basename, self.WXDLLVER, self.libFlag())
|
||||||
return [libname]
|
return [libname]
|
||||||
|
|
||||||
|
|
||||||
def libFlag(self):
|
def libFlag(self):
|
||||||
if not self.debug:
|
if not self.debug:
|
||||||
rv = ''
|
rv = ''
|
||||||
@@ -493,18 +493,18 @@ class Configuration(object):
|
|||||||
rv = 'u' + rv
|
rv = 'u' + rv
|
||||||
return rv
|
return rv
|
||||||
|
|
||||||
|
|
||||||
def findLib(self, name, libdirs):
|
def findLib(self, name, libdirs):
|
||||||
name = self.makeLibName(name)[0]
|
name = self.makeLibName(name)[0]
|
||||||
if os.name == 'posix' or self.COMPILER == 'mingw32':
|
if os.name == 'posix' or self.COMPILER == 'mingw32':
|
||||||
lflags = self.getWxConfigValue('--libs')
|
lflags = self.getWxConfigValue('--libs')
|
||||||
lflags = lflags.split()
|
lflags = lflags.split()
|
||||||
|
|
||||||
# if wx-config --libs output does not start with -L, wx is
|
# if wx-config --libs output does not start with -L, wx is
|
||||||
# installed with a standard prefix and wx-config does not
|
# installed with a standard prefix and wx-config does not
|
||||||
# output these libdirs because they are already searched by
|
# output these libdirs because they are already searched by
|
||||||
# default by the compiler and linker.
|
# default by the compiler and linker.
|
||||||
if lflags[0][:2] != '-L':
|
if lflags[0][:2] != '-L':
|
||||||
dirs = libdirs + ['/usr/lib', '/usr/local/lib']
|
dirs = libdirs + ['/usr/lib', '/usr/local/lib']
|
||||||
else:
|
else:
|
||||||
dirs = libdirs
|
dirs = libdirs
|
||||||
@@ -516,10 +516,10 @@ class Configuration(object):
|
|||||||
if glob.glob(p+'*') != []:
|
if glob.glob(p+'*') != []:
|
||||||
return True
|
return True
|
||||||
return False
|
return False
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
def adjustCFLAGS(self, cflags, defines, includes):
|
def adjustCFLAGS(self, cflags, defines, includes):
|
||||||
"""
|
"""
|
||||||
Extract the raw -I, -D, and -U flags from cflags and put them into
|
Extract the raw -I, -D, and -U flags from cflags and put them into
|
||||||
@@ -540,9 +540,9 @@ class Configuration(object):
|
|||||||
else:
|
else:
|
||||||
newCFLAGS.append(flag)
|
newCFLAGS.append(flag)
|
||||||
return newCFLAGS
|
return newCFLAGS
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
def adjustLFLAGS(self, lflags, libdirs, libs):
|
def adjustLFLAGS(self, lflags, libdirs, libs):
|
||||||
"""
|
"""
|
||||||
Extract the -L and -l flags from lflags and put them in libdirs and
|
Extract the -L and -l flags from lflags and put them in libdirs and
|
||||||
@@ -557,9 +557,9 @@ class Configuration(object):
|
|||||||
else:
|
else:
|
||||||
newLFLAGS.append(flag)
|
newLFLAGS.append(flag)
|
||||||
return newLFLAGS
|
return newLFLAGS
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
# We'll use a factory function so we can use the Configuration class as a singleton
|
# We'll use a factory function so we can use the Configuration class as a singleton
|
||||||
_config = None
|
_config = None
|
||||||
|
|
||||||
@@ -577,7 +577,7 @@ def msg(text):
|
|||||||
if not runSilently:
|
if not runSilently:
|
||||||
print(text)
|
print(text)
|
||||||
|
|
||||||
|
|
||||||
def opj(*args):
|
def opj(*args):
|
||||||
path = os.path.join(*args)
|
path = os.path.join(*args)
|
||||||
return os.path.normpath(path)
|
return os.path.normpath(path)
|
||||||
@@ -606,7 +606,7 @@ def loadETG(name):
|
|||||||
self.__dict__['__name__'] = 'namespace'
|
self.__dict__['__name__'] = 'namespace'
|
||||||
def nsdict(self):
|
def nsdict(self):
|
||||||
return self.__dict__
|
return self.__dict__
|
||||||
|
|
||||||
ns = _Namespace()
|
ns = _Namespace()
|
||||||
myExecfile(name, ns.nsdict())
|
myExecfile(name, ns.nsdict())
|
||||||
return ns
|
return ns
|
||||||
@@ -618,7 +618,7 @@ def etg2sip(etgfile):
|
|||||||
|
|
||||||
sipfile = posixjoin(cfg.SIPGEN, sipfile)
|
sipfile = posixjoin(cfg.SIPGEN, sipfile)
|
||||||
return sipfile
|
return sipfile
|
||||||
|
|
||||||
|
|
||||||
def _getSbfValue(etg, keyName):
|
def _getSbfValue(etg, keyName):
|
||||||
cfg = Config()
|
cfg = Config()
|
||||||
@@ -649,8 +649,8 @@ def findCmd(cmd):
|
|||||||
if os.path.exists(c):
|
if os.path.exists(c):
|
||||||
return c
|
return c
|
||||||
return None
|
return None
|
||||||
|
|
||||||
|
|
||||||
def phoenixDir():
|
def phoenixDir():
|
||||||
return os.path.abspath(posixjoin(os.path.dirname(__file__), '..'))
|
return os.path.abspath(posixjoin(os.path.dirname(__file__), '..'))
|
||||||
|
|
||||||
@@ -679,27 +679,27 @@ def copyFile(src, dest, verbose=False):
|
|||||||
os.symlink(linkto, dest)
|
os.symlink(linkto, dest)
|
||||||
else:
|
else:
|
||||||
shutil.copy2(src, dest)
|
shutil.copy2(src, dest)
|
||||||
|
|
||||||
|
|
||||||
def copyIfNewer(src, dest, verbose=False):
|
def copyIfNewer(src, dest, verbose=False):
|
||||||
if os.path.isdir(dest):
|
if os.path.isdir(dest):
|
||||||
dest = os.path.join(dest, os.path.basename(src))
|
dest = os.path.join(dest, os.path.basename(src))
|
||||||
if newer(src, dest):
|
if newer(src, dest):
|
||||||
copyFile(src, dest, verbose)
|
copyFile(src, dest, verbose)
|
||||||
|
|
||||||
|
|
||||||
def writeIfChanged(filename, text):
|
def writeIfChanged(filename, text):
|
||||||
"""
|
"""
|
||||||
Check the current contents of filename and only overwrite with text if
|
Check the current contents of filename and only overwrite with text if
|
||||||
the content is different (therefore preserving the timestamp if there is
|
the content is different (therefore preserving the timestamp if there is
|
||||||
no update.)
|
no update.)
|
||||||
"""
|
"""
|
||||||
|
|
||||||
if os.path.exists(filename):
|
if os.path.exists(filename):
|
||||||
f = textfile_open(filename, 'rt')
|
f = textfile_open(filename, 'rt')
|
||||||
current = f.read()
|
current = f.read()
|
||||||
f.close()
|
f.close()
|
||||||
|
|
||||||
if current == text:
|
if current == text:
|
||||||
return
|
return
|
||||||
|
|
||||||
@@ -713,14 +713,14 @@ def macFixDependencyInstallName(destdir, prefix, extension, buildDir):
|
|||||||
print("**** macFixDependencyInstallName(%s, %s, %s, %s)" % (destdir, prefix, extension, buildDir))
|
print("**** macFixDependencyInstallName(%s, %s, %s, %s)" % (destdir, prefix, extension, buildDir))
|
||||||
pwd = os.getcwd()
|
pwd = os.getcwd()
|
||||||
os.chdir(destdir+prefix+'/lib')
|
os.chdir(destdir+prefix+'/lib')
|
||||||
dylibs = glob.glob('*.dylib')
|
dylibs = glob.glob('*.dylib')
|
||||||
for lib in dylibs:
|
for lib in dylibs:
|
||||||
#cmd = 'install_name_tool -change %s/lib/%s %s/lib/%s %s' % \
|
#cmd = 'install_name_tool -change %s/lib/%s %s/lib/%s %s' % \
|
||||||
# (destdir+prefix,lib, prefix,lib, extension)
|
# (destdir+prefix,lib, prefix,lib, extension)
|
||||||
cmd = 'install_name_tool -change %s/lib/%s %s/lib/%s %s' % \
|
cmd = 'install_name_tool -change %s/lib/%s %s/lib/%s %s' % \
|
||||||
(buildDir,lib, prefix,lib, extension)
|
(buildDir,lib, prefix,lib, extension)
|
||||||
print(cmd)
|
print(cmd)
|
||||||
os.system(cmd)
|
os.system(cmd)
|
||||||
os.chdir(pwd)
|
os.chdir(pwd)
|
||||||
|
|
||||||
|
|
||||||
@@ -741,7 +741,7 @@ def macSetLoaderNames(filenames):
|
|||||||
newName = '@loader_path/' + os.path.basename(curName)
|
newName = '@loader_path/' + os.path.basename(curName)
|
||||||
cmd = 'install_name_tool -change %s %s %s' % (curName, newName, filename)
|
cmd = 'install_name_tool -change %s %s %s' % (curName, newName, filename)
|
||||||
os.system(cmd)
|
os.system(cmd)
|
||||||
|
|
||||||
|
|
||||||
def getVcsRev():
|
def getVcsRev():
|
||||||
# Some helpers for the code below
|
# Some helpers for the code below
|
||||||
@@ -749,10 +749,10 @@ def getVcsRev():
|
|||||||
import datetime
|
import datetime
|
||||||
now = datetime.datetime.now()
|
now = datetime.datetime.now()
|
||||||
return "%d%02d%02d.%02d%02d" % (now.year, now.month, now.day, now.hour, now.minute)
|
return "%d%02d%02d.%02d%02d" % (now.year, now.month, now.day, now.hour, now.minute)
|
||||||
|
|
||||||
def _getSvnRevision():
|
def _getSvnRevision():
|
||||||
if not os.path.exists('.svn'):
|
if not os.path.exists('.svn'):
|
||||||
return None
|
return None
|
||||||
svnrev = None
|
svnrev = None
|
||||||
try:
|
try:
|
||||||
rev = runcmd('svnversion', getOutput=True, echoCmd=False)
|
rev = runcmd('svnversion', getOutput=True, echoCmd=False)
|
||||||
@@ -760,7 +760,7 @@ def getVcsRev():
|
|||||||
return None
|
return None
|
||||||
svnrev = rev.split(':')[0]
|
svnrev = rev.split(':')[0]
|
||||||
return svnrev
|
return svnrev
|
||||||
|
|
||||||
def _getGitRevision():
|
def _getGitRevision():
|
||||||
try:
|
try:
|
||||||
revcount = runcmd('git rev-list --count HEAD', getOutput=True, echoCmd=False)
|
revcount = runcmd('git rev-list --count HEAD', getOutput=True, echoCmd=False)
|
||||||
@@ -768,7 +768,7 @@ def getVcsRev():
|
|||||||
except:
|
except:
|
||||||
return None
|
return None
|
||||||
return "{}+{}".format(revcount, revhash)
|
return "{}+{}".format(revcount, revhash)
|
||||||
|
|
||||||
# Try getting the revision number from SVN, or GIT, or just fall back
|
# Try getting the revision number from SVN, or GIT, or just fall back
|
||||||
# to the date.
|
# to the date.
|
||||||
svnrev = _getSvnRevision()
|
svnrev = _getSvnRevision()
|
||||||
@@ -804,7 +804,7 @@ def runcmd(cmd, getOutput=False, echoCmd=True, fatal=True):
|
|||||||
if getOutput:
|
if getOutput:
|
||||||
otherKwArgs = dict(stdout=subprocess.PIPE,
|
otherKwArgs = dict(stdout=subprocess.PIPE,
|
||||||
stderr=subprocess.STDOUT)
|
stderr=subprocess.STDOUT)
|
||||||
|
|
||||||
sp = subprocess.Popen(cmd, shell=True, env=os.environ, **otherKwArgs)
|
sp = subprocess.Popen(cmd, shell=True, env=os.environ, **otherKwArgs)
|
||||||
|
|
||||||
output = None
|
output = None
|
||||||
@@ -814,7 +814,7 @@ def runcmd(cmd, getOutput=False, echoCmd=True, fatal=True):
|
|||||||
if sys.version_info > (3,):
|
if sys.version_info > (3,):
|
||||||
output = output.decode(outputEncoding)
|
output = output.decode(outputEncoding)
|
||||||
output = output.rstrip()
|
output = output.rstrip()
|
||||||
|
|
||||||
rval = sp.wait()
|
rval = sp.wait()
|
||||||
if rval:
|
if rval:
|
||||||
# Failed!
|
# Failed!
|
||||||
@@ -824,10 +824,10 @@ def runcmd(cmd, getOutput=False, echoCmd=True, fatal=True):
|
|||||||
print(output)
|
print(output)
|
||||||
if fatal:
|
if fatal:
|
||||||
sys.exit(rval)
|
sys.exit(rval)
|
||||||
|
|
||||||
return output
|
return output
|
||||||
|
|
||||||
|
|
||||||
def myExecfile(filename, ns):
|
def myExecfile(filename, ns):
|
||||||
if sys.version_info < (3,):
|
if sys.version_info < (3,):
|
||||||
execfile(filename, ns)
|
execfile(filename, ns)
|
||||||
@@ -835,7 +835,7 @@ def myExecfile(filename, ns):
|
|||||||
with open(filename, 'r') as f:
|
with open(filename, 'r') as f:
|
||||||
exec(f.read(), ns)
|
exec(f.read(), ns)
|
||||||
|
|
||||||
|
|
||||||
def textfile_open(filename, mode='rt'):
|
def textfile_open(filename, mode='rt'):
|
||||||
"""
|
"""
|
||||||
Simple wrapper around open() that will use codecs.open on Python2 and
|
Simple wrapper around open() that will use codecs.open on Python2 and
|
||||||
@@ -862,9 +862,9 @@ def getSipFiles(names):
|
|||||||
if os.path.exists(name):
|
if os.path.exists(name):
|
||||||
files.append(name)
|
files.append(name)
|
||||||
return files
|
return files
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
def getVisCVersion():
|
def getVisCVersion():
|
||||||
text = runcmd("cl.exe", getOutput=True, echoCmd=False)
|
text = runcmd("cl.exe", getOutput=True, echoCmd=False)
|
||||||
if 'Version 13' in text:
|
if 'Version 13' in text:
|
||||||
@@ -873,12 +873,14 @@ def getVisCVersion():
|
|||||||
return '90'
|
return '90'
|
||||||
if 'Version 16' in text:
|
if 'Version 16' in text:
|
||||||
return '100'
|
return '100'
|
||||||
|
if 'Version 18' in text:
|
||||||
|
return '120'
|
||||||
if 'Version 19' in text:
|
if 'Version 19' in text:
|
||||||
return '140'
|
return '140'
|
||||||
# TODO: Add more tests to get the other versions...
|
# TODO: Add more tests to get the other versions...
|
||||||
else:
|
else:
|
||||||
return 'FIXME'
|
return 'FIXME'
|
||||||
|
|
||||||
|
|
||||||
_haveObjDump = None
|
_haveObjDump = None
|
||||||
def canGetSOName():
|
def canGetSOName():
|
||||||
@@ -892,7 +894,7 @@ def getSOName(filename):
|
|||||||
output = runcmd('objdump -p %s' % filename, True)
|
output = runcmd('objdump -p %s' % filename, True)
|
||||||
result = re.search('^\s+SONAME\s+(.+)$', output, re.MULTILINE)
|
result = re.search('^\s+SONAME\s+(.+)$', output, re.MULTILINE)
|
||||||
if result:
|
if result:
|
||||||
return result.group(1)
|
return result.group(1)
|
||||||
return None
|
return None
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -46,7 +46,7 @@ class wx_extra_clean(distutils.command.clean.clean):
|
|||||||
from distutils.filelist import FileList
|
from distutils.filelist import FileList
|
||||||
|
|
||||||
distutils.command.clean.clean.run(self)
|
distutils.command.clean.clean.run(self)
|
||||||
|
|
||||||
cfg = Config()
|
cfg = Config()
|
||||||
if self.all:
|
if self.all:
|
||||||
fl = FileList()
|
fl = FileList()
|
||||||
@@ -136,8 +136,8 @@ class wx_install_headers(distutils.command.install_headers.install_headers):
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
#----------------------------------------------------------------------
|
#----------------------------------------------------------------------
|
||||||
# These functions and class are copied from distutils in Python 2.5
|
# These functions and class are copied from distutils in Python 2.5
|
||||||
# and then grafted back into the distutils modules so we can change
|
# and then grafted back into the distutils modules so we can change
|
||||||
@@ -157,7 +157,7 @@ def _darwin_compiler_fixup(compiler_so, cc_args):
|
|||||||
This is needed because '-arch ARCH' adds another architecture to the
|
This is needed because '-arch ARCH' adds another architecture to the
|
||||||
build, without a way to remove an architecture. Furthermore GCC will
|
build, without a way to remove an architecture. Furthermore GCC will
|
||||||
barf if multiple '-isysroot' arguments are present.
|
barf if multiple '-isysroot' arguments are present.
|
||||||
|
|
||||||
I've further modified our copy of this function to check if there
|
I've further modified our copy of this function to check if there
|
||||||
is a -isysroot flag in the CC/CXX values in the environment. If so then we
|
is a -isysroot flag in the CC/CXX values in the environment. If so then we
|
||||||
want to make sure that we keep that one and strip the others, instead of
|
want to make sure that we keep that one and strip the others, instead of
|
||||||
@@ -165,7 +165,7 @@ def _darwin_compiler_fixup(compiler_so, cc_args):
|
|||||||
"""
|
"""
|
||||||
ccHasSysroot = '-isysroot' in os.environ.get('CC', '') \
|
ccHasSysroot = '-isysroot' in os.environ.get('CC', '') \
|
||||||
or '-isysroot' in os.environ.get('CXX', '')
|
or '-isysroot' in os.environ.get('CXX', '')
|
||||||
|
|
||||||
stripArch = stripSysroot = 0
|
stripArch = stripSysroot = 0
|
||||||
|
|
||||||
compiler_so = list(compiler_so)
|
compiler_so = list(compiler_so)
|
||||||
@@ -201,7 +201,7 @@ def _darwin_compiler_fixup(compiler_so, cc_args):
|
|||||||
except ValueError:
|
except ValueError:
|
||||||
break
|
break
|
||||||
|
|
||||||
# Check if the SDK that is used during compilation actually exists,
|
# Check if the SDK that is used during compilation actually exists,
|
||||||
# the universal build requires the usage of a universal SDK and not all
|
# the universal build requires the usage of a universal SDK and not all
|
||||||
# users have that installed by default.
|
# users have that installed by default.
|
||||||
sysroot = None
|
sysroot = None
|
||||||
@@ -235,7 +235,7 @@ class MyUnixCCompiler(distutils.unixccompiler.UnixCCompiler):
|
|||||||
extra_postargs)
|
extra_postargs)
|
||||||
except DistutilsExecError as msg:
|
except DistutilsExecError as msg:
|
||||||
raise CompileError(msg)
|
raise CompileError(msg)
|
||||||
|
|
||||||
_orig_parse_makefile = distutils.sysconfig.parse_makefile
|
_orig_parse_makefile = distutils.sysconfig.parse_makefile
|
||||||
def _parse_makefile(filename, g=None):
|
def _parse_makefile(filename, g=None):
|
||||||
rv = _orig_parse_makefile(filename, g)
|
rv = _orig_parse_makefile(filename, g)
|
||||||
@@ -265,15 +265,15 @@ _orig_setup_compile = distutils.ccompiler.CCompiler._setup_compile
|
|||||||
def _setup_compile(self, outdir, macros, incdirs, sources, depends, extra):
|
def _setup_compile(self, outdir, macros, incdirs, sources, depends, extra):
|
||||||
macros, objects, extra, pp_opts, build = \
|
macros, objects, extra, pp_opts, build = \
|
||||||
_orig_setup_compile(self, outdir, macros, incdirs, sources, depends, extra)
|
_orig_setup_compile(self, outdir, macros, incdirs, sources, depends, extra)
|
||||||
|
|
||||||
# Remove items from the build collection that don't need to be built
|
# Remove items from the build collection that don't need to be built
|
||||||
# because their obj file is newer than the source fle and any other
|
# because their obj file is newer than the source fle and any other
|
||||||
# dependencies.
|
# dependencies.
|
||||||
for obj in objects:
|
for obj in objects:
|
||||||
src, ext = build[obj]
|
src, ext = build[obj]
|
||||||
if not newer_group([src] + depends, obj):
|
if not newer_group([src] + depends, obj):
|
||||||
del build[obj]
|
del build[obj]
|
||||||
return macros, objects, extra, pp_opts, build
|
return macros, objects, extra, pp_opts, build
|
||||||
|
|
||||||
distutils.ccompiler.CCompiler._setup_compile = _setup_compile
|
distutils.ccompiler.CCompiler._setup_compile = _setup_compile
|
||||||
|
|
||||||
@@ -327,7 +327,7 @@ if os.name == 'nt' and sys.version_info >= (2,6):
|
|||||||
|
|
||||||
|
|
||||||
#----------------------------------------------------------------------
|
#----------------------------------------------------------------------
|
||||||
|
|
||||||
|
|
||||||
from .sipdistutils import build_ext
|
from .sipdistutils import build_ext
|
||||||
|
|
||||||
@@ -339,20 +339,20 @@ class etgsip_build_ext(build_ext):
|
|||||||
def _find_sip(self):
|
def _find_sip(self):
|
||||||
cfg = Config()
|
cfg = Config()
|
||||||
return cfg.SIP
|
return cfg.SIP
|
||||||
|
|
||||||
def _sip_inc_dir(self):
|
def _sip_inc_dir(self):
|
||||||
cfg = Config()
|
cfg = Config()
|
||||||
return cfg.SIPINC
|
return cfg.SIPINC
|
||||||
|
|
||||||
def _sip_sipfiles_dir(self):
|
def _sip_sipfiles_dir(self):
|
||||||
cfg = Config()
|
cfg = Config()
|
||||||
return cfg.SIPFILES
|
return cfg.SIPFILES
|
||||||
|
|
||||||
def _sip_output_dir(self):
|
def _sip_output_dir(self):
|
||||||
cfg = Config()
|
cfg = Config()
|
||||||
return cfg.SIPOUT
|
return cfg.SIPOUT
|
||||||
|
|
||||||
|
|
||||||
def build_extension(self, extension):
|
def build_extension(self, extension):
|
||||||
"""
|
"""
|
||||||
Modify the dependency list, adding the sip files generated
|
Modify the dependency list, adding the sip files generated
|
||||||
@@ -367,7 +367,7 @@ class etgsip_build_ext(build_ext):
|
|||||||
# let the base class do the rest
|
# let the base class do the rest
|
||||||
return build_ext.build_extension(self, extension)
|
return build_ext.build_extension(self, extension)
|
||||||
|
|
||||||
|
|
||||||
def swig_sources (self, sources, extension):
|
def swig_sources (self, sources, extension):
|
||||||
"""
|
"""
|
||||||
Run our ETG scripts to generate their .sip files, and adjust
|
Run our ETG scripts to generate their .sip files, and adjust
|
||||||
@@ -379,13 +379,13 @@ class etgsip_build_ext(build_ext):
|
|||||||
return
|
return
|
||||||
|
|
||||||
cfg = Config()
|
cfg = Config()
|
||||||
|
|
||||||
etg_sources = [s for s in sources if s.startswith('etg/')]
|
etg_sources = [s for s in sources if s.startswith('etg/')]
|
||||||
other_sources = [s for s in sources if not s.startswith('etg/')]
|
other_sources = [s for s in sources if not s.startswith('etg/')]
|
||||||
|
|
||||||
for etg in etg_sources:
|
for etg in etg_sources:
|
||||||
sipfile = etg2sip(etg)
|
sipfile = etg2sip(etg)
|
||||||
|
|
||||||
deps = [etg]
|
deps = [etg]
|
||||||
ns = loadETG(etg)
|
ns = loadETG(etg)
|
||||||
if hasattr(ns, 'OTHERDEPS'):
|
if hasattr(ns, 'OTHERDEPS'):
|
||||||
@@ -398,14 +398,14 @@ class etgsip_build_ext(build_ext):
|
|||||||
|
|
||||||
if '%Module(' in file(sipfile).read():
|
if '%Module(' in file(sipfile).read():
|
||||||
other_sources.append(sipfile)
|
other_sources.append(sipfile)
|
||||||
|
|
||||||
# now call the base class version of this method
|
# now call the base class version of this method
|
||||||
return build_ext.swig_sources(self, other_sources, extension)
|
return build_ext.swig_sources(self, other_sources, extension)
|
||||||
|
|
||||||
|
|
||||||
def _sip_compile(self, sip_bin, source, sbf):
|
def _sip_compile(self, sip_bin, source, sbf):
|
||||||
cfg = Config()
|
cfg = Config()
|
||||||
|
|
||||||
other_opts = []
|
other_opts = []
|
||||||
base = os.path.basename(source)
|
base = os.path.basename(source)
|
||||||
if base.startswith('_'):
|
if base.startswith('_'):
|
||||||
@@ -413,9 +413,8 @@ class etgsip_build_ext(build_ext):
|
|||||||
pycode = posixjoin(cfg.PKGDIR, pycode)
|
pycode = posixjoin(cfg.PKGDIR, pycode)
|
||||||
other_opts = ['-X', 'pycode:'+pycode]
|
other_opts = ['-X', 'pycode:'+pycode]
|
||||||
self.spawn([sip_bin] + self.sip_opts +
|
self.spawn([sip_bin] + self.sip_opts +
|
||||||
other_opts +
|
other_opts +
|
||||||
["-c", self._sip_output_dir(),
|
["-c", self._sip_output_dir(),
|
||||||
"-b", sbf,
|
"-b", sbf,
|
||||||
"-I", self._sip_sipfiles_dir(),
|
"-I", self._sip_sipfiles_dir(),
|
||||||
source])
|
source])
|
||||||
|
|
||||||
|
|||||||
@@ -79,7 +79,7 @@ class build_ext (build_ext_base):
|
|||||||
|
|
||||||
def _sip_output_dir(self):
|
def _sip_output_dir(self):
|
||||||
return self.build_temp
|
return self.build_temp
|
||||||
|
|
||||||
def build_extension (self, ext):
|
def build_extension (self, ext):
|
||||||
oldforce = self.force
|
oldforce = self.force
|
||||||
|
|
||||||
@@ -148,4 +148,3 @@ class build_ext (build_ext_base):
|
|||||||
"-b", sbf,
|
"-b", sbf,
|
||||||
"-I", self._sip_sipfiles_dir(),
|
"-I", self._sip_sipfiles_dir(),
|
||||||
source])
|
source])
|
||||||
|
|
||||||
|
|||||||
@@ -18,11 +18,11 @@ VER_RELEASE = 3 # wxPython RELEASE number for the given wxWidgets
|
|||||||
|
|
||||||
VER_FLAGS = "" # wxPython release flags
|
VER_FLAGS = "" # wxPython release flags
|
||||||
|
|
||||||
# The VER_FLAGS value is appended to the version number constructed from first
|
# The VER_FLAGS value is appended to the version number constructed from the
|
||||||
# 3 components and should be set according to the following patterns. These
|
# first 3 components and should be set according to the following patterns.
|
||||||
# should help us to better follow the PEP-0440 notions of version numbers,
|
# These should help us to better follow the PEP-0440 notions of version
|
||||||
# where public version identifiers are supposed to conform to the following
|
# numbers, where public version identifiers are supposed to conform to the
|
||||||
# scheme:
|
# following scheme:
|
||||||
#
|
#
|
||||||
# [N!]N(.N)*[{a|b|rc}N][.postN][.devN]
|
# [N!]N(.N)*[{a|b|rc}N][.postN][.devN]
|
||||||
#
|
#
|
||||||
|
|||||||
72
setup.py
72
setup.py
@@ -23,7 +23,7 @@ try:
|
|||||||
except ImportError:
|
except ImportError:
|
||||||
haveWheel = False
|
haveWheel = False
|
||||||
|
|
||||||
from buildtools.config import Config, msg, opj, runcmd, canGetSOName, getSOName
|
from buildtools.config import Config, msg, opj, runcmd, canGetSOName, getSOName
|
||||||
|
|
||||||
|
|
||||||
#----------------------------------------------------------------------
|
#----------------------------------------------------------------------
|
||||||
@@ -85,30 +85,30 @@ class wx_build(orig_build):
|
|||||||
('skip-build', None, 'skip building the C/C++ code (assumes it has already been done)'),
|
('skip-build', None, 'skip building the C/C++ code (assumes it has already been done)'),
|
||||||
]
|
]
|
||||||
boolean_options = ['skip-build']
|
boolean_options = ['skip-build']
|
||||||
|
|
||||||
|
|
||||||
def initialize_options(self):
|
def initialize_options(self):
|
||||||
orig_build.initialize_options(self)
|
orig_build.initialize_options(self)
|
||||||
self.skip_build = '--skip-build' in sys.argv
|
self.skip_build = '--skip-build' in sys.argv
|
||||||
|
|
||||||
def finalize_options(self):
|
def finalize_options(self):
|
||||||
orig_build.finalize_options(self)
|
orig_build.finalize_options(self)
|
||||||
self.build_lib = self.build_platlib
|
self.build_lib = self.build_platlib
|
||||||
|
|
||||||
def run(self):
|
def run(self):
|
||||||
if not self.skip_build:
|
if not self.skip_build:
|
||||||
# Run build.py to do the actual building of the extension modules
|
# Run build.py to do the actual building of the extension modules
|
||||||
msg('WARNING: Building this way assumes that all generated files have been \n'
|
msg('WARNING: Building this way assumes that all generated files have been \n'
|
||||||
'generated already. If that is not the case then use build.py directly \n'
|
'generated already. If that is not the case then use build.py directly \n'
|
||||||
'to generate the source and perform the build stage. You can use \n'
|
'to generate the source and perform the build stage. You can use \n'
|
||||||
'--skip-build with the bdist_* or install commands to avoid this \n'
|
'--skip-build with the bdist_* or install commands to avoid this \n'
|
||||||
'message and the wxWidgets and Phoenix build steps in the future.\n')
|
'message and the wxWidgets and Phoenix build steps in the future.\n')
|
||||||
|
|
||||||
# Use the same Python that is running this script.
|
# Use the same Python that is running this script.
|
||||||
cmd = ['"{}"'.format(sys.executable), '-u', 'build.py', 'build']
|
cmd = ['"{}"'.format(sys.executable), '-u', 'build.py', 'build']
|
||||||
cmd = ' '.join(cmd)
|
cmd = ' '.join(cmd)
|
||||||
runcmd(cmd)
|
runcmd(cmd)
|
||||||
|
|
||||||
# Let distutils handle building up the package folder under the
|
# Let distutils handle building up the package folder under the
|
||||||
# build/lib folder like normal.
|
# build/lib folder like normal.
|
||||||
orig_build.run(self)
|
orig_build.run(self)
|
||||||
@@ -120,20 +120,20 @@ def _cleanup_symlinks(cmd):
|
|||||||
# The links are not really needed since the extensions link to the
|
# The links are not really needed since the extensions link to the
|
||||||
# specific soname, and they could bloat the egg too much if they were
|
# specific soname, and they could bloat the egg too much if they were
|
||||||
# left in.
|
# left in.
|
||||||
#
|
#
|
||||||
# TODO: can eggs have post-install scripts that would allow us to
|
# TODO: can eggs have post-install scripts that would allow us to
|
||||||
# restore the links? No.
|
# restore the links? No.
|
||||||
#
|
#
|
||||||
build_lib = cmd.get_finalized_command('build').build_lib
|
build_lib = cmd.get_finalized_command('build').build_lib
|
||||||
build_lib = opj(build_lib, 'wx')
|
build_lib = opj(build_lib, 'wx')
|
||||||
for libname in glob.glob(opj(build_lib, 'libwx*')):
|
for libname in glob.glob(opj(build_lib, 'libwx*')):
|
||||||
|
|
||||||
if os.path.islink(libname):
|
if os.path.islink(libname):
|
||||||
if isDarwin:
|
if isDarwin:
|
||||||
# On Mac the name used by the extension module is the real
|
# On Mac the name used by the extension module is the real
|
||||||
# file, so we can just get rid of all the links.
|
# file, so we can just get rid of all the links.
|
||||||
os.unlink(libname)
|
os.unlink(libname)
|
||||||
|
|
||||||
elif canGetSOName():
|
elif canGetSOName():
|
||||||
# On linux the soname used in the extension modules may
|
# On linux the soname used in the extension modules may
|
||||||
# be (probably is) one of the symlinks, so we have to be
|
# be (probably is) one of the symlinks, so we have to be
|
||||||
@@ -151,12 +151,12 @@ def _cleanup_symlinks(cmd):
|
|||||||
# Otherwise just leave the symlink there since we don't
|
# Otherwise just leave the symlink there since we don't
|
||||||
# know what to do with it.
|
# know what to do with it.
|
||||||
pass
|
pass
|
||||||
|
|
||||||
|
|
||||||
class wx_bdist_egg(orig_bdist_egg):
|
class wx_bdist_egg(orig_bdist_egg):
|
||||||
def finalize_options(self):
|
def finalize_options(self):
|
||||||
orig_bdist_egg.finalize_options(self)
|
orig_bdist_egg.finalize_options(self)
|
||||||
|
|
||||||
# Redo the calculation of the egg's filename since we always have
|
# Redo the calculation of the egg's filename since we always have
|
||||||
# extension modules, but they are not built by setuptools so it
|
# extension modules, but they are not built by setuptools so it
|
||||||
# doesn't know about them.
|
# doesn't know about them.
|
||||||
@@ -169,16 +169,16 @@ class wx_bdist_egg(orig_bdist_egg):
|
|||||||
).egg_name()
|
).egg_name()
|
||||||
self.egg_output = os.path.join(self.dist_dir, basename+'.egg')
|
self.egg_output = os.path.join(self.dist_dir, basename+'.egg')
|
||||||
|
|
||||||
|
|
||||||
def run(self):
|
def run(self):
|
||||||
# Ensure that there is a basic library build for bdist_egg to pull from.
|
# Ensure that there is a basic library build for bdist_egg to pull from.
|
||||||
self.run_command("build")
|
self.run_command("build")
|
||||||
|
|
||||||
_cleanup_symlinks(self)
|
_cleanup_symlinks(self)
|
||||||
|
|
||||||
# Run the default bdist_egg command
|
# Run the default bdist_egg command
|
||||||
orig_bdist_egg.run(self)
|
orig_bdist_egg.run(self)
|
||||||
|
|
||||||
|
|
||||||
if haveWheel:
|
if haveWheel:
|
||||||
class wx_bdist_wheel(orig_bdist_wheel):
|
class wx_bdist_wheel(orig_bdist_wheel):
|
||||||
@@ -191,25 +191,25 @@ if haveWheel:
|
|||||||
from setuptools.dist import Distribution
|
from setuptools.dist import Distribution
|
||||||
#Distribution.is_pure = _is_pure
|
#Distribution.is_pure = _is_pure
|
||||||
Distribution.has_ext_modules = _has_ext_modules
|
Distribution.has_ext_modules = _has_ext_modules
|
||||||
|
|
||||||
orig_bdist_wheel.finalize_options(self)
|
orig_bdist_wheel.finalize_options(self)
|
||||||
|
|
||||||
|
|
||||||
def run(self):
|
def run(self):
|
||||||
# Ensure that there is a basic library build for bdist_egg to pull from.
|
# Ensure that there is a basic library build for bdist_egg to pull from.
|
||||||
self.run_command("build")
|
self.run_command("build")
|
||||||
|
|
||||||
_cleanup_symlinks(self)
|
_cleanup_symlinks(self)
|
||||||
|
|
||||||
# Run the default bdist_wheel command
|
# Run the default bdist_wheel command
|
||||||
orig_bdist_wheel.run(self)
|
orig_bdist_wheel.run(self)
|
||||||
|
|
||||||
|
|
||||||
class wx_install(orig_install):
|
class wx_install(orig_install):
|
||||||
def finalize_options(self):
|
def finalize_options(self):
|
||||||
orig_install.finalize_options(self)
|
orig_install.finalize_options(self)
|
||||||
self.install_lib = self.install_platlib
|
self.install_lib = self.install_platlib
|
||||||
|
|
||||||
def run(self):
|
def run(self):
|
||||||
self.run_command("build")
|
self.run_command("build")
|
||||||
orig_install.run(self)
|
orig_install.run(self)
|
||||||
@@ -222,7 +222,7 @@ class wx_sdist(orig_sdist):
|
|||||||
cmd = ['"{}"'.format(sys.executable), '-u', 'build.py', 'sdist']
|
cmd = ['"{}"'.format(sys.executable), '-u', 'build.py', 'sdist']
|
||||||
cmd = ' '.join(cmd)
|
cmd = ' '.join(cmd)
|
||||||
runcmd(cmd)
|
runcmd(cmd)
|
||||||
|
|
||||||
# Put the filename in dist_files in case the upload command is used.
|
# Put the filename in dist_files in case the upload command is used.
|
||||||
# On the other hand, PyPI's upload size limit is waaaaaaaaay too
|
# On the other hand, PyPI's upload size limit is waaaaaaaaay too
|
||||||
# small so it probably doesn't matter too much...
|
# small so it probably doesn't matter too much...
|
||||||
@@ -230,7 +230,7 @@ class wx_sdist(orig_sdist):
|
|||||||
self.distribution.dist_files.append(('sdist', '', sdist_file))
|
self.distribution.dist_files.append(('sdist', '', sdist_file))
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
# Map these new classes to the appropriate distutils command names.
|
# Map these new classes to the appropriate distutils command names.
|
||||||
CMDCLASS = {
|
CMDCLASS = {
|
||||||
@@ -272,8 +272,8 @@ def wx_copy_file(src, dst, preserve_mode=1, preserve_times=1, update=0,
|
|||||||
import distutils.file_util
|
import distutils.file_util
|
||||||
orig_copy_file = distutils.file_util.copy_file
|
orig_copy_file = distutils.file_util.copy_file
|
||||||
distutils.file_util.copy_file = wx_copy_file
|
distutils.file_util.copy_file = wx_copy_file
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
def wx_copy_tree(src, dst, preserve_mode=1, preserve_times=1,
|
def wx_copy_tree(src, dst, preserve_mode=1, preserve_times=1,
|
||||||
preserve_symlinks=0, update=0, verbose=1, dry_run=0):
|
preserve_symlinks=0, update=0, verbose=1, dry_run=0):
|
||||||
@@ -294,18 +294,18 @@ cfg = Config(noWxConfig=True)
|
|||||||
WX_PKGLIST = [cfg.PKGDIR] + [cfg.PKGDIR + '.' + pkg for pkg in find_packages('wx')]
|
WX_PKGLIST = [cfg.PKGDIR] + [cfg.PKGDIR + '.' + pkg for pkg in find_packages('wx')]
|
||||||
|
|
||||||
ENTRY_POINTS = {
|
ENTRY_POINTS = {
|
||||||
'console_scripts' : [
|
'console_scripts' : [
|
||||||
"img2png = wx.tools.img2png:main",
|
"img2png = wx.tools.img2png:main",
|
||||||
"img2py = wx.tools.img2py:main",
|
"img2py = wx.tools.img2py:main",
|
||||||
"img2xpm = wx.tools.img2xpm:main",
|
"img2xpm = wx.tools.img2xpm:main",
|
||||||
"pywxrc = wx.tools.pywxrc:main",
|
"pywxrc = wx.tools.pywxrc:main",
|
||||||
# ],
|
# ],
|
||||||
# 'gui_scripts' : [
|
# 'gui_scripts' : [
|
||||||
"helpviewer = wx.tools.helpviewer:main",
|
"helpviewer = wx.tools.helpviewer:main",
|
||||||
"pycrust = wx.py.PyCrust:main",
|
"pycrust = wx.py.PyCrust:main",
|
||||||
"pyshell = wx.py.PyShell:main",
|
"pyshell = wx.py.PyShell:main",
|
||||||
"pyslices = wx.py.PySlices:main",
|
"pyslices = wx.py.PySlices:main",
|
||||||
"pyslicesshell = wx.py.PySlicesShell:main",
|
"pyslicesshell = wx.py.PySlicesShell:main",
|
||||||
],
|
],
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -317,12 +317,12 @@ BUILD_OPTIONS = { } #'build_base' : cfg.BUILD_BASE }
|
|||||||
#if cfg.WXPORT == 'msw':
|
#if cfg.WXPORT == 'msw':
|
||||||
# BUILD_OPTIONS[ 'compiler' ] = cfg.COMPILER
|
# BUILD_OPTIONS[ 'compiler' ] = cfg.COMPILER
|
||||||
|
|
||||||
|
|
||||||
#----------------------------------------------------------------------
|
#----------------------------------------------------------------------
|
||||||
|
|
||||||
|
|
||||||
if __name__ == '__main__':
|
if __name__ == '__main__':
|
||||||
setup(name = NAME,
|
setup(name = NAME,
|
||||||
version = cfg.VERSION,
|
version = cfg.VERSION,
|
||||||
description = DESCRIPTION,
|
description = DESCRIPTION,
|
||||||
long_description = LONG_DESCRIPTION,
|
long_description = LONG_DESCRIPTION,
|
||||||
@@ -338,7 +338,7 @@ if __name__ == '__main__':
|
|||||||
zip_safe = False,
|
zip_safe = False,
|
||||||
use_2to3 = False,
|
use_2to3 = False,
|
||||||
include_package_data = True,
|
include_package_data = True,
|
||||||
|
|
||||||
packages = WX_PKGLIST,
|
packages = WX_PKGLIST,
|
||||||
ext_package = cfg.PKGDIR,
|
ext_package = cfg.PKGDIR,
|
||||||
|
|
||||||
|
|||||||
78
wscript
78
wscript
@@ -34,7 +34,7 @@ def options(opt):
|
|||||||
opt.load('python')
|
opt.load('python')
|
||||||
|
|
||||||
opt.add_option('--debug', dest='debug', action='store_true', default=False,
|
opt.add_option('--debug', dest='debug', action='store_true', default=False,
|
||||||
help='Turn on debug compile options.')
|
help='Turn on debug compile options.')
|
||||||
opt.add_option('--python', dest='python', default='', action='store',
|
opt.add_option('--python', dest='python', default='', action='store',
|
||||||
help='Full path to the Python executable to use.')
|
help='Full path to the Python executable to use.')
|
||||||
opt.add_option('--wx_config', dest='wx_config', default='wx-config', action='store',
|
opt.add_option('--wx_config', dest='wx_config', default='wx-config', action='store',
|
||||||
@@ -64,8 +64,8 @@ def options(opt):
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
def configure(conf):
|
def configure(conf):
|
||||||
if isWindows:
|
if isWindows:
|
||||||
# For now simply choose the compiler version based on the Python
|
# For now simply choose the compiler version based on the Python
|
||||||
# version. We have a chicken-egg problem here. The compiler needs to
|
# version. We have a chicken-egg problem here. The compiler needs to
|
||||||
# be selected before the Python stuff can be configured, but we need
|
# be selected before the Python stuff can be configured, but we need
|
||||||
@@ -85,7 +85,7 @@ def configure(conf):
|
|||||||
if isWindows:
|
if isWindows:
|
||||||
# Search for the Python headers without doing some stuff that could
|
# Search for the Python headers without doing some stuff that could
|
||||||
# iccorectly fail on Windows. See my_check_python_headers below.
|
# iccorectly fail on Windows. See my_check_python_headers below.
|
||||||
conf.my_check_python_headers()
|
conf.my_check_python_headers()
|
||||||
else:
|
else:
|
||||||
conf.check_python_headers()
|
conf.check_python_headers()
|
||||||
|
|
||||||
@@ -165,7 +165,7 @@ def configure(conf):
|
|||||||
lst[1:1] = ['/Z7']
|
lst[1:1] = ['/Z7']
|
||||||
conf.env['LINKFLAGS_PYEXT'].append('/DEBUG')
|
conf.env['LINKFLAGS_PYEXT'].append('/DEBUG')
|
||||||
|
|
||||||
else:
|
else:
|
||||||
# Configuration stuff for non-Windows ports using wx-config
|
# Configuration stuff for non-Windows ports using wx-config
|
||||||
conf.env.CFLAGS_WX = list()
|
conf.env.CFLAGS_WX = list()
|
||||||
conf.env.CXXFLAGS_WX = list()
|
conf.env.CXXFLAGS_WX = list()
|
||||||
@@ -178,49 +178,49 @@ def configure(conf):
|
|||||||
|
|
||||||
# Check wx-config exists and fetch some values from it
|
# Check wx-config exists and fetch some values from it
|
||||||
rpath = ' --no-rpath' if not conf.options.no_magic else ''
|
rpath = ' --no-rpath' if not conf.options.no_magic else ''
|
||||||
conf.check_cfg(path=conf.options.wx_config, package='',
|
conf.check_cfg(path=conf.options.wx_config, package='',
|
||||||
args='--cxxflags --libs core,net' + rpath,
|
args='--cxxflags --libs core,net' + rpath,
|
||||||
uselib_store='WX', mandatory=True)
|
uselib_store='WX', mandatory=True)
|
||||||
|
|
||||||
# Run it again with different libs options to get different
|
# Run it again with different libs options to get different
|
||||||
# sets of flags stored to use with varous extension modules below.
|
# sets of flags stored to use with varous extension modules below.
|
||||||
conf.check_cfg(path=conf.options.wx_config, package='',
|
conf.check_cfg(path=conf.options.wx_config, package='',
|
||||||
args='--cxxflags --libs adv,core,net' + rpath,
|
args='--cxxflags --libs adv,core,net' + rpath,
|
||||||
uselib_store='WXADV', mandatory=True)
|
uselib_store='WXADV', mandatory=True)
|
||||||
|
|
||||||
libname = '' if cfg.MONOLITHIC else 'stc,' # workaround bug in wx-config
|
libname = '' if cfg.MONOLITHIC else 'stc,' # workaround bug in wx-config
|
||||||
conf.check_cfg(path=conf.options.wx_config, package='',
|
conf.check_cfg(path=conf.options.wx_config, package='',
|
||||||
args=('--cxxflags --libs %score,net' % libname) + rpath,
|
args=('--cxxflags --libs %score,net' % libname) + rpath,
|
||||||
uselib_store='WXSTC', mandatory=True)
|
uselib_store='WXSTC', mandatory=True)
|
||||||
|
|
||||||
conf.check_cfg(path=conf.options.wx_config, package='',
|
conf.check_cfg(path=conf.options.wx_config, package='',
|
||||||
args='--cxxflags --libs html,core,net' + rpath,
|
args='--cxxflags --libs html,core,net' + rpath,
|
||||||
uselib_store='WXHTML', mandatory=True)
|
uselib_store='WXHTML', mandatory=True)
|
||||||
|
|
||||||
conf.check_cfg(path=conf.options.wx_config, package='',
|
conf.check_cfg(path=conf.options.wx_config, package='',
|
||||||
args='--cxxflags --libs gl,core,net' + rpath,
|
args='--cxxflags --libs gl,core,net' + rpath,
|
||||||
uselib_store='WXGL', mandatory=True)
|
uselib_store='WXGL', mandatory=True)
|
||||||
|
|
||||||
conf.check_cfg(path=conf.options.wx_config, package='',
|
conf.check_cfg(path=conf.options.wx_config, package='',
|
||||||
args='--cxxflags --libs webview,core,net' + rpath,
|
args='--cxxflags --libs webview,core,net' + rpath,
|
||||||
uselib_store='WXWEBVIEW', mandatory=True)
|
uselib_store='WXWEBVIEW', mandatory=True)
|
||||||
|
|
||||||
if isDarwin:
|
if isDarwin:
|
||||||
conf.check_cfg(path=conf.options.wx_config, package='',
|
conf.check_cfg(path=conf.options.wx_config, package='',
|
||||||
args='--cxxflags --libs core,net' + rpath,
|
args='--cxxflags --libs core,net' + rpath,
|
||||||
uselib_store='WXWEBKIT', mandatory=True)
|
uselib_store='WXWEBKIT', mandatory=True)
|
||||||
|
|
||||||
conf.check_cfg(path=conf.options.wx_config, package='',
|
conf.check_cfg(path=conf.options.wx_config, package='',
|
||||||
args='--cxxflags --libs xml,core,net' + rpath,
|
args='--cxxflags --libs xml,core,net' + rpath,
|
||||||
uselib_store='WXXML', mandatory=True)
|
uselib_store='WXXML', mandatory=True)
|
||||||
|
|
||||||
conf.check_cfg(path=conf.options.wx_config, package='',
|
conf.check_cfg(path=conf.options.wx_config, package='',
|
||||||
args='--cxxflags --libs xrc,xml,core,net' + rpath,
|
args='--cxxflags --libs xrc,xml,core,net' + rpath,
|
||||||
uselib_store='WXXRC', mandatory=True)
|
uselib_store='WXXRC', mandatory=True)
|
||||||
|
|
||||||
libname = '' if cfg.MONOLITHIC else 'richtext,' # workaround bug in wx-config
|
libname = '' if cfg.MONOLITHIC else 'richtext,' # workaround bug in wx-config
|
||||||
conf.check_cfg(path=conf.options.wx_config, package='',
|
conf.check_cfg(path=conf.options.wx_config, package='',
|
||||||
args='--cxxflags --libs %score,net' % libname + rpath,
|
args='--cxxflags --libs %score,net' % libname + rpath,
|
||||||
uselib_store='WXRICHTEXT', mandatory=True)
|
uselib_store='WXRICHTEXT', mandatory=True)
|
||||||
|
|
||||||
conf.check_cfg(path=conf.options.wx_config, package='',
|
conf.check_cfg(path=conf.options.wx_config, package='',
|
||||||
@@ -283,10 +283,10 @@ def configure(conf):
|
|||||||
|
|
||||||
# Some Mac-specific stuff
|
# Some Mac-specific stuff
|
||||||
if isDarwin:
|
if isDarwin:
|
||||||
conf.env.MACOSX_DEPLOYMENT_TARGET = "10.5"
|
conf.env.MACOSX_DEPLOYMENT_TARGET = "10.5"
|
||||||
|
|
||||||
if conf.options.mac_arch:
|
if conf.options.mac_arch:
|
||||||
conf.env.ARCH_WXPY = conf.options.mac_arch.split(',')
|
conf.env.ARCH_WXPY = conf.options.mac_arch.split(',')
|
||||||
|
|
||||||
#import pprint
|
#import pprint
|
||||||
#pprint.pprint( [(k, conf.env[k]) for k in conf.env.keys()] )
|
#pprint.pprint( [(k, conf.env[k]) for k in conf.env.keys()] )
|
||||||
@@ -356,35 +356,35 @@ def my_check_python_headers(conf):
|
|||||||
conf.env.append_value('LIB_PYEMBED', [libname])
|
conf.env.append_value('LIB_PYEMBED', [libname])
|
||||||
conf.env['LIBPATH_PYEXT'] = conf.env['LIBPATH_PYEMBED']
|
conf.env['LIBPATH_PYEXT'] = conf.env['LIBPATH_PYEMBED']
|
||||||
conf.env['LIB_PYEXT'] = conf.env['LIB_PYEMBED']
|
conf.env['LIB_PYEXT'] = conf.env['LIB_PYEMBED']
|
||||||
|
|
||||||
else:
|
else:
|
||||||
result = None
|
result = None
|
||||||
for name in ('python' + env['PYTHON_VERSION'], 'python' + env['PYTHON_VERSION'].replace('.', '')):
|
for name in ('python' + env['PYTHON_VERSION'], 'python' + env['PYTHON_VERSION'].replace('.', '')):
|
||||||
|
|
||||||
# LIBPATH_PYEMBED is already set; see if it works.
|
# LIBPATH_PYEMBED is already set; see if it works.
|
||||||
if not result and env['LIBPATH_PYEMBED']:
|
if not result and env['LIBPATH_PYEMBED']:
|
||||||
path = env['LIBPATH_PYEMBED']
|
path = env['LIBPATH_PYEMBED']
|
||||||
conf.to_log("\n\n# Trying default LIBPATH_PYEMBED: %r\n" % path)
|
conf.to_log("\n\n# Trying default LIBPATH_PYEMBED: %r\n" % path)
|
||||||
result = conf.check(lib=name, uselib='PYEMBED', libpath=path, mandatory=False, msg='Checking for library %s in LIBPATH_PYEMBED' % name)
|
result = conf.check(lib=name, uselib='PYEMBED', libpath=path, mandatory=False, msg='Checking for library %s in LIBPATH_PYEMBED' % name)
|
||||||
|
|
||||||
if not result and dct['LIBDIR']:
|
if not result and dct['LIBDIR']:
|
||||||
path = [dct['LIBDIR']]
|
path = [dct['LIBDIR']]
|
||||||
conf.to_log("\n\n# try again with -L$python_LIBDIR: %r\n" % path)
|
conf.to_log("\n\n# try again with -L$python_LIBDIR: %r\n" % path)
|
||||||
result = conf.check(lib=name, uselib='PYEMBED', libpath=path, mandatory=False, msg='Checking for library %s in LIBDIR' % name)
|
result = conf.check(lib=name, uselib='PYEMBED', libpath=path, mandatory=False, msg='Checking for library %s in LIBDIR' % name)
|
||||||
|
|
||||||
if not result and dct['LIBPL']:
|
if not result and dct['LIBPL']:
|
||||||
path = [dct['LIBPL']]
|
path = [dct['LIBPL']]
|
||||||
conf.to_log("\n\n# try again with -L$python_LIBPL (some systems don't install the python library in $prefix/lib)\n")
|
conf.to_log("\n\n# try again with -L$python_LIBPL (some systems don't install the python library in $prefix/lib)\n")
|
||||||
result = conf.check(lib=name, uselib='PYEMBED', libpath=path, mandatory=False, msg='Checking for library %s in python_LIBPL' % name)
|
result = conf.check(lib=name, uselib='PYEMBED', libpath=path, mandatory=False, msg='Checking for library %s in python_LIBPL' % name)
|
||||||
|
|
||||||
if not result:
|
if not result:
|
||||||
path = [os.path.join(dct['prefix'], "libs")]
|
path = [os.path.join(dct['prefix'], "libs")]
|
||||||
conf.to_log("\n\n# try again with -L$prefix/libs, and pythonXY name rather than pythonX.Y (win32)\n")
|
conf.to_log("\n\n# try again with -L$prefix/libs, and pythonXY name rather than pythonX.Y (win32)\n")
|
||||||
result = conf.check(lib=name, uselib='PYEMBED', libpath=path, mandatory=False, msg='Checking for library %s in $prefix/libs' % name)
|
result = conf.check(lib=name, uselib='PYEMBED', libpath=path, mandatory=False, msg='Checking for library %s in $prefix/libs' % name)
|
||||||
|
|
||||||
if result:
|
if result:
|
||||||
break # do not forget to set LIBPATH_PYEMBED
|
break # do not forget to set LIBPATH_PYEMBED
|
||||||
|
|
||||||
if result:
|
if result:
|
||||||
env['LIBPATH_PYEMBED'] = path
|
env['LIBPATH_PYEMBED'] = path
|
||||||
env.append_value('LIB_PYEMBED', [name])
|
env.append_value('LIB_PYEMBED', [name])
|
||||||
@@ -484,7 +484,7 @@ def build(bld):
|
|||||||
"# This file was generated by Phoenix's wscript.\n\n"
|
"# This file was generated by Phoenix's wscript.\n\n"
|
||||||
"VERSION_STRING = '%(VERSION)s'\n"
|
"VERSION_STRING = '%(VERSION)s'\n"
|
||||||
% cfg.__dict__)
|
% cfg.__dict__)
|
||||||
|
|
||||||
|
|
||||||
# copy the wx locale message catalogs to the package dir
|
# copy the wx locale message catalogs to the package dir
|
||||||
if isWindows or isDarwin:
|
if isWindows or isDarwin:
|
||||||
@@ -509,7 +509,7 @@ def build(bld):
|
|||||||
'sip/siplib/voidptr.c',
|
'sip/siplib/voidptr.c',
|
||||||
],
|
],
|
||||||
uselib = 'WX WXPY',
|
uselib = 'WX WXPY',
|
||||||
)
|
)
|
||||||
makeExtCopyRule(bld, 'siplib')
|
makeExtCopyRule(bld, 'siplib')
|
||||||
|
|
||||||
# Add build rules for each of our ETG generated extension modules
|
# Add build rules for each of our ETG generated extension modules
|
||||||
@@ -569,11 +569,11 @@ def makeExtCopyRule(bld, name):
|
|||||||
|
|
||||||
|
|
||||||
# This is the task function to be called by the above rule.
|
# This is the task function to be called by the above rule.
|
||||||
def copyFileToPkg(task):
|
def copyFileToPkg(task):
|
||||||
from distutils.file_util import copy_file
|
from distutils.file_util import copy_file
|
||||||
from buildtools.config import opj
|
from buildtools.config import opj
|
||||||
src = task.inputs[0].abspath()
|
src = task.inputs[0].abspath()
|
||||||
tgt = task.outputs[0].abspath()
|
tgt = task.outputs[0].abspath()
|
||||||
open(tgt, "wb").close() # essentially just a unix 'touch' command
|
open(tgt, "wb").close() # essentially just a unix 'touch' command
|
||||||
tgt = opj(cfg.PKGDIR, os.path.basename(src))
|
tgt = opj(cfg.PKGDIR, os.path.basename(src))
|
||||||
copy_file(src, tgt, verbose=1)
|
copy_file(src, tgt, verbose=1)
|
||||||
|
|||||||
Reference in New Issue
Block a user