diff options
-rw-r--r-- | build.py | 146 | ||||
-rw-r--r-- | configure.py | 160 | ||||
-rw-r--r-- | pyqtconfig.py.in | 12 |
3 files changed, 159 insertions, 159 deletions
@@ -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__": diff --git a/configure.py b/configure.py index d56307e..a34b71d 100644 --- a/configure.py +++ b/configure.py @@ -28,7 +28,7 @@ import getopt import shutil import py_compile -from sip4_tqt import sipconfig +import sip_tqt_config src_dir = os.path.dirname(os.path.abspath(__file__)) @@ -66,8 +66,8 @@ if sys.platform == "win32": else: qsci_define = "" -# Get the SIP configuration. -sipcfg = sipconfig.Configuration() +# Get the SIP-TQt configuration. +sipcfg = sip_tqt_config.Configuration() # Command line options. opt_tqtlib = None @@ -143,7 +143,7 @@ class ConfigureBase: return None def sip_flags(self): - """Get the configuration specific SIP flags. + """Get the configuration specific SIP-TQt flags. Returns a list of flags. """ @@ -160,11 +160,11 @@ class ConfigureBase: """Generate the code for a configuration. extra_include_dirs is a list of directories to add to those supplied by - the SIP configuration. + the SIP-TQt configuration. extra_lib_dir is an optional directory to add to those supplied by the - SIP configuration. + SIP-TQt configuration. extra_lib_dirs is an optional list of directories to add to those - supplied by the SIP configuration. + supplied by the SIP-TQt configuration. """ pass @@ -223,7 +223,7 @@ class ConfigurePyTQt3(ConfigureBase): qtmod_lib = None if qt_version >= 0x030100: - sipconfig.inform("Checking to see if the TQAssistantClient class is available...") + sip_tqt_config.inform("Checking to see if the TQAssistantClient class is available...") if check_class("qassistantclient.h", "TQAssistantClient(\"foo\")", lib="qassistantclient"): qtmod_lib = "qassistantclient" @@ -292,7 +292,7 @@ class ConfigurePyTQt3(ConfigureBase): # The Professional Edition needs special handling. prof = (qt_edition == "professional") - sipconfig.inform("Creating pyuic Makefile...") + sip_tqt_config.inform("Creating pyuic Makefile...") if prof or "qtxml" not in pyqt_modules: buildfile= "pyuic-prof.sbf" @@ -302,7 +302,7 @@ class ConfigurePyTQt3(ConfigureBase): else: buildfile= "pyuic.sbf" - makefile = sipconfig.ProgramMakefile( + makefile = sip_tqt_config.ProgramMakefile( configuration=sipcfg, build_file=os.path.join(src_dir, "pyuic3", buildfile), dir="pyuic3", @@ -328,7 +328,7 @@ class ConfigurePyTQt3(ConfigureBase): makefile.generate() tool_dirs.append("pyuic3") - sipconfig.inform("Creating pylupdate Makefile...") + sip_tqt_config.inform("Creating pylupdate Makefile...") if prof or "qtxml" not in pyqt_modules: buildfile= "pylupdate-prof.sbf" @@ -337,7 +337,7 @@ class ConfigurePyTQt3(ConfigureBase): else: buildfile= "pylupdate.sbf" - makefile = sipconfig.ProgramMakefile( + makefile = sip_tqt_config.ProgramMakefile( configuration=sipcfg, build_file=os.path.join(src_dir, "pylupdate3", buildfile), dir="pylupdate3", @@ -360,9 +360,9 @@ class ConfigurePyTQt3(ConfigureBase): makefile.generate() tool_dirs.append("pylupdate3") elif qt_version >= 0x020000: - sipconfig.inform("Creating pyuic Makefile...") + sip_tqt_config.inform("Creating pyuic Makefile...") - makefile = sipconfig.ProgramMakefile( + makefile = sip_tqt_config.ProgramMakefile( configuration=sipcfg, build_file="pyuic.sbf", dir="pyuic2", @@ -389,27 +389,27 @@ def inform_user(): else: edstr = "" - sipconfig.inform("TQt v%s %sis being used." % (sipconfig.version_to_string(qt_version), edstr)) - sipconfig.inform("SIP %s is being used." % sipcfg.sip_version_str) - sipconfig.inform("These PyTQt modules will be built: %s." % string.join(pyqt_modules)) + sip_tqt_config.inform("TQt v%s %sis being used." % (sip_tqt_config.version_to_string(qt_version), edstr)) + sip_tqt_config.inform("SIP-TQt %s is being used." % sipcfg.sip_version_str) + sip_tqt_config.inform("These PyTQt modules will be built: %s." % string.join(pyqt_modules)) if disabled_classes: - sipconfig.inform("Support for these TQt classes has been disabled: %s." % string.join(disabled_classes)) + sip_tqt_config.inform("Support for these TQt classes has been disabled: %s." % string.join(disabled_classes)) - sipconfig.inform("The PyTQt modules will be installed in %s." % opt_pyqtmoddir) - sipconfig.inform("The PyTQt .sip files will be installed in %s." % opt_pyqtsipdir) + sip_tqt_config.inform("The PyTQt modules will be installed in %s." % opt_pyqtmoddir) + sip_tqt_config.inform("The PyTQt .sip files will be installed in %s." % opt_pyqtsipdir) - sipconfig.inform("The TQt header files are in %s." % qt_incdir) - sipconfig.inform("The %s TQt library is in %s." % (opt_tqtlib, qt_libdir)) + sip_tqt_config.inform("The TQt header files are in %s." % qt_incdir) + sip_tqt_config.inform("The %s TQt library is in %s." % (opt_tqtlib, qt_libdir)) if qt_version >= 0x020000: - sipconfig.inform("pyuic will be installed in %s." % opt_pyqtbindir) + sip_tqt_config.inform("pyuic will be installed in %s." % opt_pyqtbindir) if qt_version >= 0x030000: - sipconfig.inform("pylupdate will be installed in %s." % opt_pyqtbindir) + sip_tqt_config.inform("pylupdate will be installed in %s." % opt_pyqtbindir) if opt_vendorcheck: - sipconfig.inform("PyTQt will only be usable with signed interpreters.") + sip_tqt_config.inform("PyTQt will only be usable with signed interpreters.") def create_config(module, template, macros): @@ -420,7 +420,7 @@ def create_config(module, template, macros): template is the template file name. macros is the dictionary of platform specific build macros. """ - sipconfig.inform("Creating %s..." % module) + sip_tqt_config.inform("Creating %s..." % module) content = { "pyqt_config_args": sys.argv[1:], @@ -477,7 +477,7 @@ def create_config(module, template, macros): if "qtxml" in pyqt_modules: content["pyqt_qtxml_sip_flags"] = qt_sip_flags - sipconfig.create_config_module(module, template, content, macros) + sip_tqt_config.create_config_module(module, template, content, macros) def compile_qt_program(name, define=None, include_dir=None, lib_dir=None, lib=None, opengl=0, python=0, debug=0): @@ -497,7 +497,7 @@ def compile_qt_program(name, define=None, include_dir=None, lib_dir=None, lib=No Returns the name of the executable suitable for running or None if it wasn't created. """ - makefile = sipconfig.ProgramMakefile(sipcfg, console=1, qt=1, warnings=0, opengl=opengl, python=python, debug=debug) + makefile = sip_tqt_config.ProgramMakefile(sipcfg, console=1, qt=1, warnings=0, opengl=opengl, python=python, debug=debug) if define: makefile.extra_defines.append(define) @@ -572,19 +572,19 @@ def check_qscintilla(): # Get the TQScintilla version number. global qsci_version - qsci_version, sciversstr = sipconfig.read_version(sciglobal, "TQScintilla", "TQSCINTILLA_VERSION", "TQSCINTILLA_VERSION_STR") + qsci_version, sciversstr = sip_tqt_config.read_version(sciglobal, "TQScintilla", "TQSCINTILLA_VERSION", "TQSCINTILLA_VERSION_STR") if glob.glob(os.path.join(opt_qscilibdir, "*tqscintilla*")): - 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 a negative version number as a # special case. if string.find(sciversstr, "snapshot") >= 0: qsci_version = -1 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." % opt_qscilibdir) + 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." % opt_qscilibdir) 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." % opt_qsciincdir) + 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." % opt_qsciincdir) def check_vendorid(): @@ -595,13 +595,13 @@ def check_vendorid(): if opt_vendorcheck: if os.access(os.path.join(opt_vendincdir, "vendorid.h"), os.F_OK): if glob.glob(os.path.join(opt_vendlibdir, "*vendorid*")): - sipconfig.inform("The VendorID package was found.") + sip_tqt_config.inform("The VendorID package was found.") else: opt_vendorcheck = 0 - sipconfig.inform("The VendorID library could not be found in %s and so signed interpreter checking will be disabled. If the VendorID library is installed then use the -m argument to explicitly specify the correct directory." % opt_vendlibdir) + sip_tqt_config.inform("The VendorID library could not be found in %s and so signed interpreter checking will be disabled. If the VendorID library is installed then use the -m argument to explicitly specify the correct directory." % opt_vendlibdir) else: opt_vendorcheck = 0 - sipconfig.inform("vendorid.h could not be found in %s and so signed interpreter checking will be disabled. If the VendorID package is installed then use the -l argument to explicitly specify the correct directory." % opt_vendincdir) + sip_tqt_config.inform("vendorid.h could not be found in %s and so signed interpreter checking will be disabled. If the VendorID package is installed then use the -l argument to explicitly specify the correct directory." % opt_vendincdir) def check_module(mname, incfile, ctor, define=None, include_dir=None, lib_dir=None, lib=None, opengl=0): @@ -621,7 +621,7 @@ def check_module(mname, incfile, ctor, define=None, include_dir=None, lib_dir=No """ # Check the module's main .sip file exists. if os.access(os.path.join(src_dir, "sip", mname, mname + "mod.sip"), os.F_OK): - sipconfig.inform("Checking to see if the %s module should be built..." % mname) + sip_tqt_config.inform("Checking to see if the %s module should be built..." % mname) if check_class(incfile, ctor, define, include_dir, lib_dir, lib, opengl): pyqt_modules.append(mname) @@ -667,7 +667,7 @@ def check_plugin(cname, incfile): cname is the name of the class. incfile is the name of the include file needed for the test. """ - sipconfig.inform("Checking to see if the %s class is built in..." % cname) + sip_tqt_config.inform("Checking to see if the %s class is built in..." % cname) return check_class(incfile, cname + "()") @@ -753,13 +753,13 @@ int main(int argc,char **argv) # Build the program. exe = compile_qt_program("mkfeatures.cpp", include_dir=sipcfg.py_inc_dir, python=1) if not exe: - sipconfig.error("Unable to build mkfeatures utility.") + sip_tqt_config.error("Unable to build mkfeatures utility.") os.system(exe) # Check the file was created. if not os.access(name, os.F_OK): - sipconfig.error("There was an error creating the features file.") + sip_tqt_config.error("There was an error creating the features file.") # Check what features have been implemented as plugins and disable them. plugins = [("STYLE_CDE", "qcdestyle.h", "TQCDEStyle"), @@ -783,15 +783,15 @@ int main(int argc,char **argv) def get_feature_flags(): - """Return the list of SIP flags that exclude unsupported TQt features. + """Return the list of SIP-TQt flags that exclude unsupported TQt features. """ featfile = "features" # Create the features file if it doesn't exist and we are not keeping it. if opt_keepfeatures and os.access(featfile,os.F_OK): - sipconfig.inform("Using existing features file.") + sip_tqt_config.inform("Using existing features file.") else: - sipconfig.inform("Creating features file...") + sip_tqt_config.inform("Creating features file...") create_features_file(featfile) # Parse the features file. @@ -811,7 +811,7 @@ def get_feature_flags(): def set_sip_flags(): - """Set the SIP platform, version and feature flags. + """Set the SIP-TQt platform, version and feature flags. """ qt_sip_flags.extend(pyqt.sip_flags()) @@ -838,7 +838,7 @@ def set_sip_flags(): qt_sip_flags.append(plattag) # Handle the TQt version tag. - verstag = sipconfig.version_to_sip_tag(qt_version, pyqt.qt_version_tags(), "TQt") + verstag = sip_tqt_config.version_to_sip_tag(qt_version, pyqt.qt_version_tags(), "TQt") if verstag: qt_sip_flags.append("-t") @@ -862,7 +862,7 @@ def set_sip_flags(): 0x020000: "TQScintilla_1_7" } - verstag = sipconfig.version_to_sip_tag(qsci_version, qscitags, "TQScintilla") + verstag = sip_tqt_config.version_to_sip_tag(qsci_version, qscitags, "TQScintilla") if verstag: qtext_sip_flags.append("-t") @@ -889,9 +889,9 @@ def generate_code(mname, extra_cflags=None, extra_cxxflags=None, extra_define=No extra_libs is a list of the names of extra libraries to add to the list of libraries. opengl is set if the module needs OpenGL support. - sip_flags is the list of sip flags to use instead of the defaults. + sip_flags is the list of sip-tqt flags to use instead of the defaults. """ - 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) @@ -901,9 +901,9 @@ def generate_code(mname, extra_cflags=None, extra_cxxflags=None, extra_define=No 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) - # Build the SIP command line. + # Build the SIP-TQt command line. argv = ['"' + sipcfg.sip_bin + '"'] if sip_flags is None: @@ -928,17 +928,17 @@ def generate_code(mname, extra_cflags=None, extra_cxxflags=None, extra_define=No argv.append("-I") argv.append(os.path.join(src_dir, "sip")) - # SIP assumes POSIX style path separators. + # SIP-TQt assumes POSIX style path separators. argv.append(string.join([src_dir, "sip", mname, mname + "mod.sip"], "/")) os.system(string.join(argv)) # Check the result. if not os.access(buildfile, os.F_OK): - sipconfig.error("Unable to create the C++ code.") + sip_tqt_config.error("Unable to create the C++ code.") # Generate the Makefile. - sipconfig.inform("Creating the Makefile for the %s module..." % mname) + sip_tqt_config.inform("Creating the Makefile for the %s module..." % mname) installs = [] sipfiles = [] @@ -948,7 +948,7 @@ def generate_code(mname, extra_cflags=None, extra_cxxflags=None, extra_define=No installs.append([sipfiles, os.path.join(pyqt.sip_dir(), mname)]) - makefile = sipconfig.SIPModuleMakefile( + makefile = sip_tqt_config.SIPModuleMakefile( configuration=sipcfg, build_file=mname + ".sbf", dir=mname, @@ -1005,7 +1005,7 @@ def check_license(): lname = "GNU General Public License" lfile = None - sipconfig.inform("This is the %s version of PyTQt %s (licensed under the %s) for Python %s on %s." % (ltype, pyqt_version_str, lname, string.split(sys.version)[0], sys.platform)) + sip_tqt_config.inform("This is the %s version of PyTQt %s (licensed under the %s) for Python %s on %s." % (ltype, pyqt_version_str, lname, string.split(sys.version)[0], sys.platform)) # Common checks. if ltype == "GPL" and sys.platform == "win32": @@ -1018,7 +1018,7 @@ def check_license(): if qted and ltype != "internal": if (qted == "free" and ltype != "GPL") or (qted != "free" and ltype == "GPL"): - sipconfig.error("This version of PyTQt and the %s edition of TQt have incompatible licenses." % qted) + sip_tqt_config.error("This version of PyTQt and the %s edition of TQt have incompatible licenses." % qted) # Confirm the license. sys.stdout.write(""" @@ -1048,9 +1048,9 @@ Type 'no' to decline the terms of the license. # If there should be a license file then check it is where it should be. if lfile: if os.access(os.path.join("sip", lfile), os.F_OK): - sipconfig.inform("Found the license file %s." % lfile) + sip_tqt_config.inform("Found the license file %s." % lfile) else: - sipconfig.error("Please copy the license file %s to the sip directory." % lfile) + sip_tqt_config.error("Please copy the license file %s to the sip directory." % lfile) def get_build_macros(overrides): @@ -1066,7 +1066,7 @@ def get_build_macros(overrides): fname = os.path.join(qt_dir, "mkspecs", "default", "qmake.conf") if not os.access(fname, os.F_OK): - sipconfig.error("Unable to find the default configuration file %s. You can use the QMAKESPEC environment variable to specify the correct platform instead of \"default\"." % fname) + sip_tqt_config.error("Unable to find the default configuration file %s. You can use the QMAKESPEC environment variable to specify the correct platform instead of \"default\"." % fname) # Add the TQt specific macros to the default. names = sipcfg.build_macros().keys() @@ -1083,7 +1083,7 @@ def get_build_macros(overrides): "QT_INSTALL_LIBS": os.path.join(qt_dir, "lib") } - return sipconfig.parse_build_macros(fname, names, overrides, properties) + return sip_tqt_config.parse_build_macros(fname, names, overrides, properties) def check_qt_installation(macros): @@ -1121,26 +1121,26 @@ def check_qt_installation(macros): qglobal = os.path.join(qt_incdir, "ntqglobal.h") if not os.access(qglobal, os.F_OK): - sipconfig.error("qglobal.h or ntqglobal.h could not be found in %s." % qt_incdir) + sip_tqt_config.error("qglobal.h or ntqglobal.h could not be found in %s." % qt_incdir) # Get the TQt version number. global qt_version - qt_version, ignore = sipconfig.read_version(qglobal, "TQt", "TQT_VERSION") + qt_version, ignore = sip_tqt_config.read_version(qglobal, "TQt", "TQT_VERSION") # 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 qt_version < 0x030100: - sipconfig.error("PyTQt for MacOS/X requires TQt v3.1.0 or later.") + sip_tqt_config.error("PyTQt for MacOS/X requires TQt v3.1.0 or later.") - # The way SIP v4.2 and later handle connections between signals and Python + # The way SIP-TQt v4.2 and later handle connections between signals and Python # slots only works with TQt v3 and later. Therefore TQt v2 and earlier needs - # SIP v3. + # SIP-TQt v3. if qt_version < 0x030000: - sipconfig.error("TQt v2.x and earlier require SIP v3.x.") + sip_tqt_config.error("TQt v2.x and earlier require SIP-TQt v3.x.") if qt_version >= 0x040000: - sipconfig.error("TQt v4.x requires PyTQt v4.x.") + sip_tqt_config.error("TQt v4.x requires PyTQt v4.x.") # Try and work out which edition it is. global qt_edition @@ -1157,7 +1157,7 @@ def check_qt_installation(macros): qconfig = os.path.join(qconfigdir, "ntqconfig.h") if not os.access(qconfig,os.F_OK): - sipconfig.error("qconfig.h or ntqconfig.h could not be found in %s." % qconfigdir) + sip_tqt_config.error("qconfig.h or ntqconfig.h could not be found in %s." % qconfigdir) f = open(qconfig) l = f.readline() @@ -1173,7 +1173,7 @@ def check_qt_installation(macros): f.close() if not qt_edition: - sipconfig.error("The TQt edition could not be determined by parsing %s." % qconfig) + sip_tqt_config.error("The TQt edition could not be determined by parsing %s." % qconfig) elif qt_version == 0x020300 and sys.platform == "win32": # See if we have the TQt v2 non-commercial version. if os.access(os.path.join(qt_libdir, "qt-mt230nc.lib"), os.F_OK): @@ -1213,7 +1213,7 @@ def check_qt_installation(macros): pyqt = ConfigurePyTQt3() - # We haven't yet factored out sipconfig's knowledge of how to build TQt + # We haven't yet factored out sip_tqt_config's knowledge of how to build TQt # binaries and it is expecting to find these in the configuration when it # generates the Makefiles. sipcfg.qt_version = qt_version @@ -1236,7 +1236,7 @@ def resolve_qt3_library(generator): if opt_tqtlib: if not is_qt_library(generator, opt_tqtlib): - sipconfig.error("The %s TQt library could not be found in %s." % (opt_tqtlib, qt_libdir)) + sip_tqt_config.error("The %s TQt library could not be found in %s." % (opt_tqtlib, qt_libdir)) else: stlib = is_qt_library(generator, "tqt") mtlib = is_qt_library(generator, "tqt-mt") @@ -1289,10 +1289,10 @@ def resolve_qt3_library(generator): names.append(opt_tqtlib) if not names: - sipconfig.error("No TQt libraries could be found in %s." % qt_libdir) + sip_tqt_config.error("No TQt libraries could be found in %s." % qt_libdir) if len(names) > 1: - sipconfig.error("These TQt libraries were found: %s. Use the -y argument to explicitly specify which you want to use." % string.join(names)) + sip_tqt_config.error("These TQt libraries were found: %s. Use the -y argument to explicitly specify which you want to use." % string.join(names)) def is_qt_library(generator, lib): @@ -1322,12 +1322,12 @@ def main(argv): """ # Check Python isn't too new. if sipcfg.py_version >= 0x030000: - sipconfig.error("PyTQt v3.x does not support Python v3.x") + sip_tqt_config.error("PyTQt v3.x does not support Python v3.x") - # Check SIP is new enough. + # Check SIP-TQt is new enough. if sipcfg.sip_version_str[:8] != "snapshot": if sipcfg.sip_version < sip_min_version: - sipconfig.error("This version of PyTQt requires SIP v%s or later" % sipconfig.version_to_string(sip_min_version)) + sip_tqt_config.error("This version of PyTQt requires SIP-TQt v%s or later" % sip_tqt_config.version_to_string(sip_min_version)) # Parse the command line. try: @@ -1399,12 +1399,12 @@ def main(argv): # Check that we know the name of the TQt root directory. if not qt_dir: - sipconfig.error("A TQt installation could not be found. Use use the -q argument or the TQTDIR environment variable to explicitly specify the correct directory.") + sip_tqt_config.error("A TQt installation could not be found. Use use the -q argument or the TQTDIR environment variable to explicitly specify the correct directory.") # When building static libraries, signed interpreter checking makes no # sense. if opt_vendorcheck and opt_static: - sipconfig.error("Using the VendorID package when building static libraries makes no sense.") + sip_tqt_config.error("Using the VendorID package when building static libraries makes no sense.") # Replace the existing build macros with the ones from the TQt installation. macros = get_build_macros(args) @@ -1429,7 +1429,7 @@ def main(argv): # Check for the VendorID package. check_vendorid() - # Set the SIP platform, version and feature flags. + # Set the SIP-TQt platform, version and feature flags. set_sip_flags() # Tell the user what's been found. @@ -1456,9 +1456,9 @@ def main(argv): pyqt.code(extra_include_dirs, extra_lib_dir, extra_libs) # Create the additional Makefiles. - sipconfig.inform("Creating top level Makefile...") + sip_tqt_config.inform("Creating top level Makefile...") - sipconfig.ParentMakefile( + sip_tqt_config.ParentMakefile( configuration=sipcfg, subdirs=pyqt_modules + pyqt.tools(), installs=(pyqt.module_installs(), pyqt.module_dir()) diff --git a/pyqtconfig.py.in b/pyqtconfig.py.in index a838543..b927751 100644 --- a/pyqtconfig.py.in +++ b/pyqtconfig.py.in @@ -21,14 +21,14 @@ # modules that %Import PyTQt modules. -from sip4_tqt import sipconfig +import sip_tqt_config # These are installation specific values created when PyTQt was configured. # @SIP_CONFIGURATION@ -class Configuration(sipconfig.Configuration): +class Configuration(sip_tqt_config.Configuration): """The class that represents PyTQt configuration values. """ def __init__(self, sub_cfg=None): @@ -44,17 +44,17 @@ class Configuration(sipconfig.Configuration): cfg.append(_pkg_config) - sipconfig.Configuration.__init__(self, cfg) + sip_tqt_config.Configuration.__init__(self, cfg) -class TQtModuleMakefile(sipconfig.SIPModuleMakefile): +class TQtModuleMakefile(sip_tqt_config.SIPModuleMakefile): """The Makefile class for modules that %Import qt. """ def __init__(self, *args, **kw): """Initialise an instance of a module Makefile. """ kw["qt"] = 1 - apply(sipconfig.SIPModuleMakefile.__init__, (self, ) + args, kw) + apply(sip_tqt_config.SIPModuleMakefile.__init__, (self, ) + args, kw) def finalise(self): """Finalise the macros. @@ -65,7 +65,7 @@ class TQtModuleMakefile(sipconfig.SIPModuleMakefile): self.LIBDIR.append(self.config.pyqt_mod_dir) self.extra_libs.append(self.module_as_lib("qt")) - sipconfig.SIPModuleMakefile.finalise(self) + sip_tqt_config.SIPModuleMakefile.finalise(self) class TQtAxContainerModuleMakefile(TQtModuleMakefile): |