Browse Source

relate to bug request 2699, rename the python-tqt libs to avoid conflicts with upstream.

Signed-off-by: gregory guy <gregory-tde@laposte.net>
pull/4/head
gregory guy 6 months ago
parent
commit
cd872e189f
No known key found for this signature in database
GPG Key ID: 2CC84A1CC6823AF8
  1. 132
      build.py
  2. 132
      configure.py
  3. 4
      module-init.py
  4. 12
      pyqtconfig.py.in

132
build.py

@ -35,13 +35,13 @@ import string
# Get the SIP configuration.
try:
from sip4_tqt import sipconfig
import siptrinityconfig
except:
print "Unable to import the sipconfig module. Please make sure you have"
print "Unable to import the siptrinityconfig module. Please make sure you have"
print "SIP v3.9 or later installed."
sys.exit(1)
config = sipconfig.SIPConfig("PyTQt 3.18.1")
config = siptrinityconfig.SIPConfig("PyTQt 3.18.1")
# Initialise the globals.
@ -68,7 +68,7 @@ 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]" % siptrinityconfig.script()
print "where:"
print " -h display this help message"
print " -a tag explicitly enable the qtpe module"
@ -103,11 +103,11 @@ def mkTempBuildDir(olddir=None):
try:
os.mkdir(tempBuildDir)
except:
sipconfig.error("Unable to create temporary directory.")
siptrinityconfig.error("Unable to create temporary directory.")
prevdir = sipconfig.push_dir(tempBuildDir)
prevdir = siptrinityconfig.push_dir(tempBuildDir)
sipconfig.copy_to_file("qttest.pro.in",
siptrinityconfig.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", "")
siptrinityconfig.copy_to_file("qttest.cpp", "")
config.create_makefile("qttest.pro")
else:
sipconfig.pop_dir(olddir)
siptrinityconfig.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",
siptrinityconfig.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 siptrinityconfig.run_make(None,0) == 0:
buildModules.append(mname)
sipconfig.inform("The %s module will be built." % mname)
siptrinityconfig.inform("The %s module will be built." % mname)
else:
sipconfig.inform("The %s module will not be built." % mname)
siptrinityconfig.inform("The %s module will not be built." % mname)
sipconfig.run_make("clean")
siptrinityconfig.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 qextscintillaglobal.h." % (sciIncDir))
siptrinityconfig.inform("%s contains qextscintillaglobal.h." % (sciIncDir))
# Get the TQScintilla version number.
global sciVersion
sciVersion, sciversstr = sipconfig.read_version(sciglobal, "TQScintilla", "TQSCINTILLA_VERSION", "TQSCINTILLA_VERSION_STR")
sciVersion, sciversstr = siptrinityconfig.read_version(sciglobal, "TQScintilla", "TQSCINTILLA_VERSION", "TQSCINTILLA_VERSION_STR")
sipconfig.inform("TQScintilla %s is being used." % (sciversstr))
siptrinityconfig.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 = "libqscintilla.*"
if len(glob.glob(os.path.join(sciLibDir, lpatt))):
sipconfig.inform("%s contains the TQScintilla library." % sciLibDir)
siptrinityconfig.inform("%s contains the TQScintilla library." % sciLibDir)
global sciLib
if sys.platform == "win32":
sciLib = sipconfig.escape(os.path.join(sciLibDir, "qscintilla.lib"))
sciLib = siptrinityconfig.escape(os.path.join(sciLibDir, "qscintilla.lib"))
else:
sciLib = sipconfig.escape("-L" + sciLibDir) + " -lqscintilla"
sciLib = siptrinityconfig.escape("-L" + sciLibDir) + " -lqscintilla"
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))
siptrinityconfig.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("qextscintillaglobal.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)
siptrinityconfig.inform("qextscintillaglobal.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.");
siptrinityconfig.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.")
siptrinityconfig.inform("Using existing features file.")
return
sipconfig.inform("Generating the features file.")
siptrinityconfig.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,11 +351,11 @@ int main(int argc,char **argv)
f.close()
sipconfig.run_make()
sipconfig.run_program(os.path.join(os.getcwd(), "qttest"))
sipconfig.run_make("clean")
siptrinityconfig.run_make()
siptrinityconfig.run_program(os.path.join(os.getcwd(), "qttest"))
siptrinityconfig.run_make("clean")
sipconfig.inform("Generated the features file.")
siptrinityconfig.inform("Generated the features file.")
def generateSource(mname, plattag, qttag, xtrtag):
@ -366,7 +366,7 @@ def generateSource(mname, plattag, qttag, xtrtag):
qttag is the SIP tag for the TQt version.
xtrtag is an optional extra SIP tag.
"""
sipconfig.inform("Generating the C++ source for the %s module." % mname)
siptrinityconfig.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)
siptrinityconfig.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)
siptrinityconfig.run_program(config.sip_bin, argv)
# Generate the Makefile.
sipconfig.inform("Generating the Makefile for the %s module." % mname)
siptrinityconfig.inform("Generating the Makefile for the %s module." % mname)
olddir = sipconfig.push_dir(mname)
olddir = siptrinityconfig.push_dir(mname)
if catCppFiles:
sipconfig.cat_source_files(mname, catSplit)
siptrinityconfig.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))
siptrinityconfig.inform("Compiling %s." % (pyname))
py_compile.compile(pyname)
sipconfig.pop_dir(olddir)
siptrinityconfig.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))
siptrinityconfig.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()
siptrinityconfig.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)
siptrinityconfig.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)
siptrinityconfig.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")
siptrinityconfig.error("SIP 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")
siptrinityconfig.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))
siptrinityconfig.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@"] = siptrinityconfig.escape(modDir)
sipconfig.inform("%s is the PyTQt installation directory." % (modDir))
siptrinityconfig.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 = siptrinityconfig.escape(os.path.join(modDir, "libtqtc.lib"))
else:
modlink = sipconfig.escape("-L" + modDir) + " -lqtcmodule"
modlink = siptrinityconfig.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 = siptrinityconfig.escape(os.path.join(modDir, "libtqttablec.lib")) + " " + siptrinityconfig.escape(os.path.join(modDir, "libtqtc.lib"))
else:
modlink = sipconfig.escape("-L" + modDir) + " -lqttablecmodule -lqtcmodule"
modlink = siptrinityconfig.escape("-L" + modDir) + " -lqttablecmodule -lqtcmodule"
config.patches["@PYQT_QTTABLE_MODULE@"] = modlink
@ -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")
siptrinityconfig.inform("Creating Makefile for .sip files.")
olddir = siptrinityconfig.push_dir("sip")
siptrinityconfig.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)
siptrinityconfig.pop_dir(olddir)
subdirs.append("sip")
# See which version of pyuic to build.
config.patches["@PYQT_BINDIR@"] = sipconfig.escape(binDir)
config.patches["@PYQT_BINDIR@"] = siptrinityconfig.escape(binDir)
if config.qt_version >= 0x030000:
sipconfig.inform("Creating Makefile for pyuic3.")
siptrinityconfig.inform("Creating Makefile for pyuic3.")
subdirs.append("pyuic3")
olddir = sipconfig.push_dir("pyuic3")
olddir = siptrinityconfig.push_dir("pyuic3")
elif config.qt_version >= 0x020000:
sipconfig.inform("Creating Makefile for pyuic2.")
siptrinityconfig.inform("Creating Makefile for pyuic2.")
subdirs.append("pyuic2")
olddir = sipconfig.push_dir("pyuic2")
olddir = siptrinityconfig.push_dir("pyuic2")
config.create_makefile("pyuic.pro", [])
sipconfig.pop_dir(olddir)
siptrinityconfig.pop_dir(olddir)
# Build pylupdate if TQt v3.0 or later.
if config.qt_version >= 0x030000:
sipconfig.inform("Creating Makefile for pylupdate3.")
siptrinityconfig.inform("Creating Makefile for pylupdate3.")
subdirs.append("pylupdate3")
olddir = sipconfig.push_dir("pylupdate3")
olddir = siptrinityconfig.push_dir("pylupdate3")
config.create_makefile("pylupdate.pro", [])
sipconfig.pop_dir(olddir)
siptrinityconfig.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")
siptrinityconfig.inform("Creating top level Makefile.")
siptrinityconfig.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)
siptrinityconfig.inform(msg)
if __name__ == "__main__":

132
configure.py

@ -28,7 +28,7 @@ import getopt
import shutil
import py_compile
from sip4_tqt import sipconfig
import siptrinityconfig
src_dir = os.path.dirname(os.path.abspath(__file__))
@ -67,7 +67,7 @@ else:
qsci_define = ""
# Get the SIP configuration.
sipcfg = sipconfig.Configuration()
sipcfg = siptrinityconfig.Configuration()
# Command line options.
opt_tqtlib = None
@ -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...")
siptrinityconfig.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...")
siptrinityconfig.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 = siptrinityconfig.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...")
siptrinityconfig.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 = siptrinityconfig.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...")
siptrinityconfig.inform("Creating pyuic Makefile...")
makefile = sipconfig.ProgramMakefile(
makefile = siptrinityconfig.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))
siptrinityconfig.inform("TQt v%s %sis being used." % (siptrinityconfig.version_to_string(qt_version), edstr))
siptrinityconfig.inform("SIP %s is being used." % sipcfg.sip_version_str)
siptrinityconfig.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))
siptrinityconfig.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)
siptrinityconfig.inform("The PyTQt modules will be installed in %s." % opt_pyqtmoddir)
siptrinityconfig.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))
siptrinityconfig.inform("The TQt header files are in %s." % qt_incdir)
siptrinityconfig.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)
siptrinityconfig.inform("pyuic will be installed in %s." % opt_pyqtbindir)
if qt_version >= 0x030000:
sipconfig.inform("pylupdate will be installed in %s." % opt_pyqtbindir)
siptrinityconfig.inform("pylupdate will be installed in %s." % opt_pyqtbindir)
if opt_vendorcheck:
sipconfig.inform("PyTQt will only be usable with signed interpreters.")
siptrinityconfig.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)
siptrinityconfig.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)
siptrinityconfig.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 = siptrinityconfig.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 = siptrinityconfig.read_version(sciglobal, "TQScintilla", "TQSCINTILLA_VERSION", "TQSCINTILLA_VERSION_STR")
if glob.glob(os.path.join(opt_qscilibdir, "*qscintilla*")):
sipconfig.inform("TQScintilla %s is being used." % sciversstr)
siptrinityconfig.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)
siptrinityconfig.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("qextscintillaglobal.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)
siptrinityconfig.inform("qextscintillaglobal.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.")
siptrinityconfig.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)
siptrinityconfig.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)
siptrinityconfig.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)
siptrinityconfig.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)
siptrinityconfig.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.")
siptrinityconfig.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.")
siptrinityconfig.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"),
@ -789,9 +789,9 @@ def get_feature_flags():
# 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.")
siptrinityconfig.inform("Using existing features file.")
else:
sipconfig.inform("Creating features file...")
siptrinityconfig.inform("Creating features file...")
create_features_file(featfile)
# Parse the features file.
@ -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 = siptrinityconfig.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 = siptrinityconfig.version_to_sip_tag(qsci_version, qscitags, "TQScintilla")
if verstag:
qtext_sip_flags.append("-t")
@ -891,7 +891,7 @@ def generate_code(mname, extra_cflags=None, extra_cxxflags=None, extra_define=No
opengl is set if the module needs OpenGL support.
sip_flags is the list of sip flags to use instead of the defaults.
"""
sipconfig.inform("Generating the C++ source for the %s module..." % mname)
siptrinityconfig.inform("Generating the C++ source for the %s module..." % mname)
try:
shutil.rmtree(mname)
@ -901,7 +901,7 @@ 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)
siptrinityconfig.error("Unable to create the %s directory." % mname)
# Build the SIP command line.
argv = ['"' + sipcfg.sip_bin + '"']
@ -935,10 +935,10 @@ def generate_code(mname, extra_cflags=None, extra_cxxflags=None, extra_define=No
# Check the result.
if not os.access(buildfile, os.F_OK):
sipconfig.error("Unable to create the C++ code.")
siptrinityconfig.error("Unable to create the C++ code.")
# Generate the Makefile.
sipconfig.inform("Creating the Makefile for the %s module..." % mname)
siptrinityconfig.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 = siptrinityconfig.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))
siptrinityconfig.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)
siptrinityconfig.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)
siptrinityconfig.inform("Found the license file %s." % lfile)
else:
sipconfig.error("Please copy the license file %s to the sip directory." % lfile)
siptrinityconfig.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)
siptrinityconfig.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 siptrinityconfig.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)
siptrinityconfig.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 = siptrinityconfig.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.")
siptrinityconfig.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
# slots only works with TQt v3 and later. Therefore TQt v2 and earlier needs
# SIP v3.
if qt_version < 0x030000:
sipconfig.error("TQt v2.x and earlier require SIP v3.x.")
siptrinityconfig.error("TQt v2.x and earlier require SIP v3.x.")
if qt_version >= 0x040000:
sipconfig.error("TQt v4.x requires PyTQt v4.x.")
siptrinityconfig.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)
siptrinityconfig.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)
siptrinityconfig.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 siptrinityconfig'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))
siptrinityconfig.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)
siptrinityconfig.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))
siptrinityconfig.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")
siptrinityconfig.error("PyTQt v3.x does not support Python v3.x")
# Check SIP 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))
siptrinityconfig.error("This version of PyTQt requires SIP v%s or later" % siptrinityconfig.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.")
siptrinityconfig.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.")
siptrinityconfig.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)
@ -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...")
siptrinityconfig.inform("Creating top level Makefile...")
sipconfig.ParentMakefile(
siptrinityconfig.ParentMakefile(
configuration=sipcfg,
subdirs=pyqt_modules + pyqt.tools(),
installs=(pyqt.module_installs(), pyqt.module_dir())

4
module-init.py

@ -3,8 +3,8 @@
import sys, os
tqt_modules = []
for m_path in sys.path:
if os.path.exists(os.path.join(m_path, 'sip4_tqt')):
m_sip_dir = os.path.join(m_path, 'sip4_tqt')
if os.path.exists(os.path.join(m_path, 'sip-trinity')):
m_sip_dir = os.path.join(m_path, 'sip-trinity')
tqt_modules.insert(0, m_sip_dir)
if os.path.exists(os.path.join(m_path, 'python_tqt')):
m_pyqt_dir = os.path.join(m_path, 'python_tqt')

12
pyqtconfig.py.in

@ -21,14 +21,14 @@
# modules that %Import PyTQt modules.
from sip4_tqt import sipconfig
import siptrinityconfig
# These are installation specific values created when PyTQt was configured.
# @SIP_CONFIGURATION@
class Configuration(sipconfig.Configuration):
class Configuration(siptrinityconfig.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)
siptrinityconfig.Configuration.__init__(self, cfg)
class TQtModuleMakefile(sipconfig.SIPModuleMakefile):
class TQtModuleMakefile(siptrinityconfig.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(siptrinityconfig.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)
siptrinityconfig.SIPModuleMakefile.finalise(self)
class TQtAxContainerModuleMakefile(TQtModuleMakefile):

Loading…
Cancel
Save