WIP:relate to bug request 2699, rename the python-tqt libs to avoid conflicts with upstream. #4
Closed
Ghost
wants to merge 1 commits from fix/bug2699
into master
4 changed files with 140 additions and 140 deletions
@ -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" |
||||
MicheleC
commented 6 months ago
Review
And
![]()
Ghost
commented 6 months ago
Review
WIP, all the reference in the doc for sip and python-tqt have to be adjusted as well. |
||||
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__": |
||||
|
Loading…
Reference in new issue
Maybe I am saying something wrong because I am not up to speed with all the discussion, but wouldn't be easier to have something like:
or even better:
Slavek wanted those two Python modules renamed to put them in the main Python directory.
Either you rename them, then you load them as:
or you use a subfolder like:
Uhm... as long as my understanding of python goes, the from-import clause work as
So
would look for the sip_trinity_config (renamed as asked by Slavek) and load the sipconfig from there.