@ -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 t qmake 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 . t qt_inc_dir
sciLibDir = config . t qt_lib_dir
sciLib = None
sciVersion = None
binDir = config . default_bin_dir
modDir = config . default_mod_dir
sipDir = config . default_sip_dir
buildModules = [ " qt" ]
buildModules = [ " t qt" ]
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 t 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-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 . t qt_inc_dir)
print ( " -o dir the directory containing the TQScintilla library [default %s ] " % config . t qt_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
t qttest, 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 ( " t qttest.pro.in" ,
""" TEMPLATE = app
TARGET = qttest
TARGET = t qttest
CONFIG + = console warn_off @TEST_OPENGL @ @BLX_CONFIG_APP @
INCLUDEPATH = @BLX_INCLUDEPATH @ @TEST_ QSCINTILLA_INC@
INCLUDEPATH = @BLX_INCLUDEPATH @ @TEST_ T QSCINTILLA_INC@
DEFINES = @BLX_DEFINES @
SOURCES = qttest. cpp
LIBS + = @TEST_ QUI_LIB@ @TEST_ QSCINTILLA_LIB@
SOURCES = t qttest. cpp
LIBS + = @TEST_ T QUI_LIB@ @TEST_ T QSCINTILLA_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_ T QUI_LIB@" ] = " "
config . patches [ " @TEST_ T QSCINTILLA_INC@" ] = " "
config . patches [ " @TEST_ T QSCINTILLA_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 ( " t qttest.cpp" , " " )
config . create_makefile ( " qttest.pro" )
config . create_makefile ( " t qttest.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 ( " t qttest.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 [ " @PY QT_QSCINTILLA_INC@" ] = sciIncDir
config . patches [ " @PY T QT_T QSCINTILLA_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 [ " @PY QT_QSCINTILLA_LIB@" ] = sciLib
config . patches [ " @PY T QT_T QSCINTILLA_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 t 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 :
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 t qtext 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 , " t qtcanvas" , " t qcanvas.h" , " TQCanvas() " )
tryModule ( maindir , " t qtnetwork" , " t qsocket.h" , " TQSocket() " )
tryModule ( maindir , " t qttable" , " t qtable.h" , " TQTable() " )
tryModule ( maindir , " t qtxml" , " t qdom.h" , " TQDomImplementation() " )
if config . qt_version > = 0x030000 :
tryModule ( maindir , " qtsql" , " qsql.h" , " TQSql() " )
if config . t qt_version > = 0x030000 :
tryModule ( maindir , " t qtsql" , " t qsql.h" , " TQSql() " )
# We need a different Makefile for the qtgl module.
# We need a different Makefile for the t qtgl module.
config . patches [ " @TEST_OPENGL@ " ] = " opengl "
config . create_makefile ( " qttest.pro" )
config . create_makefile ( " t qttest.pro" )
tryModule ( maindir , " qtgl" , " qgl.h" , " TQGLWidget() " )
tryModule ( maindir , " t qtgl" , " t qgl.h" , " TQGLWidget() " )
# Put things back.
config . patches [ " @TEST_OPENGL@ " ] = " "
config . create_makefile ( " qttest.pro" )
config . create_makefile ( " t qttest.pro" )
# Check for the tqui library.
if config . qt_version > = 0x030000 :
if config . t qt_version > = 0x030000 :
if sys . platform == " win32 " :
tquilib = r " $(TQTDIR) \ lib \ tqui.lib "
else :
tquilib = " -ltqui "
config . patches [ " @PY QT_QUI_LIB@" ] = tquilib
config . patches [ " @PY T QT_T QUI_LIB@" ] = tquilib
config . patches [ " @TEST_ QUI_LIB@" ] = tquilib
config . create_makefile ( " qttest.pro" )
config . patches [ " @TEST_ T QUI_LIB@" ] = tquilib
config . create_makefile ( " t qttest.pro" )
tryModule ( maindir , " qtui" , " qwidgetfactory.h" , " TQWidgetFactory() " )
tryModule ( maindir , " t qtui" , " t qwidgetfactory.h" , " TQWidgetFactory() " )
# Put things back.
config . patches [ " @TEST_ QUI_LIB@" ] = " "
config . create_makefile ( " qttest.pro" )
config . patches [ " @TEST_ T QUI_LIB@" ] = " "
config . create_makefile ( " t qttest.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_ T QSCINTILLA_INC@" ] = sciIncDir
config . patches [ " @TEST_ T QSCINTILLA_LIB@" ] = sciLib
config . create_makefile ( " t qttest.pro" )
tryModule ( maindir , " qtext" , " tqextscintillabase.h " , " TQextScintillaBase() " )
tryModule ( maindir , " t qtext" , " tqextscintillabase.h " , " TQextScintillaBase() " )
# Put things back.
config . patches [ " @TEST_ QSCINTILLA_INC@" ] = " "
config . patches [ " @TEST_ QSCINTILLA_LIB@" ] = " "
config . create_makefile ( " qttest.pro" )
config . patches [ " @TEST_ T QSCINTILLA_INC@" ] = " "
config . patches [ " @TEST_ T QSCINTILLA_LIB@" ] = " "
config . create_makefile ( " t qttest.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 ( " t qttest.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 ( t qWinVersion( ) != 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 ( ) , " t qttest" ) )
sip_tqt_config . run_make ( " clean " )
sip_tqt_config . inform ( " Generated the features file. " )
def generateSource ( mname , plattag , qttag, xtrtag ) :
def generateSource ( mname , plattag , t qttag, 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 .
t qttag 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 " , t qttag,
" -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 t qpeTag
t qpeTag = 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 . t qt_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 . t qt_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 [ " @PY QT_MODDIR@" ] = sip_tqt_config . escape ( modDir )
config . patches [ " @PY T QT_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 [ " @PY QT_WARN@" ] = warn
config . patches [ " @PY T QT_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 ) + " -l qtcmodule"
modlink = sip_tqt_config . escape ( " -L " + modDir ) + " -l t qtcmodule"
config . patches [ " @PY QT_QT_MODULE@" ] = modlink
config . patches [ " @PY T QT_T QT_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 ) + " -l qttablecmodule -lqtcmodule"
modlink = sip_tqt_config . escape ( " -L " + modDir ) + " -l t qttablecmodule -lt qtcmodule"
config . patches [ " @PY QT_QTTABLE_MODULE@" ] = modlink
config . patches [ " @PY T QT_T QTTABLE_MODULE@" ] = modlink
# The professional edition needs special handling if XML support is needed.
if config . qt_edition == " professional " :
if config . t qt_edition == " professional " :
rbprof = " rbprof "
else :
rbprof = " "
config . patches [ " @PY QT_RBPROF@" ] = rbprof
config . patches [ " @PY T QT_RBPROF@" ] = rbprof
# Link in the qassistantclient library for TQt v3.1+.
qaclib = " "
t qaclib = " "
if config . qt_version > = 0x030100 :
if config . t qt_version > = 0x030100 :
if sys . platform == " win32 " :
qaclib = r " $(TQTDIR) \ lib \ qassistantclient.lib"
t qaclib = r " $(TQTDIR) \ lib \ t qassistantclient.lib"
else :
qaclib = " -l qassistantclient"
t qaclib = " -l t qassistantclient"
config . patches [ " @PY QT_QASSISTANTCLIENT_LIB@" ] = qaclib
config . patches [ " @PY T QT_QASSISTANTCLIENT_LIB@" ] = t qaclib
# Check for TQScintilla.
if config . qt_version > = 0x030000 :
if config . t qt_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 . t qt_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 . t qt_lib == " t qte" :
plattag = " WS_QWS "
elif sys . platform == " win32 " :
plattag = " WS_WIN "
@ -606,7 +606,7 @@ def main(argv):
else :
plattag = " WS_X11 "
qttags = {
t qttags = {
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 " )
t qttag = versionToTag ( config . t qt_version, t qttags, " 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 == " t qtext" :
xtratag = scitag
else :
xtratag = None
generateSource ( mname , plattag , qttag, xtratag )
generateSource ( mname , plattag , t qttag, xtratag )
subdirs . append ( mname )
# We handle the qtpe module explicitly rather than auto-detect. This is
# We handle the t qtpe 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 t qpeTag:
generateSource ( " t qtpe" , plattag , t qttag, t qpeTag)
subdirs . append ( " t qtpe" )
# 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 [ " @PY QT_BINDIR@" ] = sip_tqt_config . escape ( binDir )
config . patches [ " @PY T QT_BINDIR@" ] = sip_tqt_config . escape ( binDir )
if config . qt_version > = 0x030000 :
sip_tqt_config . inform ( " Creating Makefile for py uic3." )
subdirs . append ( " py uic3" )
olddir = sip_tqt_config . push_dir ( " py uic3" )
if config . t qt_version > = 0x030000 :
sip_tqt_config . inform ( " Creating Makefile for py tq uic3." )
subdirs . append ( " py tq uic3" )
olddir = sip_tqt_config . push_dir ( " py tq uic3" )
config . create_makefile ( " py uic.pro" , [ ] )
config . create_makefile ( " py tq uic.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 py lupdate3." )
subdirs . append ( " py lupdate3" )
olddir = sip_tqt_config . push_dir ( " py lupdate3" )
if config . t qt_version > = 0x030000 :
sip_tqt_config . inform ( " Creating Makefile for py tq lupdate3." )
subdirs . append ( " py tq lupdate3" )
olddir = sip_tqt_config . push_dir ( " py tq lupdate3" )
config . create_makefile ( " py lupdate.pro" , [ ] )
config . create_makefile ( " py tq lupdate.pro" , [ ] )
sip_tqt_config . pop_dir ( olddir )
# Generate the top-level Makefile.