[prev in list] [next in list] [prev in thread] [next in thread] 

List:       pykde
Subject:    Re: [PyKDE] Unable to build PyKDE-3.7-4 on rh9/kde-3.1.3
From:       Hans-Peter Jansen <hpj () urpla ! net>
Date:       2003-08-18 19:03:01
[Download RAW message or body]

On Monday 18 August 2003 17:35, Rex Dieter wrote:
> Now, my next one, the current version of PyKDE (3.7-4) refuses to
> build with the current version of sip (3.8).
>
> I guess I'll have to downgrade (for now).

...or try the attached patch with -u none option. It's a bit evolved
since 3.7-4 release due to successful cooperation with Jim.

Jim, I've twiddled the strict* processing a bit to get it to work
correctly. Will send you a full version in a few minutes.

The option typo was my fault. Sorry. Should be corrected, too.

Please let us know, if it works for you.

Cheers,
Pete
["PyKDE-3.7-4-build.diff" (text/x-diff)]

--- build.py.orig	2003-08-18 19:53:57.000000000 +0200
+++ build.py	2003-08-18 20:52:37.000000000 +0200
@@ -1,11 +1,45 @@
-# Copyright (c) 2002  Riverbank Computing Limited <info@riverbankcomputing.co.uk>
-# Copyright (c) 2002  Jim Bublitz <jbublitz@nwinternet.com>
+#! /usr/bin/env python
+"""
+PyKDE %(Version)s build script
+
+Usage:
+    %(progName)s [-h]
+    %(progName)s [options]
+
+where:
+    -h             display this help message
+
+options:
+    -c+            concatenate each module's C++ source files [default: use -c- to disable]
+    -d dir         where PyKDE will be installed [default %(platPySiteDir)s]
+    -e dir         the directory containing the SIP header files [default %(sipIncDir)s]
+    -g prog        the name of the Makefile generator"
+    -i dir         the directory containing the Qt header files [default \
%(platQTDIRName)s/include] +    -j #           split the concatenated C++ source files into # \
pieces [default %(catSplit)s] +    -k dir         the KDE base directory [default \
%(platKDEDIRName)s] +    -l Qt-library  explicitly specify the type of Qt library (only qt-mt \
will work with PyKDE/KDE3) +    -m prog        the name of the Make program [default \
%(platMake)s] +    -n dir         the directory containing the KDE header files [default \
%(platKDEDIRName)s/include] +    -o dir         the directory containing the KDE lib files \
[default %(platKDEDIRName)s/lib] +    -p dir         the name of the SIP code generator \
[default sip] +    -q dir         the Qt base directory [default %(platQTDIRName)s]
+    -r dir         the directory containing the Qt library [default %(platQTDIRName)s/lib]
+    -s dir         the directory containing the SIP module
+    -t dir         the directory containing the Python library directories [default \
%(platPyLibDir)s] +    -u value       version checking on for PyQt and sip [all}, off for sip \
[nosip], or none [none] (default all) +    -v dir         the directory containing the PyQt sip \
files +    -z file        the name of a file containing command line flags
+"""
+
+# Copyright (c) 2002       Riverbank Computing Limited <info@riverbankcomputing.co.uk>
+# Copyright (c) 2002-2003  Jim Bublitz <jbublitz@nwinternet.com>
 
 # This is the build script for PyKDE.  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
-# generating the platform specific Makefiles.
+# it is being built.  It uses qmake to do the hard work of generating the
+# platform specific Makefiles.
 
+# Some cleanups and additions has been made in 2003 by Hans-Peter Jansen <hpj@urpla.net>
 
 import sys
 import os
@@ -27,6 +61,9 @@
 PyKDE mailing list: <pykde@mats.imk.fraunhofer.de>. Thanks.
 """
 
+FALSE      = 0
+TRUE       = not FALSE
+
 # Define the globals.
 progName        = None
 qtDir           = None
@@ -60,6 +97,7 @@
 sipBin          = None
 
 modDir          = None
+pyqtModDir      = None
 libDir          = "libs"
 pyFullVers      = None
 makefileGen     = None
@@ -71,16 +109,17 @@
 catCppFiles     = 1
 catSplit        = 1
 nrThreads       = 0
+strict          = TRUE
+strictSip       = TRUE
 
-FALSE      = 0
-TRUE       = not FALSE
 
 # QtVers must match qttags
 QtVers     = ["300", "301", "302", "304", "305", "306", "310", "311", "312", "320"]
 KDEVers    = ["300", "301", "303", "310", "311", "312", "313"]
 
 modList    = {}
-modList ["30"] = ["dcop", "kdecore", "kdesu", "kdefx", "kdeui", "kio", "kfile", "kparts", \
"khtml", "kjs", "kspell", "kdeprint"] +modList ["30"] = ["dcop", "kdecore", "kdesu", "kdefx", \
"kdeui", "kio", "kfile", +                  "kparts", "khtml", "kjs", "kspell", "kdeprint"]
 modList ["31"] = modList ["30"]
 
 # Want this global so it's testable by external program
@@ -109,32 +148,7 @@
 
     rcode is the return code passed back to the calling process.
     """
