diff options
Diffstat (limited to 'configure.py')
-rw-r--r-- | configure.py | 160 |
1 files changed, 80 insertions, 80 deletions
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()) |