|
|
|
@ -30,16 +30,16 @@ import shutil
|
|
|
|
|
import py_compile |
|
|
|
|
|
|
|
|
|
try: |
|
|
|
|
from sip4_tqt import sipconfig |
|
|
|
|
import sip_tqt_config |
|
|
|
|
except: |
|
|
|
|
print ("Can't find sipconfig.py (expected in sys.path)") |
|
|
|
|
print ("Have you built the correct version of sip?") |
|
|
|
|
print ("Can't find sip_tqt_config.py (expected in sys.path)") |
|
|
|
|
print ("Have you built the correct version of sip-tqt?") |
|
|
|
|
sys.exit (-1) |
|
|
|
|
|
|
|
|
|
try: |
|
|
|
|
from python_tqt import pyqtconfig |
|
|
|
|
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__)) |
|
|
|
|
has_objdir = topsrcdir != os.path.abspath(os.path.curdir) |
|
|
|
@ -61,8 +61,8 @@ def srcPath(filename):
|
|
|
|
|
return os.path.join(topsrcdir, filename) |
|
|
|
|
return filename |
|
|
|
|
|
|
|
|
|
# Get the SIP configuration. |
|
|
|
|
sipcfg = sipconfig.Configuration() |
|
|
|
|
# Get the SIP-TQt configuration. |
|
|
|
|
sipcfg = sip_tqt_config.Configuration() |
|
|
|
|
pyqtcfg = pyqtconfig.Configuration () |
|
|
|
|
|
|
|
|
|
# Initialise the globals. |
|
|
|
@ -186,12 +186,12 @@ def check_gcc ():
|
|
|
|
|
|
|
|
|
|
def init_and_check_sanity (): |
|
|
|
|
""" Do some initialization and check various versions and |
|
|
|
|
attributes of sip and PyTQt installations |
|
|
|
|
attributes of sip-tqt and PyTQt installations |
|
|
|
|
""" |
|
|
|
|
|
|
|
|
|
check_gcc () |
|
|
|
|
|
|
|
|
|
# Check SIP is new enough. |
|
|
|
|
# Check SIP-TQt is new enough. |
|
|
|
|
if sipcfg.sip_version_str[:8] != "snapshot": |
|
|
|
|
minv = None |
|
|
|
|
|
|
|
|
@ -199,18 +199,18 @@ def init_and_check_sanity ():
|
|
|
|
|
minv = sip_min_v4_version |
|
|
|
|
|
|
|
|
|
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: |
|
|
|
|
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: |
|
|
|
|
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)) |
|
|
|
|
|
|
|
|
|
# Check PyTQt built with libtqt-mt |
|
|
|
|
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 |
|
|
|
|
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 " -d dir where the PyKDE modules will be installed [default %s]" % opt_pytdemoddir |
|
|
|
|
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 " -j # splits the concatenated C++ source files into # pieces [default 1]" |
|
|
|
|
print " -k dir the KDE base directory" |
|
|
|
@ -256,32 +256,32 @@ def inform_user(stage):
|
|
|
|
|
print " PyKDE version %s" % pytde_version_str |
|
|
|
|
print " -------" |
|
|
|
|
print |
|
|
|
|
sipconfig.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 include directory is %s" % sipcfg.py_inc_dir) |
|
|
|
|
sip_tqt_config.inform ("Python version is %s" % sip_tqt_config.version_to_string (sipcfg.py_version)) |
|
|
|
|
print |
|
|
|
|
sipconfig.inform ("sip version is %s (%s)" % (sipcfg.sip_version_str, |
|
|
|
|
sipconfig.version_to_string (sipcfg.sip_version))) |
|
|
|
|
sip_tqt_config.inform ("sip-tqt version is %s (%s)" % (sipcfg.sip_version_str, |
|
|
|
|
sip_tqt_config.version_to_string (sipcfg.sip_version))) |
|
|
|
|
print |
|
|
|
|
sipconfig.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 directory is %s" % pyqtcfg.qt_dir) |
|
|
|
|
sip_tqt_config.inform ("TQt version is %s" % sip_tqt_config.version_to_string (pyqtcfg.qt_version)) |
|
|
|
|
print |
|
|
|
|
sipconfig.inform ("PyTQt directory is %s" % pyqtcfg.pyqt_sip_dir) |
|
|
|
|
sipconfig.inform ("PyTQt version is %s (%s)" % (pyqtcfg.pyqt_version_str, |
|
|
|
|
sipconfig.version_to_string (pyqtcfg.pyqt_version))) |
|
|
|
|
sip_tqt_config.inform ("PyTQt directory is %s" % pyqtcfg.pyqt_sip_dir) |
|
|
|
|
sip_tqt_config.inform ("PyTQt version is %s (%s)" % (pyqtcfg.pyqt_version_str, |
|
|
|
|
sip_tqt_config.version_to_string (pyqtcfg.pyqt_version))) |
|
|
|
|
print |
|
|
|
|
|
|
|
|
|
elif stage == 1: |
|
|
|
|
sipconfig.inform ("KDE base directory is %s" % opt_tdebasedir) |
|
|
|
|
sipconfig.inform ("KDE include directory is %s" % opt_kdeincdir) |
|
|
|
|
sipconfig.inform ("KDE lib directory is %s" % opt_kdelibdir) |
|
|
|
|
sipconfig.inform ("lib directory is %s" % opt_libdir) |
|
|
|
|
sip_tqt_config.inform ("KDE base directory is %s" % opt_tdebasedir) |
|
|
|
|
sip_tqt_config.inform ("KDE include directory is %s" % opt_kdeincdir) |
|
|
|
|
sip_tqt_config.inform ("KDE lib directory is %s" % opt_kdelibdir) |
|
|
|
|
sip_tqt_config.inform ("lib directory is %s" % opt_libdir) |
|
|
|
|
|
|
|
|
|
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 |
|
|
|
|
|
|
|
|
|
sipconfig.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 modules will be installed in %s" % opt_pytdemoddir) |
|
|
|
|
sip_tqt_config.inform("PyKDE .sip files will be installed in %s" % opt_pytdesipdir) |
|
|
|
|
print |
|
|
|
|
|
|
|
|
|
|
|
|
|
@ -293,7 +293,7 @@ def create_config(module, template):
|
|
|
|
|
module is the module file name. |
|
|
|
|
template is the template file name. |
|
|
|
|
""" |
|
|
|
|
sipconfig.inform("Creating %s..." % module) |
|
|
|
|
sip_tqt_config.inform("Creating %s..." % module) |
|
|
|
|
|
|
|
|
|
content = { |
|
|
|
|
"pytde_version": pytde_version, |
|
|
|
@ -315,7 +315,7 @@ def create_config(module, template):
|
|
|
|
|
"dist_name": opt_dist_name |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
sipconfig.create_config_module(module, template, content) |
|
|
|
|
sip_tqt_config.create_config_module(module, template, content) |
|
|
|
|
|
|
|
|
|
def getKDEVersion (versFile): |
|
|
|
|
if not os.path.isfile (versFile): |
|
|
|
@ -358,7 +358,7 @@ def getKDEVersion (versFile):
|
|
|
|
|
|
|
|
|
|
if kde_version > kde_max_version: |
|
|
|
|
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 |
|
|
|
|
kde_version = kde_max_version |
|
|
|
|
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_extra = string.join (["kde", major, minor, micro], "") |
|
|
|
|
else: |
|
|
|
|
sipconfig.error ("KDE version not found in %s" % versFile) |
|
|
|
|
sip_tqt_config.error ("KDE version not found in %s" % versFile) |
|
|
|
|
|
|
|
|
|
global postProcess |
|
|
|
|
|
|
|
|
@ -423,20 +423,20 @@ def check_kde_installation():
|
|
|
|
|
discoverKDE3 () |
|
|
|
|
|
|
|
|
|
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: |
|
|
|
|
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: |
|
|
|
|
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") |
|
|
|
|
|
|
|
|
|
inform_user (1) |
|
|
|
|
|
|
|
|
|
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. |
|
|
|
|
getKDEVersion(tdeversion_h) |
|
|
|
@ -444,8 +444,8 @@ def check_kde_installation():
|
|
|
|
|
inform_user (2) |
|
|
|
|
|
|
|
|
|
def create_top_level (mname): |
|
|
|
|
""" Create the top level sip file <mname>mod.sip from <mname>mod.sip-in |
|
|
|
|
and add/delete any %Included sip files per the current KDE version |
|
|
|
|
""" Create the top level sip-tqt file <mname>mod.sip from <mname>mod.sip-in |
|
|
|
|
and add/delete any %Included sip-tqt files per the current KDE version |
|
|
|
|
""" |
|
|
|
|
diff = srcPath(os.path.join ("sip", mname, mname + kde_version_sfx)) |
|
|
|
|
plus = [] |
|
|
|
@ -518,7 +518,7 @@ def check_distribution ():
|
|
|
|
|
kde_sip_flags.append ("D_MANDRAKE") |
|
|
|
|
|
|
|
|
|
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 |
|
|
|
|
|
|
|
|
@ -555,7 +555,7 @@ def set_sip_flags():
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
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): |
|
|
|
@ -573,16 +573,16 @@ def generate_code(mname, imports=None, extra_cflags=None, extra_cxxflags=None, e
|
|
|
|
|
directories. |
|
|
|
|
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. |
|
|
|
|
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) |
|
|
|
|
try: |
|
|
|
|
#create_top_level (mname) |
|
|
|
|
pass |
|
|
|
|
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: |
|
|
|
|
shutil.rmtree(mname) |
|
|
|
@ -592,9 +592,9 @@ def generate_code(mname, imports=None, extra_cflags=None, extra_cxxflags=None, e
|
|
|
|
|
try: |
|
|
|
|
os.mkdir(mname) |
|
|
|
|
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.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(subdir) |
|
|
|
|
|
|
|
|
|
# SIP assumes POSIX style path separators. |
|
|
|
|
# SIP-TQt assumes POSIX style path separators. |
|
|
|
|
argv.append(srcPath(string.join(["sip", mname, mname + "mod.sip"], "/"))) |
|
|
|
|
|
|
|
|
|
# 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)) |
|
|
|
|
|
|
|
|
|
# post process the C++ code for TQT_NO_TRANSLATION |
|
|
|
|
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. |
|
|
|
|
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: |
|
|
|
|
postProcess ["tdecore"][-1][-1] = "tdecorecmodule.*" |
|
|
|
|
|
|
|
|
|
# Compile the Python stub. |
|
|
|
|
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")) |
|
|
|
|
elif mname == "tdecore": |
|
|
|
|
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]: |
|
|
|
|
for s in postProcess [mname]: |
|
|
|
|
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. |
|
|
|
|
sipconfig.inform("Creating the Makefile for the %s module..." % mname) |
|
|
|
|
sip_tqt_config.inform("Creating the Makefile for the %s module..." % mname) |
|
|
|
|
|
|
|
|
|
installs = [] |
|
|
|
|
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)]) |
|
|
|
|
|
|
|
|
|
makefile = sipconfig.SIPModuleMakefile( |
|
|
|
|
makefile = sip_tqt_config.SIPModuleMakefile( |
|
|
|
|
configuration = pyqtcfg, |
|
|
|
|
build_file = mname + ".sbf", |
|
|
|
|
dir = mname, |
|
|
|
@ -785,9 +785,9 @@ def create_makefiles():
|
|
|
|
|
""" |
|
|
|
|
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, |
|
|
|
|
subdirs = subdirs, |
|
|
|
|
installs= [("pytdeconfig.py", opt_pytdemoddir), (srcPath("contrib/tdepyuic"), opt_tdebasedir + "/bin")] |
|
|
|
@ -902,7 +902,7 @@ def main(argv):
|
|
|
|
|
inform_user (0) |
|
|
|
|
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: |
|
|
|
|
pytde_modules.remove ("tdemdi") |
|
|
|
|
pytde_modules.remove ("tderesources") |
|
|
|
@ -926,7 +926,7 @@ def main(argv):
|
|
|
|
|
if single: |
|
|
|
|
opt_endmod = opt_startmod + 1 |
|
|
|
|
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]) |
|
|
|
|
|
|
|
|
|