diff options
Diffstat (limited to 'build.py')
-rw-r--r-- | build.py | 184 |
1 files changed, 92 insertions, 92 deletions
@@ -19,7 +19,7 @@ # # This is the build script for PyTQt. It should be run in the top level # directory of the source distribution and by the Python interpreter for which -# it is being built. It uses either qmake or tmake to do the hard work of +# it is being built. It uses either tqmake or tmake to do the hard work of # generating the platform specific Makefiles. @@ -46,14 +46,14 @@ config = sip_tqt_config.SIPConfig("PyTQt 3.18.1") # Initialise the globals. sipMajorVersion = config.sip_version >> 16 -sciIncDir = config.qt_inc_dir -sciLibDir = config.qt_lib_dir +sciIncDir = config.tqt_inc_dir +sciLibDir = config.tqt_lib_dir sciLib = None sciVersion = None binDir = config.default_bin_dir modDir = config.default_mod_dir sipDir = config.default_sip_dir -buildModules = ["qt"] +buildModules = ["tqt"] tempBuildDir = None catCppFiles = 0 catSplit = 1 @@ -71,14 +71,14 @@ def usage(rcode = 2): 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(" -a tag explicitly enable the tqtpe 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-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) + print(" -n dir the directory containing the TQScintilla header files [default %s]" % config.tqt_inc_dir) + print(" -o dir the directory containing the TQScintilla library [default %s]" % config.tqt_lib_dir) print(" -r generate code with tracing enabled [default disabled]") print(" -v dir where the PyTQt .sip files will be installed [default %s]" % config.default_sip_dir) @@ -87,7 +87,7 @@ def usage(rcode = 2): def mkTempBuildDir(olddir=None): """Create a temporary build directory for a console application called - qttest, complete with patched Makefile. The global tempBuildDir is set to + tqttest, complete with patched Makefile. The global tempBuildDir is set to the name of the directory. The temporary directory becomes the current directory. @@ -107,26 +107,26 @@ def mkTempBuildDir(olddir=None): prevdir = sip_tqt_config.push_dir(tempBuildDir) - sip_tqt_config.copy_to_file("qttest.pro.in", + sip_tqt_config.copy_to_file("tqttest.pro.in", """TEMPLATE = app -TARGET = qttest +TARGET = tqttest CONFIG += console warn_off @TEST_OPENGL@ @BLX_CONFIG_APP@ -INCLUDEPATH = @BLX_INCLUDEPATH@ @TEST_QSCINTILLA_INC@ +INCLUDEPATH = @BLX_INCLUDEPATH@ @TEST_TQSCINTILLA_INC@ DEFINES = @BLX_DEFINES@ -SOURCES = qttest.cpp -LIBS += @TEST_QUI_LIB@ @TEST_QSCINTILLA_LIB@ +SOURCES = tqttest.cpp +LIBS += @TEST_TQUI_LIB@ @TEST_TQSCINTILLA_LIB@ """) # Disable OpenGL, tqui and TQScintilla support by default. config.patches["@TEST_OPENGL@"] = "" - config.patches["@TEST_QUI_LIB@"] = "" - config.patches["@TEST_QSCINTILLA_INC@"] = "" - config.patches["@TEST_QSCINTILLA_LIB@"] = "" + config.patches["@TEST_TQUI_LIB@"] = "" + config.patches["@TEST_TQSCINTILLA_INC@"] = "" + config.patches["@TEST_TQSCINTILLA_LIB@"] = "" # Create a dummy source file to suppress a qmake warning. - sip_tqt_config.copy_to_file("qttest.cpp", "") + sip_tqt_config.copy_to_file("tqttest.cpp", "") - config.create_makefile("qttest.pro") + config.create_makefile("tqttest.pro") else: sip_tqt_config.pop_dir(olddir) prevdir = None @@ -152,7 +152,7 @@ def tryModule(maindir, mname, incfile, ctor): if not os.access(msip, os.F_OK): return - sip_tqt_config.copy_to_file("qttest.cpp", + sip_tqt_config.copy_to_file("tqttest.cpp", """#include <%s> int main(int argc,char **argv) @@ -177,7 +177,7 @@ def checkTQScintilla(): sciglobal = os.path.join(sciIncDir, "tqextscintillaglobal.h") if os.access(sciglobal,os.F_OK): - config.patches["@PYQT_QSCINTILLA_INC@"] = sciIncDir + config.patches["@PYTQT_TQSCINTILLA_INC@"] = sciIncDir sip_tqt_config.inform("%s contains tqextscintillaglobal.h." % (sciIncDir)) @@ -209,13 +209,13 @@ def checkTQScintilla(): else: sciLib = sip_tqt_config.escape("-L" + sciLibDir) + " -ltqscintilla" - config.patches["@PYQT_QSCINTILLA_LIB@"] = sciLib + config.patches["@PYTQT_TQSCINTILLA_LIB@"] = sciLib else: - 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)) + sip_tqt_config.inform("The TQScintilla library could not be found in %s and so the tqtext module will not be built. If TQScintilla is installed then use the -o argument to explicitly specify the correct directory." % (sciLibDir)) sciVersion = -1 else: - 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) + sip_tqt_config.inform("tqextscintillaglobal.h could not be found in %s and so the tqtext module will not be built. If TQScintilla is installed then use the -n argument to explicitly specify the correct directory." % sciIncDir) sciVersion = -1 @@ -225,54 +225,54 @@ def moduleChecks(maindir): """ sip_tqt_config.inform("Checking which additional PyTQt modules to build."); - tryModule(maindir,"qtcanvas", "qcanvas.h", "TQCanvas()") - tryModule(maindir,"qtnetwork", "qsocket.h", "TQSocket()") - tryModule(maindir,"qttable", "qtable.h", "TQTable()") - tryModule(maindir,"qtxml", "qdom.h", "TQDomImplementation()") + tryModule(maindir,"tqtcanvas", "tqcanvas.h", "TQCanvas()") + tryModule(maindir,"tqtnetwork", "tqsocket.h", "TQSocket()") + tryModule(maindir,"tqttable", "tqtable.h", "TQTable()") + tryModule(maindir,"tqtxml", "tqdom.h", "TQDomImplementation()") - if config.qt_version >= 0x030000: - tryModule(maindir,"qtsql", "qsql.h", "TQSql()") + if config.tqt_version >= 0x030000: + tryModule(maindir,"tqtsql", "tqsql.h", "TQSql()") - # We need a different Makefile for the qtgl module. + # We need a different Makefile for the tqtgl module. config.patches["@TEST_OPENGL@"] = "opengl" - config.create_makefile("qttest.pro") + config.create_makefile("tqttest.pro") - tryModule(maindir,"qtgl", "qgl.h", "TQGLWidget()") + tryModule(maindir,"tqtgl", "tqgl.h", "TQGLWidget()") # Put things back. config.patches["@TEST_OPENGL@"] = "" - config.create_makefile("qttest.pro") + config.create_makefile("tqttest.pro") # Check for the tqui library. - if config.qt_version >= 0x030000: + if config.tqt_version >= 0x030000: if sys.platform == "win32": tquilib = r"$(TQTDIR)\lib\tqui.lib" else: tquilib = "-ltqui" - config.patches["@PYQT_QUI_LIB@"] = tquilib + config.patches["@PYTQT_TQUI_LIB@"] = tquilib - config.patches["@TEST_QUI_LIB@"] = tquilib - config.create_makefile("qttest.pro") + config.patches["@TEST_TQUI_LIB@"] = tquilib + config.create_makefile("tqttest.pro") - tryModule(maindir,"qtui", "qwidgetfactory.h", "TQWidgetFactory()") + tryModule(maindir,"tqtui", "tqwidgetfactory.h", "TQWidgetFactory()") # Put things back. - config.patches["@TEST_QUI_LIB@"] = "" - config.create_makefile("qttest.pro") + config.patches["@TEST_TQUI_LIB@"] = "" + config.create_makefile("tqttest.pro") # Check for the TQScintilla library. if sciVersion >= 0: - config.patches["@TEST_QSCINTILLA_INC@"] = sciIncDir - config.patches["@TEST_QSCINTILLA_LIB@"] = sciLib - config.create_makefile("qttest.pro") + config.patches["@TEST_TQSCINTILLA_INC@"] = sciIncDir + config.patches["@TEST_TQSCINTILLA_LIB@"] = sciLib + config.create_makefile("tqttest.pro") - tryModule(maindir,"qtext", "tqextscintillabase.h", "TQextScintillaBase()") + tryModule(maindir,"tqtext", "tqextscintillabase.h", "TQextScintillaBase()") # Put things back. - config.patches["@TEST_QSCINTILLA_INC@"] = "" - config.patches["@TEST_QSCINTILLA_LIB@"] = "" - config.create_makefile("qttest.pro") + config.patches["@TEST_TQSCINTILLA_INC@"] = "" + config.patches["@TEST_TQSCINTILLA_LIB@"] = "" + config.create_makefile("tqttest.pro") def generateFeatures(featfile): @@ -302,7 +302,7 @@ def generateFeatures(featfile): "WORKSPACE"] # Generate the program which will generate the features file. - f = open("qttest.cpp","w") + f = open("tqttest.cpp","w") # Escape the backslashes so that the name can be embedded in a C++ string. ffstr = string.replace(featfile, "\\", "\\\\") @@ -328,7 +328,7 @@ int main(int argc,char **argv) #endif #if (defined(Q_OS_WIN32) || defined(Q_OS_WIN64)) && TQT_VERSION >= 0x030000 - if (qWinVersion() != TQt::WV_XP) + if (tqWinVersion() != TQt::WV_XP) fprintf(fp,"-x TQt_STYLE_WINDOWSXP\\n"); #endif """ % (ffstr, ffstr)) @@ -352,18 +352,18 @@ int main(int argc,char **argv) f.close() sip_tqt_config.run_make() - sip_tqt_config.run_program(os.path.join(os.getcwd(), "qttest")) + sip_tqt_config.run_program(os.path.join(os.getcwd(), "tqttest")) sip_tqt_config.run_make("clean") sip_tqt_config.inform("Generated the features file.") -def generateSource(mname, plattag, qttag, xtrtag): +def generateSource(mname, plattag, tqttag, xtrtag): """Generate the C++ source code for a particular PyTQt module. mname is the name of the module. plattag is the SIP-TQt tag for the platform. - qttag is the SIP-TQt tag for the TQt version. + tqttag is the SIP-TQt tag for the TQt version. xtrtag is an optional extra SIP-TQt tag. """ sip_tqt_config.inform("Generating the C++ source for the %s module." % mname) @@ -381,7 +381,7 @@ def generateSource(mname, plattag, qttag, xtrtag): pro = mname + ".pro" argv = ["-t", plattag, - "-t", qttag, + "-t", tqttag, "-z", "features", "-I", "sip", "-m", mname + "/" + pro + ".in", @@ -474,8 +474,8 @@ def main(argv): if opt == "-h": usage(0) elif opt == "-a": - global qpeTag - qpeTag = arg + global tqpeTag + tqpeTag = arg elif opt == "-b": global binDir binDir = arg @@ -522,19 +522,19 @@ def main(argv): 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: + if config.tqt_version == 0: 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: + if sys.platform == "darwin" and config.tqt_version < 0x030100: 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): 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@"] = sip_tqt_config.escape(modDir) + config.patches["@PYTQT_MODDIR@"] = sip_tqt_config.escape(modDir) sip_tqt_config.inform("%s is the PyTQt installation directory." % (modDir)) @@ -544,7 +544,7 @@ def main(argv): else: warn = "warn_off" - config.patches["@PYQT_WARN@"] = warn + config.patches["@PYTQT_WARN@"] = warn # Create patches to allow some modules to link against others. if sipMajorVersion >= 4: @@ -552,52 +552,52 @@ def main(argv): elif sys.platform == "win32": modlink = sip_tqt_config.escape(os.path.join(modDir, "libtqtc.lib")) else: - modlink = sip_tqt_config.escape("-L" + modDir) + " -lqtcmodule" + modlink = sip_tqt_config.escape("-L" + modDir) + " -ltqtcmodule" - config.patches["@PYQT_QT_MODULE@"] = modlink + config.patches["@PYTQT_TQT_MODULE@"] = modlink if sipMajorVersion >= 4: modlink = "" elif sys.platform == "win32": modlink = sip_tqt_config.escape(os.path.join(modDir, "libtqttablec.lib")) + " " + sip_tqt_config.escape(os.path.join(modDir, "libtqtc.lib")) else: - modlink = sip_tqt_config.escape("-L" + modDir) + " -lqttablecmodule -lqtcmodule" + modlink = sip_tqt_config.escape("-L" + modDir) + " -ltqttablecmodule -ltqtcmodule" - config.patches["@PYQT_QTTABLE_MODULE@"] = modlink + config.patches["@PYTQT_TQTTABLE_MODULE@"] = modlink # The professional edition needs special handling if XML support is needed. - if config.qt_edition == "professional": + if config.tqt_edition == "professional": rbprof = "rbprof" else: rbprof = "" - config.patches["@PYQT_RBPROF@"] = rbprof + config.patches["@PYTQT_RBPROF@"] = rbprof # Link in the qassistantclient library for TQt v3.1+. - qaclib = "" + tqaclib = "" - if config.qt_version >= 0x030100: + if config.tqt_version >= 0x030100: if sys.platform == "win32": - qaclib = r"$(TQTDIR)\lib\qassistantclient.lib" + tqaclib = r"$(TQTDIR)\lib\tqassistantclient.lib" else: - qaclib = "-lqassistantclient" + tqaclib = "-ltqassistantclient" - config.patches["@PYQT_QASSISTANTCLIENT_LIB@"] = qaclib + config.patches["@PYTQT_QASSISTANTCLIENT_LIB@"] = tqaclib # Check for TQScintilla. - if config.qt_version >= 0x030000: + if config.tqt_version >= 0x030000: checkTQScintilla() # Create a build directory that we can compile test programs. maindir = mkTempBuildDir() # Check what additional modules to build. - if config.qt_version >= 0x020000: + if config.tqt_version >= 0x020000: moduleChecks(maindir) # Work out the platform and TQt version tags to pass to SIP-TQt to generate the # code we need. - if config.qt_lib == "qte": + if config.tqt_lib == "tqte": plattag = "WS_QWS" elif sys.platform == "win32": plattag = "WS_WIN" @@ -606,7 +606,7 @@ def main(argv): else: plattag = "WS_X11" - qttags = { + tqttags = { 0x020000: "TQt_1_43", 0x020100: "TQt_2_00", 0x020200: "TQt_2_1_0", @@ -626,7 +626,7 @@ def main(argv): 0x040000: "TQt_3_3_0" } - qttag = versionToTag(config.qt_version, qttags, "TQt") + tqttag = versionToTag(config.tqt_version, tqttags, "TQt") # Work out the TQScintilla tag. if sciVersion >= 0: @@ -648,20 +648,20 @@ def main(argv): subdirs = [] for mname in buildModules: - if mname == "qtext": + if mname == "tqtext": xtratag = scitag else: xtratag = None - generateSource(mname, plattag, qttag, xtratag) + generateSource(mname, plattag, tqttag, xtratag) subdirs.append(mname) - # We handle the qtpe module explicitly rather than auto-detect. This is + # We handle the tqtpe module explicitly rather than auto-detect. This is # because it does things a bit differently and I'm too lazy to deal with it # properly at the moment. - if qpeTag: - generateSource("qtpe", plattag, qttag, qpeTag) - subdirs.append("qtpe") + if tqpeTag: + generateSource("tqtpe", plattag, tqttag, tqpeTag) + subdirs.append("tqtpe") # Install the .sip files. sip_tqt_config.inform("Creating Makefile for .sip files.") @@ -683,23 +683,23 @@ def main(argv): subdirs.append("sip") # See which version of pyuic to build. - config.patches["@PYQT_BINDIR@"] = sip_tqt_config.escape(binDir) + config.patches["@PYTQT_BINDIR@"] = sip_tqt_config.escape(binDir) - if config.qt_version >= 0x030000: - sip_tqt_config.inform("Creating Makefile for pyuic3.") - subdirs.append("pyuic3") - olddir = sip_tqt_config.push_dir("pyuic3") + if config.tqt_version >= 0x030000: + sip_tqt_config.inform("Creating Makefile for pytquic3.") + subdirs.append("pytquic3") + olddir = sip_tqt_config.push_dir("pytquic3") - config.create_makefile("pyuic.pro", []) + config.create_makefile("pytquic.pro", []) sip_tqt_config.pop_dir(olddir) # Build pylupdate if TQt v3.0 or later. - if config.qt_version >= 0x030000: - sip_tqt_config.inform("Creating Makefile for pylupdate3.") - subdirs.append("pylupdate3") - olddir = sip_tqt_config.push_dir("pylupdate3") + if config.tqt_version >= 0x030000: + sip_tqt_config.inform("Creating Makefile for pytqlupdate3.") + subdirs.append("pytqlupdate3") + olddir = sip_tqt_config.push_dir("pytqlupdate3") - config.create_makefile("pylupdate.pro", []) + config.create_makefile("pytqlupdate.pro", []) sip_tqt_config.pop_dir(olddir) # Generate the top-level Makefile. |