summaryrefslogtreecommitdiffstats
path: root/build.py
diff options
context:
space:
mode:
Diffstat (limited to 'build.py')
-rw-r--r--build.py146
1 files changed, 73 insertions, 73 deletions
diff --git a/build.py b/build.py
index 8fb16b5..fa63bfc 100644
--- a/build.py
+++ b/build.py
@@ -33,15 +33,15 @@ import compileall
import string
-# Get the SIP configuration.
+# Get the SIP-TQt configuration.
try:
- from sip4_tqt import sipconfig
+ import sip_tqt_config
except:
- print "Unable to import the sipconfig module. Please make sure you have"
- print "SIP v3.9 or later installed."
+ print "Unable to import the sip_tqt_config module. Please make sure you have"
+ print "SIP-TQt v3.9 or later installed."
sys.exit(1)
-config = sipconfig.SIPConfig("PyTQt 3.18.1")
+config = sip_tqt_config.SIPConfig("PyTQt 3.18.1")
# Initialise the globals.
@@ -68,14 +68,14 @@ def usage(rcode = 2):
rcode is the return code passed back to the calling process.
"""
print "Usage:"
- print " %s [-h] [-a version] [-b dir] [-c] [-d dir] [-g] [-j #] [-n dir] [-o dir] [-r] [-v dir]" % sipconfig.script()
+ print " %s [-h] [-a version] [-b dir] [-c] [-d dir] [-g] [-j #] [-n dir] [-o dir] [-r] [-v dir]" % sip_tqt_config.script()
print "where:"
print " -h display this help message"
print " -a tag explicitly enable the qtpe module"
print " -b dir where pyuic and pylupdate will be installed [default %s]" % config.default_bin_dir
print " -c concatenate each module's C++ source files"
print " -d dir where the PyTQt modules will be installed [default %s]" % config.default_mod_dir
- print " -g always release the GIL (SIP v3.x behaviour)"
+ print " -g always release the GIL (SIP-TQt v3.x behaviour)"
print " -j # split the concatenated C++ source files into # pieces [default 1]"
print " -n dir the directory containing the TQScintilla header files [default %s]" % config.qt_inc_dir
print " -o dir the directory containing the TQScintilla library [default %s]" % config.qt_lib_dir
@@ -103,11 +103,11 @@ def mkTempBuildDir(olddir=None):
try:
os.mkdir(tempBuildDir)
except:
- sipconfig.error("Unable to create temporary directory.")
+ sip_tqt_config.error("Unable to create temporary directory.")
- prevdir = sipconfig.push_dir(tempBuildDir)
+ prevdir = sip_tqt_config.push_dir(tempBuildDir)
- sipconfig.copy_to_file("qttest.pro.in",
+ sip_tqt_config.copy_to_file("qttest.pro.in",
"""TEMPLATE = app
TARGET = qttest
CONFIG += console warn_off @TEST_OPENGL@ @BLX_CONFIG_APP@
@@ -124,11 +124,11 @@ LIBS += @TEST_QUI_LIB@ @TEST_QSCINTILLA_LIB@
config.patches["@TEST_QSCINTILLA_LIB@"] = ""
# Create a dummy source file to suppress a qmake warning.
- sipconfig.copy_to_file("qttest.cpp", "")
+ sip_tqt_config.copy_to_file("qttest.cpp", "")
config.create_makefile("qttest.pro")
else:
- sipconfig.pop_dir(olddir)
+ sip_tqt_config.pop_dir(olddir)
prevdir = None
shutil.rmtree(tempBuildDir, 1)
@@ -152,7 +152,7 @@ def tryModule(maindir, mname, incfile, ctor):
if not os.access(msip, os.F_OK):
return
- sipconfig.copy_to_file("qttest.cpp",
+ sip_tqt_config.copy_to_file("qttest.cpp",
"""#include <%s>
int main(int argc,char **argv)
@@ -161,13 +161,13 @@ int main(int argc,char **argv)
}
""" % (incfile, ctor))
- if sipconfig.run_make(None,0) == 0:
+ if sip_tqt_config.run_make(None,0) == 0:
buildModules.append(mname)
- sipconfig.inform("The %s module will be built." % mname)
+ sip_tqt_config.inform("The %s module will be built." % mname)
else:
- sipconfig.inform("The %s module will not be built." % mname)
+ sip_tqt_config.inform("The %s module will not be built." % mname)
- sipconfig.run_make("clean")
+ sip_tqt_config.run_make("clean")
def checkTQScintilla():
@@ -179,14 +179,14 @@ def checkTQScintilla():
if os.access(sciglobal,os.F_OK):
config.patches["@PYQT_QSCINTILLA_INC@"] = sciIncDir
- sipconfig.inform("%s contains tqextscintillaglobal.h." % (sciIncDir))
+ sip_tqt_config.inform("%s contains tqextscintillaglobal.h." % (sciIncDir))
# Get the TQScintilla version number.
global sciVersion
- sciVersion, sciversstr = sipconfig.read_version(sciglobal, "TQScintilla", "TQSCINTILLA_VERSION", "TQSCINTILLA_VERSION_STR")
+ sciVersion, sciversstr = sip_tqt_config.read_version(sciglobal, "TQScintilla", "TQSCINTILLA_VERSION", "TQSCINTILLA_VERSION_STR")
- sipconfig.inform("TQScintilla %s is being used." % (sciversstr))
+ sip_tqt_config.inform("TQScintilla %s is being used." % (sciversstr))
# If we find a snapshot then set the version number to 0 as a special
# case.
@@ -200,22 +200,22 @@ def checkTQScintilla():
lpatt = "libtqscintilla.*"
if len(glob.glob(os.path.join(sciLibDir, lpatt))):
- sipconfig.inform("%s contains the TQScintilla library." % sciLibDir)
+ sip_tqt_config.inform("%s contains the TQScintilla library." % sciLibDir)
global sciLib
if sys.platform == "win32":
- sciLib = sipconfig.escape(os.path.join(sciLibDir, "tqscintilla.lib"))
+ sciLib = sip_tqt_config.escape(os.path.join(sciLibDir, "tqscintilla.lib"))
else:
- sciLib = sipconfig.escape("-L" + sciLibDir) + " -ltqscintilla"
+ sciLib = sip_tqt_config.escape("-L" + sciLibDir) + " -ltqscintilla"
config.patches["@PYQT_QSCINTILLA_LIB@"] = sciLib
else:
- sipconfig.inform("The TQScintilla library could not be found in %s and so the qtext module will not be built. If TQScintilla is installed then use the -o argument to explicitly specify the correct directory." % (sciLibDir))
+ sip_tqt_config.inform("The TQScintilla library could not be found in %s and so the qtext module will not be built. If TQScintilla is installed then use the -o argument to explicitly specify the correct directory." % (sciLibDir))
sciVersion = -1
else:
- sipconfig.inform("tqextscintillaglobal.h could not be found in %s and so the qtext module will not be built. If TQScintilla is installed then use the -n argument to explicitly specify the correct directory." % sciIncDir)
+ sip_tqt_config.inform("tqextscintillaglobal.h could not be found in %s and so the qtext module will not be built. If TQScintilla is installed then use the -n argument to explicitly specify the correct directory." % sciIncDir)
sciVersion = -1
@@ -223,7 +223,7 @@ def checkTQScintilla():
def moduleChecks(maindir):
"""See which PyTQt modules to build.
"""
- sipconfig.inform("Checking which additional PyTQt modules to build.");
+ sip_tqt_config.inform("Checking which additional PyTQt modules to build.");
tryModule(maindir,"qtcanvas", "qcanvas.h", "TQCanvas()")
tryModule(maindir,"qtnetwork", "qsocket.h", "TQSocket()")
@@ -283,10 +283,10 @@ def generateFeatures(featfile):
featfile is the name of the features file.
"""
if os.access(featfile,os.F_OK):
- sipconfig.inform("Using existing features file.")
+ sip_tqt_config.inform("Using existing features file.")
return
- sipconfig.inform("Generating the features file.")
+ sip_tqt_config.inform("Generating the features file.")
# The features that a given TQt configuration may or may not support. Note
# that STYLE_WINDOWSXP requires special handling.
@@ -351,22 +351,22 @@ int main(int argc,char **argv)
f.close()
- sipconfig.run_make()
- sipconfig.run_program(os.path.join(os.getcwd(), "qttest"))
- sipconfig.run_make("clean")
+ sip_tqt_config.run_make()
+ sip_tqt_config.run_program(os.path.join(os.getcwd(), "qttest"))
+ sip_tqt_config.run_make("clean")
- sipconfig.inform("Generated the features file.")
+ sip_tqt_config.inform("Generated the features file.")
def generateSource(mname, plattag, qttag, xtrtag):
"""Generate the C++ source code for a particular PyTQt module.
mname is the name of the module.
- plattag is the SIP tag for the platform.
- qttag is the SIP tag for the TQt version.
- xtrtag is an optional extra SIP tag.
+ plattag is the SIP-TQt tag for the platform.
+ qttag is the SIP-TQt tag for the TQt version.
+ xtrtag is an optional extra SIP-TQt tag.
"""
- sipconfig.inform("Generating the C++ source for the %s module." % mname)
+ sip_tqt_config.inform("Generating the C++ source for the %s module." % mname)
try:
shutil.rmtree(mname)
@@ -376,7 +376,7 @@ def generateSource(mname, plattag, qttag, xtrtag):
try:
os.mkdir(mname)
except:
- sipconfig.error("Unable to create the %s directory." % mname)
+ sip_tqt_config.error("Unable to create the %s directory." % mname)
pro = mname + ".pro"
@@ -398,15 +398,15 @@ def generateSource(mname, plattag, qttag, xtrtag):
if releaseGIL:
argv.insert(0,"-g")
- sipconfig.run_program(config.sip_bin, argv)
+ sip_tqt_config.run_program(config.sip_bin, argv)
# Generate the Makefile.
- sipconfig.inform("Generating the Makefile for the %s module." % mname)
+ sip_tqt_config.inform("Generating the Makefile for the %s module." % mname)
- olddir = sipconfig.push_dir(mname)
+ olddir = sip_tqt_config.push_dir(mname)
if catCppFiles:
- sipconfig.cat_source_files(mname, catSplit)
+ sip_tqt_config.cat_source_files(mname, catSplit)
config.create_makefile(pro, mname)
@@ -422,10 +422,10 @@ def generateSource(mname, plattag, qttag, xtrtag):
# Compile the Python part of the module.
pyname = mname + ".py"
- sipconfig.inform("Compiling %s." % (pyname))
+ sip_tqt_config.inform("Compiling %s." % (pyname))
py_compile.compile(pyname)
- sipconfig.pop_dir(olddir)
+ sip_tqt_config.pop_dir(olddir)
def versionToTag(vers, tags, desc):
@@ -452,7 +452,7 @@ def versionToTag(vers, tags, desc):
break
if tag is None:
- sipconfig.error("Invalid %s version: 0x%06x." % (desc, vers))
+ sip_tqt_config.error("Invalid %s version: 0x%06x." % (desc, vers))
return tag
@@ -512,31 +512,31 @@ def main(argv):
sipDir = arg
# Confirm the license.
- sipconfig.confirm_license()
+ sip_tqt_config.confirm_license()
# If there should be a license file then check it is where it should be.
if config.license_file:
if os.access(os.path.join("sip", config.license_file), os.F_OK):
- sipconfig.inform("Found the license file %s.\n" % config.license_file)
+ sip_tqt_config.inform("Found the license file %s.\n" % config.license_file)
else:
- sipconfig.error("Please copy the license file %s to the sip directory.\n" % config.license_file)
+ sip_tqt_config.error("Please copy the license file %s to the sip directory.\n" % config.license_file)
# Check the TQt version.
if config.qt_version == 0:
- sipconfig.error("SIP has been built with TQt support disabled.\n")
+ sip_tqt_config.error("SIP-TQt has been built with TQt support disabled.\n")
# Early versions of TQt for the Mac didn't include everything. Rather than
# maintain these in the future we just mandate a later version.
if sys.platform == "darwin" and config.qt_version < 0x030100:
- sipconfig.error("PyTQt for MacOS/X requires TQt v3.1.0 or later.\n")
+ sip_tqt_config.error("PyTQt for MacOS/X requires TQt v3.1.0 or later.\n")
# Check the installation directory is valid and add it as a patch.
if not os.access(modDir,os.F_OK):
- sipconfig.error("The %s PyTQt destination directory does not seem to exist. Use the -d argument to set the correct directory." % (modDir))
+ sip_tqt_config.error("The %s PyTQt destination directory does not seem to exist. Use the -d argument to set the correct directory." % (modDir))
- config.patches["@PYQT_MODDIR@"] = sipconfig.escape(modDir)
+ config.patches["@PYQT_MODDIR@"] = sip_tqt_config.escape(modDir)
- sipconfig.inform("%s is the PyTQt installation directory." % (modDir))
+ sip_tqt_config.inform("%s is the PyTQt installation directory." % (modDir))
# Enable warnings for SIP v4 generated code.
if sipMajorVersion >= 4:
@@ -550,18 +550,18 @@ def main(argv):
if sipMajorVersion >= 4:
modlink = ""
elif sys.platform == "win32":
- modlink = sipconfig.escape(os.path.join(modDir, "libtqtc.lib"))
+ modlink = sip_tqt_config.escape(os.path.join(modDir, "libtqtc.lib"))
else:
- modlink = sipconfig.escape("-L" + modDir) + " -lqtcmodule"
+ modlink = sip_tqt_config.escape("-L" + modDir) + " -lqtcmodule"
config.patches["@PYQT_QT_MODULE@"] = modlink
if sipMajorVersion >= 4:
modlink = ""
elif sys.platform == "win32":
- modlink = sipconfig.escape(os.path.join(modDir, "libtqttablec.lib")) + " " + sipconfig.escape(os.path.join(modDir, "libtqtc.lib"))
+ modlink = sip_tqt_config.escape(os.path.join(modDir, "libtqttablec.lib")) + " " + sip_tqt_config.escape(os.path.join(modDir, "libtqtc.lib"))
else:
- modlink = sipconfig.escape("-L" + modDir) + " -lqttablecmodule -lqtcmodule"
+ modlink = sip_tqt_config.escape("-L" + modDir) + " -lqttablecmodule -lqtcmodule"
config.patches["@PYQT_QTTABLE_MODULE@"] = modlink
@@ -595,7 +595,7 @@ def main(argv):
if config.qt_version >= 0x020000:
moduleChecks(maindir)
- # Work out the platform and TQt version tags to pass to SIP to generate the
+ # Work out the platform and TQt version tags to pass to SIP-TQt to generate the
# code we need.
if config.qt_lib == "qte":
plattag = "WS_QWS"
@@ -664,9 +664,9 @@ def main(argv):
subdirs.append("qtpe")
# Install the .sip files.
- sipconfig.inform("Creating Makefile for .sip files.")
- olddir = sipconfig.push_dir("sip")
- sipconfig.copy_to_file("Makefile", "all:\n")
+ sip_tqt_config.inform("Creating Makefile for .sip files.")
+ olddir = sip_tqt_config.push_dir("sip")
+ sip_tqt_config.copy_to_file("Makefile", "all:\n")
icmds = []
@@ -679,42 +679,42 @@ def main(argv):
icmds.append(("copy", os.path.join(mname, sf), os.path.join(dstdir, sf)))
config.add_install_target(icmds)
- sipconfig.pop_dir(olddir)
+ sip_tqt_config.pop_dir(olddir)
subdirs.append("sip")
# See which version of pyuic to build.
- config.patches["@PYQT_BINDIR@"] = sipconfig.escape(binDir)
+ config.patches["@PYQT_BINDIR@"] = sip_tqt_config.escape(binDir)
if config.qt_version >= 0x030000:
- sipconfig.inform("Creating Makefile for pyuic3.")
+ sip_tqt_config.inform("Creating Makefile for pyuic3.")
subdirs.append("pyuic3")
- olddir = sipconfig.push_dir("pyuic3")
+ olddir = sip_tqt_config.push_dir("pyuic3")
elif config.qt_version >= 0x020000:
- sipconfig.inform("Creating Makefile for pyuic2.")
+ sip_tqt_config.inform("Creating Makefile for pyuic2.")
subdirs.append("pyuic2")
- olddir = sipconfig.push_dir("pyuic2")
+ olddir = sip_tqt_config.push_dir("pyuic2")
config.create_makefile("pyuic.pro", [])
- sipconfig.pop_dir(olddir)
+ sip_tqt_config.pop_dir(olddir)
# Build pylupdate if TQt v3.0 or later.
if config.qt_version >= 0x030000:
- sipconfig.inform("Creating Makefile for pylupdate3.")
+ sip_tqt_config.inform("Creating Makefile for pylupdate3.")
subdirs.append("pylupdate3")
- olddir = sipconfig.push_dir("pylupdate3")
+ olddir = sip_tqt_config.push_dir("pylupdate3")
config.create_makefile("pylupdate.pro", [])
- sipconfig.pop_dir(olddir)
+ sip_tqt_config.pop_dir(olddir)
# Generate the top-level Makefile.
- sipconfig.inform("Creating top level Makefile.")
- sipconfig.copy_to_file("PyTQt.pro.in", "TEMPLATE = subdirs\nSUBDIRS = " + string.join(subdirs) + "\n")
+ sip_tqt_config.inform("Creating top level Makefile.")
+ sip_tqt_config.copy_to_file("PyTQt.pro.in", "TEMPLATE = subdirs\nSUBDIRS = " + string.join(subdirs) + "\n")
config.create_makefile("PyTQt.pro")
# Tell the user what to do next.
msg = "The build of the PyTQt source code for your system is now complete. To compile and install PyTQt run \"%s\" and \"%s install\" with appropriate user privileges." % (config.make_bin, config.make_bin)
- sipconfig.inform(msg)
+ sip_tqt_config.inform(msg)
if __name__ == "__main__":