Update for renamed sip_tqt_config.

Signed-off-by: Slávek Banko <slavek.banko@axis.cz>
pull/2/head
Slávek Banko 2 years ago
parent 5aaf249441
commit 49d458e2f6
No known key found for this signature in database
GPG Key ID: 608F5293A04BE668

@ -30,16 +30,16 @@ import shutil
import py_compile import py_compile
try: try:
from sip4_tqt import sipconfig import sip_tqt_config
except: except:
print ("Can't find sipconfig.py (expected in sys.path)") print ("Can't find sip_tqt_config.py (expected in sys.path)")
print ("Have you built the correct version of sip?") print ("Have you built the correct version of sip-tqt?")
sys.exit (-1) sys.exit (-1)
try: try:
from python_tqt import pyqtconfig from python_tqt import pyqtconfig
except: except:
sipconfig.error ("Can't find pyqtconfig.py in sys.path - exiting") sip_tqt_config.error ("Can't find pyqtconfig.py in sys.path - exiting")
topsrcdir = os.path.dirname(os.path.abspath(__file__)) topsrcdir = os.path.dirname(os.path.abspath(__file__))
has_objdir = topsrcdir != os.path.abspath(os.path.curdir) has_objdir = topsrcdir != os.path.abspath(os.path.curdir)
@ -61,8 +61,8 @@ def srcPath(filename):
return os.path.join(topsrcdir, filename) return os.path.join(topsrcdir, filename)
return filename return filename
# Get the SIP configuration. # Get the SIP-TQt configuration.
sipcfg = sipconfig.Configuration() sipcfg = sip_tqt_config.Configuration()
pyqtcfg = pyqtconfig.Configuration () pyqtcfg = pyqtconfig.Configuration ()
# Initialise the globals. # Initialise the globals.
@ -186,12 +186,12 @@ def check_gcc ():
def init_and_check_sanity (): def init_and_check_sanity ():
""" Do some initialization and check various versions and """ Do some initialization and check various versions and
attributes of sip and PyTQt installations attributes of sip-tqt and PyTQt installations
""" """
check_gcc () check_gcc ()
# Check SIP is new enough. # Check SIP-TQt is new enough.
if sipcfg.sip_version_str[:8] != "snapshot": if sipcfg.sip_version_str[:8] != "snapshot":
minv = None minv = None
@ -199,18 +199,18 @@ def init_and_check_sanity ():
minv = sip_min_v4_version minv = sip_min_v4_version
if minv: if minv:
sipcfg.error("This version of PyKDE requires SIP v%s or later" % sipcfg.version_to_string(minv)) sipcfg.error("This version of PyKDE requires SIP-TQt v%s or later" % sipcfg.version_to_string(minv))
# Check SIP has TQt support enabled and check version # Check SIP-TQt has TQt support enabled and check version
if pyqtcfg.qt_version == 0: if pyqtcfg.qt_version == 0:
sipconfig.error("SIP has been built with TQt support disabled.") sip_tqt_config.error("SIP-TQt has been built with TQt support disabled.")
if pyqtcfg.qt_version < qt_min_version: if pyqtcfg.qt_version < qt_min_version:
sipconfig.error("SIP has been built with an unsupported TQt version (%s)"\ sip_tqt_config.error("SIP-TQt has been built with an unsupported TQt version (%s)"\
% sipcfg.version_to_string (sipcfg.qt_version)) % sipcfg.version_to_string (sipcfg.qt_version))
# Check PyTQt built with libtqt-mt # Check PyTQt built with libtqt-mt
if pyqtcfg.qt_threaded == 0: if pyqtcfg.qt_threaded == 0:
sipconfig.error ("PyKDE requires a threaded TQt version (libtqt-mt)") sip_tqt_config.error ("PyKDE requires a threaded TQt version (libtqt-mt)")
# Check PyTQt version # Check PyTQt version
if pyqtcfg.pyqt_version < pyqt_min_version: if pyqtcfg.pyqt_version < pyqt_min_version:
@ -232,7 +232,7 @@ def usage(rcode = 2):
print " -c concatenates each module's C/C++ source files [default]" print " -c concatenates each module's C/C++ source files [default]"
print " -d dir where the PyKDE modules will be installed [default %s]" % opt_pytdemoddir print " -d dir where the PyKDE modules will be installed [default %s]" % opt_pytdemoddir
print " -e lib explicitly specify the python library" print " -e lib explicitly specify the python library"
print " -g always release the GIL (SIP v3.x behaviour)" print " -g always release the GIL (SIP-TQt v3.x behaviour)"
print " -i no concatenation of each module's C/C++ source files" print " -i no concatenation of each module's C/C++ source files"
print " -j # splits the concatenated C++ source files into # pieces [default 1]" print " -j # splits the concatenated C++ source files into # pieces [default 1]"
print " -k dir the KDE base directory" print " -k dir the KDE base directory"
@ -256,32 +256,32 @@ def inform_user(stage):
print " PyKDE version %s" % pytde_version_str print " PyKDE version %s" % pytde_version_str
print " -------" print " -------"
print print
sipconfig.inform ("Python include directory is %s" % sipcfg.py_inc_dir) sip_tqt_config.inform ("Python include directory is %s" % sipcfg.py_inc_dir)
sipconfig.inform ("Python version is %s" % sipconfig.version_to_string (sipcfg.py_version)) sip_tqt_config.inform ("Python version is %s" % sip_tqt_config.version_to_string (sipcfg.py_version))
print print
sipconfig.inform ("sip version is %s (%s)" % (sipcfg.sip_version_str, sip_tqt_config.inform ("sip-tqt version is %s (%s)" % (sipcfg.sip_version_str,
sipconfig.version_to_string (sipcfg.sip_version))) sip_tqt_config.version_to_string (sipcfg.sip_version)))
print print
sipconfig.inform ("TQt directory is %s" % pyqtcfg.qt_dir) sip_tqt_config.inform ("TQt directory is %s" % pyqtcfg.qt_dir)
sipconfig.inform ("TQt version is %s" % sipconfig.version_to_string (pyqtcfg.qt_version)) sip_tqt_config.inform ("TQt version is %s" % sip_tqt_config.version_to_string (pyqtcfg.qt_version))
print print
sipconfig.inform ("PyTQt directory is %s" % pyqtcfg.pyqt_sip_dir) sip_tqt_config.inform ("PyTQt directory is %s" % pyqtcfg.pyqt_sip_dir)
sipconfig.inform ("PyTQt version is %s (%s)" % (pyqtcfg.pyqt_version_str, sip_tqt_config.inform ("PyTQt version is %s (%s)" % (pyqtcfg.pyqt_version_str,
sipconfig.version_to_string (pyqtcfg.pyqt_version))) sip_tqt_config.version_to_string (pyqtcfg.pyqt_version)))
print print
elif stage == 1: elif stage == 1:
sipconfig.inform ("KDE base directory is %s" % opt_tdebasedir) sip_tqt_config.inform ("KDE base directory is %s" % opt_tdebasedir)
sipconfig.inform ("KDE include directory is %s" % opt_kdeincdir) sip_tqt_config.inform ("KDE include directory is %s" % opt_kdeincdir)
sipconfig.inform ("KDE lib directory is %s" % opt_kdelibdir) sip_tqt_config.inform ("KDE lib directory is %s" % opt_kdelibdir)
sipconfig.inform ("lib directory is %s" % opt_libdir) sip_tqt_config.inform ("lib directory is %s" % opt_libdir)
elif stage == 2: elif stage == 2:
sipconfig.inform ("KDE version is %s (0x%x)" % (kde_version_str, kde_version)) sip_tqt_config.inform ("KDE version is %s (0x%x)" % (kde_version_str, kde_version))
print print
sipconfig.inform("PyKDE modules will be installed in %s" % opt_pytdemoddir) sip_tqt_config.inform("PyKDE modules will be installed in %s" % opt_pytdemoddir)
sipconfig.inform("PyKDE .sip files will be installed in %s" % opt_pytdesipdir) sip_tqt_config.inform("PyKDE .sip files will be installed in %s" % opt_pytdesipdir)
print print
@ -293,7 +293,7 @@ def create_config(module, template):
module is the module file name. module is the module file name.
template is the template file name. template is the template file name.
""" """
sipconfig.inform("Creating %s..." % module) sip_tqt_config.inform("Creating %s..." % module)
content = { content = {
"pytde_version": pytde_version, "pytde_version": pytde_version,
@ -315,7 +315,7 @@ def create_config(module, template):
"dist_name": opt_dist_name "dist_name": opt_dist_name
} }
sipconfig.create_config_module(module, template, content) sip_tqt_config.create_config_module(module, template, content)
def getKDEVersion (versFile): def getKDEVersion (versFile):
if not os.path.isfile (versFile): if not os.path.isfile (versFile):
@ -358,7 +358,7 @@ def getKDEVersion (versFile):
if kde_version > kde_max_version: if kde_version > kde_max_version:
print print
sipconfig.inform ("*** True KDE version is %s -- building for KDE %s ***" % (hex (kde_version), hex (kde_max_version))) sip_tqt_config.inform ("*** True KDE version is %s -- building for KDE %s ***" % (hex (kde_version), hex (kde_max_version)))
print print
kde_version = kde_max_version kde_version = kde_max_version
major = hex ((kde_version & 0xff0000) >> 16) [ 2:] major = hex ((kde_version & 0xff0000) >> 16) [ 2:]
@ -370,7 +370,7 @@ def getKDEVersion (versFile):
kde_version_sfx = string.join (["-kde", major, minor, micro, ".diff"], "") kde_version_sfx = string.join (["-kde", major, minor, micro, ".diff"], "")
kde_version_extra = string.join (["kde", major, minor, micro], "") kde_version_extra = string.join (["kde", major, minor, micro], "")
else: else:
sipconfig.error ("KDE version not found in %s" % versFile) sip_tqt_config.error ("KDE version not found in %s" % versFile)
global postProcess global postProcess
@ -423,20 +423,20 @@ def check_kde_installation():
discoverKDE3 () discoverKDE3 ()
if not opt_tdebasedir: if not opt_tdebasedir:
sipconfig.error ("Couldn't locate KDE3 base directory") sip_tqt_config.error ("Couldn't locate KDE3 base directory")
if not opt_kdeincdir: if not opt_kdeincdir:
sipconfig.error ("Couldn't locate KDE3 include directory (%s is KDE base)" % opt_tdebasedir) sip_tqt_config.error ("Couldn't locate KDE3 include directory (%s is KDE base)" % opt_tdebasedir)
if not opt_kdelibdir: if not opt_kdelibdir:
sipconfig.error ("Couldn't locate KDE3 lib directory (%s is KDE base)" % opt_tdebasedir) sip_tqt_config.error ("Couldn't locate KDE3 lib directory (%s is KDE base)" % opt_tdebasedir)
tdeversion_h = os.path.join(opt_kdeincdir, "tdeversion.h") tdeversion_h = os.path.join(opt_kdeincdir, "tdeversion.h")
inform_user (1) inform_user (1)
if not os.access(tdeversion_h, os.F_OK): if not os.access(tdeversion_h, os.F_OK):
sipconfig.error("tdeversion.h could not be found in %s." % opt_kdeincdir) sip_tqt_config.error("tdeversion.h could not be found in %s." % opt_kdeincdir)
# Get the KDE version number. # Get the KDE version number.
getKDEVersion(tdeversion_h) getKDEVersion(tdeversion_h)
@ -444,8 +444,8 @@ def check_kde_installation():
inform_user (2) inform_user (2)
def create_top_level (mname): def create_top_level (mname):
""" Create the top level sip file <mname>mod.sip from <mname>mod.sip-in """ Create the top level sip-tqt file <mname>mod.sip from <mname>mod.sip-in
and add/delete any %Included sip files per the current KDE version and add/delete any %Included sip-tqt files per the current KDE version
""" """
diff = srcPath(os.path.join ("sip", mname, mname + kde_version_sfx)) diff = srcPath(os.path.join ("sip", mname, mname + kde_version_sfx))
plus = [] plus = []
@ -518,7 +518,7 @@ def check_distribution ():
kde_sip_flags.append ("D_MANDRAKE") kde_sip_flags.append ("D_MANDRAKE")
def set_sip_flags(): def set_sip_flags():
"""Set the SIP platform, version and feature flags. """Set the SIP-TQt platform, version and feature flags.
""" """
global kde_sip_flags global kde_sip_flags
@ -555,7 +555,7 @@ def set_sip_flags():
} }
kde_sip_flags.append("-t") kde_sip_flags.append("-t")
kde_sip_flags.append(sipconfig.version_to_sip_tag(kde_version, kdetags, "KDE")) kde_sip_flags.append(sip_tqt_config.version_to_sip_tag(kde_version, kdetags, "KDE"))
def generate_code(mname, imports=None, extra_cflags=None, extra_cxxflags=None, extra_define=None, extra_include_dir=None, extra_lflags=None, extra_lib_dir=None, extra_lib=None, extra_libs=None, opengl=0, sip_flags=None): def generate_code(mname, imports=None, extra_cflags=None, extra_cxxflags=None, extra_define=None, extra_include_dir=None, extra_lflags=None, extra_lib_dir=None, extra_lib=None, extra_libs=None, opengl=0, sip_flags=None):
@ -573,16 +573,16 @@ def generate_code(mname, imports=None, extra_cflags=None, extra_cxxflags=None, e
directories. directories.
extra_lib is the name of an extra library to add to the list of libraries. extra_lib is the name of an extra library to add to the list of libraries.
opengl is set if the module needs OpenGL support. 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)
create_top_level (mname) create_top_level (mname)
try: try:
#create_top_level (mname) #create_top_level (mname)
pass pass
except: except:
sipconfig.error ("Couldn't create top level sip file for %s" % mname) sip_tqt_config.error ("Couldn't create top level sip-tqt file for %s" % mname)
try: try:
shutil.rmtree(mname) shutil.rmtree(mname)
@ -592,9 +592,9 @@ def generate_code(mname, imports=None, extra_cflags=None, extra_cxxflags=None, e
try: try:
os.mkdir(mname) os.mkdir(mname)
except: 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] argv = [sipcfg.sip_bin]
argv.extend(kde_sip_flags) argv.extend(kde_sip_flags)
@ -634,27 +634,27 @@ def generate_code(mname, imports=None, extra_cflags=None, extra_cxxflags=None, e
argv.append("-I") argv.append("-I")
argv.append(subdir) argv.append(subdir)
# SIP assumes POSIX style path separators. # SIP-TQt assumes POSIX style path separators.
argv.append(srcPath(string.join(["sip", mname, mname + "mod.sip"], "/"))) argv.append(srcPath(string.join(["sip", mname, mname + "mod.sip"], "/")))
# print string.join (argv) # print string.join (argv)
# finally, run SIP and generate the C++ code # finally, run SIP-TQt and generate the C++ code
os.system (string.join(argv)) os.system (string.join(argv))
# post process the C++ code for TQT_NO_TRANSLATION # post process the C++ code for TQT_NO_TRANSLATION
if os.system (string.join ([sys.executable, srcPath("postproc")] + ['-p', mname, "-o", "tr", "*.cpp"])) != 0: if os.system (string.join ([sys.executable, srcPath("postproc")] + ['-p', mname, "-o", "tr", "*.cpp"])) != 0:
sipconfig.error ("Post processing of C++ code failed %s (tr)" % mname) sip_tqt_config.error ("Post processing of C++ code failed %s (tr)" % mname)
# Check the result. # Check the result.
if not os.access(buildfile, os.F_OK): 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.")
if mname == "tdecore" and not opt_concat: if mname == "tdecore" and not opt_concat:
postProcess ["tdecore"][-1][-1] = "tdecorecmodule.*" postProcess ["tdecore"][-1][-1] = "tdecorecmodule.*"
# Compile the Python stub. # Compile the Python stub.
if sipcfg.sip_version < 0x040000: if sipcfg.sip_version < 0x040000:
sipconfig.inform("Compiling %s.py..." % mname) sip_tqt_config.inform("Compiling %s.py..." % mname)
py_compile.compile(os.path.join(mname, mname + ".py"), os.path.join(mname, mname + ".pyc")) py_compile.compile(os.path.join(mname, mname + ".py"), os.path.join(mname, mname + ".pyc"))
elif mname == "tdecore": elif mname == "tdecore":
postProcess ["tdecore"][-1][-1] = "sip" + postProcess ["tdecore"][-1][-1] postProcess ["tdecore"][-1][-1] = "sip" + postProcess ["tdecore"][-1][-1]
@ -663,10 +663,10 @@ def generate_code(mname, imports=None, extra_cflags=None, extra_cxxflags=None, e
if postProcess [mname]: if postProcess [mname]:
for s in postProcess [mname]: for s in postProcess [mname]:
if os.system (string.join ([sys.executable, srcPath("postproc")] + s)) != 0: if os.system (string.join ([sys.executable, srcPath("postproc")] + s)) != 0:
sipconfig.error ("Post processing of C++ code failed %s (%s)" % (mname, s [3])) sip_tqt_config.error ("Post processing of C++ code failed %s (%s)" % (mname, s [3]))
# Generate the Makefile. # 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 = [] installs = []
if mname == "dcop": if mname == "dcop":
@ -697,7 +697,7 @@ def generate_code(mname, imports=None, extra_cflags=None, extra_cxxflags=None, e
installs.append([sipfiles, os.path.join(opt_pytdesipdir, mname)]) installs.append([sipfiles, os.path.join(opt_pytdesipdir, mname)])
makefile = sipconfig.SIPModuleMakefile( makefile = sip_tqt_config.SIPModuleMakefile(
configuration = pyqtcfg, configuration = pyqtcfg,
build_file = mname + ".sbf", build_file = mname + ".sbf",
dir = mname, dir = mname,
@ -785,9 +785,9 @@ def create_makefiles():
""" """
subdirs = pytde_modules[:] subdirs = pytde_modules[:]
sipconfig.inform("Creating top level Makefile...") sip_tqt_config.inform("Creating top level Makefile...")
sipconfig.ParentMakefile( sip_tqt_config.ParentMakefile(
configuration = pyqtcfg, configuration = pyqtcfg,
subdirs = subdirs, subdirs = subdirs,
installs= [("pytdeconfig.py", opt_pytdemoddir), (srcPath("contrib/tdepyuic"), opt_tdebasedir + "/bin")] installs= [("pytdeconfig.py", opt_pytdemoddir), (srcPath("contrib/tdepyuic"), opt_tdebasedir + "/bin")]
@ -902,7 +902,7 @@ def main(argv):
inform_user (0) inform_user (0)
init_and_check_sanity () init_and_check_sanity ()
# Set the SIP platform, version and feature flags. # Set the SIP-TQt platform, version and feature flags.
if kde_version < 0x030200: if kde_version < 0x030200:
pytde_modules.remove ("tdemdi") pytde_modules.remove ("tdemdi")
pytde_modules.remove ("tderesources") pytde_modules.remove ("tderesources")
@ -926,7 +926,7 @@ def main(argv):
if single: if single:
opt_endmod = opt_startmod + 1 opt_endmod = opt_startmod + 1
except: except:
sipconfig.error ("%s is not a PyKDE module" % opt_startModName) sip_tqt_config.error ("%s is not a PyKDE module" % opt_startModName)
print "PyKDE modules to be built:\n %s\n" % string.join(pytde_modules [opt_startmod:opt_endmod]) print "PyKDE modules to be built:\n %s\n" % string.join(pytde_modules [opt_startmod:opt_endmod])

@ -22,7 +22,7 @@
# modules that %Import PyKDE modules. # modules that %Import PyKDE modules.
from sip4_tqt import sipconfig import sip_tqt_config
from python_tqt import pyqtconfig from python_tqt import pyqtconfig
@ -40,7 +40,7 @@ _pkg_config = {
'pytde_kde_sip_flags': '-t ALL -x TQt_STYLE_WINDOWSXP -x TQt_STYLE_INTERLACE -x TQt_STYLE_WINDOWSXP -x TQt_SIP_PRE_4_7_2 -x VendorID -t WS_X11 -t TQt_3_3_6 -t KDE_3_5_3', 'pytde_kde_sip_flags': '-t ALL -x TQt_STYLE_WINDOWSXP -x TQt_STYLE_INTERLACE -x TQt_STYLE_WINDOWSXP -x TQt_SIP_PRE_4_7_2 -x VendorID -t WS_X11 -t TQt_3_3_6 -t KDE_3_5_3',
'pytde_mod_dir': '/usr/lib/python2.5/site-packages', 'pytde_mod_dir': '/usr/lib/python2.5/site-packages',
'pytde_modules': 'dcop tdecore tdefx tdeui tdeio tderesources tdeabc tdeutils tdefile tdeparts tdehtml tdespell tdeprint tdemdi', 'pytde_modules': 'dcop tdecore tdefx tdeui tdeio tderesources tdeabc tdeutils tdefile tdeparts tdehtml tdespell tdeprint tdemdi',
'pytde_sip_dir': '/usr/share/sip', 'pytde_sip_dir': '/usr/share/sip-tqt',
'pytde_version': 0x031000, 'pytde_version': 0x031000,
'pytde_version_str': '3.16.0' 'pytde_version_str': '3.16.0'
} }

@ -22,7 +22,7 @@
# modules that %Import PyKDE modules. # modules that %Import PyKDE modules.
from sip4_tqt import sipconfig import sip_tqt_config
from python_tqt import pyqtconfig from python_tqt import pyqtconfig

Loading…
Cancel
Save