-    print "Usage:"
-    print "    %s [-h] " % (progName)
-    print "    %s [options]\n" % (progName)
-    print "where:"
-    print "    -h             display this help message\n"
-
-    print "  options:\n"
-    print "    -c+            concatenate each module's C++ source files (default - use -c- to \
                disable)"
-    print "    -d dir         where PyKDE will be installed [default %s]" % (platPySiteDir)
-    print "    -e dir         the directory containing the SIP header files [default %s]" % \
                (sipIncDir)
-    print "    -g prog        the name of the Makefile generator"
-    print "    -i dir         the directory containing the Qt header files [default \
                %s%sinclude]" % (platQTDIRName,os.sep)
-    print "    -j #           split the concatenated C++ source files into # pieces [default \
                1]"
-    print "    -k dir         the KDE base directory [default %s]" % (platKDEDIRName)
-    print "    -l Qt-library  explicitly specify the type of Qt library (only qt-mt will work \
                with PyKDE/KDE3)"
-    print "    -m prog        the name of the Make program [default %s]" % (platMake)
-    print "    -n dir         the directory containing the KDE header files [default \
                %s/include]" % (platKDEDIRName)
-    print "    -o dir         the directory containing the KDE lib files [default %s/lib]" % \
                (platKDEDIRName)
-    print "    -p dir         the name of the SIP code generator [default sip]"
-    print "    -q dir         the Qt base directory [default %s]" % (platQTDIRName)
-    print "    -r dir         the directory containing the Qt library [default %s%slib]" % \
                (platQTDIRName,os.sep)
-    print "    -s dir         the directory containing the SIP module"
-    print "    -t dir         the directory containing the Python library directories [default \
                %s]\n" % (platPyLibDir)
-    print "    -v dir         the directory containing the PyQt sip files [default %s]" % \
                (pyQtSipDir)
-    print "    -z file        the name of a file containing command line flags"
-
+    print __doc__ % globals()
     sys.exit(rcode)
 
 
@@ -194,8 +208,10 @@
 
 
 def makeVersion (s, v):
-        ver = s + '_' + v [0] + '_' + v [1] + '_' + v [2]
-        return ver
+    """Create a version string from a (major, minor, rev) sequence
+    """
+    ver = s + '_' + v [0] + '_' + v [1] + '_' + v [2]
+    return ver
 
 
 def initGlobals():
@@ -545,7 +561,7 @@
             os.environ["KDEDIR"] = kdeDir
 
     if not kdeIncDir:
-        error("Please set the name of the KDE include directory, either by using the -t \
argument or setting the KDEDIR environment variable") +        error("Please set the name of \
the KDE include directory, either by using the -n argument or setting the KDEDIR environment \
variable")  
     # For lib template project files.
     makefilePatches["KDEDIR_LIB"] = [re.compile("(^CC)",re.M), "KDEDIR    = " + kdeDir + \
"\n\\1"] @@ -608,7 +624,7 @@
         kdeVersion = int (major + minor + rel)
 
     else:
-        error("kdeversion.h could not be found in %s. Use the -i argument to explicitly \
specify the correct directory" % (kdeincdir)) +        error("kdeversion.h could not be found \
in %s. Use the -n argument to explicitly specify the correct directory" % (kdeincdir))  
     kv = str (kdeVersion)
     if not kv in KDEVers:
@@ -655,8 +671,7 @@
 
 
 def checkThreading ():
-    qtmodlib = platPySiteDir + '/libqtcmodule.so'
-    os.system ('ldd %s > lddtmp' % (qtmodlib))
+    os.system ('ldd %s > lddtmp' % (os.path.join (pyqtModDir, "libqtcmodule.so")))
     f = open ('lddtmp', 'r')
 
     if re.search (re.compile("libqt-mt\.so" ,re.M), f.read ()) is None:
@@ -723,8 +738,10 @@
 
         if pyqtv == Release:
             inform ("PyQt version is compatible with PyKDE-%s" % Release)
-        else:
+        elif strict:
             error ("PyQt %s is not compativle with PyKDE %s" % (pyqtv, Release))
+        else:
+            inform ("*** WARNING *** PyQt %s may not be compatible with PyKDE-%s" % \
(PYQT_VERSION, Release))  
         pyqt = 'PyQt-x11-gpl-' + str (PYQT_VERSION_STR)
 
@@ -779,13 +796,15 @@
             vs    = string.strip (string.split (line, "=") [1])
             pyqtv = hexVersionToString (vs)
             if pyqtv == Release:
-                inform ("PyQt sip file version is compatible with PyKDE (%s)" % (Release))
+                inform ("PyQt sip file version is compatible with PyKDE-%s" % (Release))
                 return
+            elif strict:
+                error ("PyQt %s sip files not compatible with PyKDE-%s" % (pyqtv, Release))
             else:
-                error ("PyQt %s sip files not compatible with PyKDE %s" % (pyqtv, Release))
+                inform ("*** WARNING *** PyQt sip file version %s may not be compatible with \
PyKDE-%s" % (pyqtv, Release)) +            return
 
-    else:
-        error ("Unable to detrermine PyQt sip file version")
+    error ("Unable to determine PyQt sip file version")
 
 
 def checkSipVersion ():
@@ -808,13 +827,37 @@
         sipv = buff [0:3]
 
     if sipv != Release:
-        from qt import PYQT_VERSION_STR
-        if string.find (buff, PYQT_VERSION_STR) != 0:
-            error ("sip version %s not compatible with PyKDE %s" % (sipv, Release))
+        if strictSip:
+            error ("sip version %s not compatible with PyKDE-%s" % (sipv, Release))
+        else:
+            inform ("*** WARNING *** sip version %s may not be compatible with PyKDE-%s" % \
(sipv, Release)) +        return
 
     inform ("sip version is compatible with PyKDE-%s" % (Release))
 
 
+def searchDirectory (path, prog):
+    return os.access (os.path.join (path,prog), os.F_OK)
+
+def findPyQtModules ():
+    """
+    Find the PyQt modules directory
+    """
+    global pyqtModDir
+
+    flist = sys.path
+    if platPySiteDir in flist:
+        flist.remove (platPySiteDir)
+    flist.insert (0, platPySiteDir)
+
+    for f in flist:
+        if searchDirectory (f, "libqtcmodule.so"):
+            pyqtModDir = f
+            inform ("libqtcmodule.so found in %s" % (pyqtModDir))
+            return
+
+    error ("Unable to locate %" % pyqtModDir)
+
 def installChecks():
     """Carry out basic checks about the installation.
     """
@@ -880,7 +923,17 @@
     if sipModuleDir is None:
         error("The SIP module/library could not be found. Use the -s argument to set the \
correct directory")  
-    proPatches["LIBS"] = [re.compile("@BL_SIPMODDIR@",re.M), "%s -L %s" % (os.path.join ("..", \
libDir), sipModuleDir)] +    findPyQtModules ()
+
+    ld = os.path.join ("..", libDir)
+
+    if pyqtModDir == platPySiteDir:
+        linkPath = "%s -L %s" % (ld, sipModuleDir)
+    else:
+        linkPath = "%s -L %s -L%s" % (ld, sipModuleDir, pyqtModDir)
+
+    #proPatches["LIBS"] = [re.compile("@BL_SIPMODDIR@",re.M), linkPath]
+    proPatches["LIBS"] = [re.compile("@BL_LINKDIRS@",re.M), linkPath]
 
     inform("%s contains the SIP module." % (sipModuleDir))
 
@@ -1193,19 +1246,16 @@
 
     Returns the error code.
     """
-    try:
-        run = prog + ' ' + string.join(argv)
-        if wd:
-            # FIXME: reason, why theading will not work on win32 yet <hpj@urpla.net>
-            run = 'cd ' + wd + ' >/dev/null && ' + run
-        #inform("run: <%s>" % run)
-        rc = os.system (run)
-    except:
-        raise
+    run = prog + ' ' + string.join(argv)
+    if wd:
+        # FIXME: reason, why theading will not work on win32 yet <hpj@urpla.net>
+        run = 'cd ' + wd + ' >/dev/null && ' + run
+    #inform("run: <%s>" % run)
+    rc = os.system (run)
 
     if rc != 0 and fatal:
-        raise
-        error("%s failed with an exit code of %d." % (prog,rc))
+        inform("%s failed with an exit code of %d." % (prog,rc))
+        raise   # force traceback and exit
 
     return rc
 
@@ -1446,7 +1496,7 @@
     initGlobals()
 
     try:
-        optlist, args = getopt.getopt(argv[1:],"hc:d:e:g:i:j:k:l:m:n:o:p:q:r:s:t:v:z:")
+        optlist, args = getopt.getopt(argv[1:],"hc:d:e:g:i:j:k:l:m:n:o:p:q:r:s:t:u:v:z:")
     except getopt.GetoptError:
         usage()
 
@@ -1523,6 +1573,19 @@
         elif opt == "-t":
             global platPyLibDir
             platPyLibDir = arg
+        elif opt == "-u":
+            global strict, strictSip
+            if arg == "none":
+                strict    = FALSE
+                strictSip = FALSE
+            elif arg == "all":
+                strict    = TRUE
+                strictSip = TRUE
+            elif arg == "nosip":
+                strictSip = FALSE
+            else:
+                usage ()
+
         elif opt == "-v":
             global pyQtSipDir
             pyQtSipDir = arg
@@ -1619,3 +1682,4 @@
     except:
         print internalError
         raise
+


_______________________________________________
PyKDE mailing list    PyKDE@mats.imk.fraunhofer.de
http://mats.imk.fraunhofer.de/mailman/listinfo/pykde

[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic