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

List:       pykde
Subject:    [PyKDE] Re: [PATCH] some more build.py tweaks
From:       Hans-Peter Jansen <hpj () urpla ! net>
Date:       2003-04-24 20:43:05
[Download RAW message or body]

On Thursday 24 April 2003 00:38, Jim Bublitz wrote:
> On 23-Apr-03 Hans-Peter Jansen wrote:
> > I know, you're busy with other things, but I couldn't stop myself
> > from tweaking build.py. Here is, what I've done so far as diffs
> > against PyKDE-3.5-2.
>
> Good timing - I'm going to start applying patches/fixes from the
> list tonight or tomorrow and put the next release out - hopefully
> early next week.

Nice, here comes the next iteration.

> > ChangeLog entry:
> > build.py: some new options allows 64 bit builds, split
> > concatenated files, threaded build.py execution, -d will
> > create the destination, if it doesn't exist (allows

-d doesn't work as expected. Please apply buildfix.diff, sorry.

> > RPM_BUILD_ROOT) and some cleanups.

To make this really work, I had to include a new replace tag in 
the unix:LIBS line of the sip files in order to include the build 
directory. Fortunately it wasn't a big deal with the right skel:
fixSipInclude.py -v sip/*.sip (simple search & replace)
But, then it's also necessary to apply PyKDE-build2.diff. With these
fixes in place, PyKDE will be able to build into an independant dir.

Today I tried to build PyKDE on a faster 2 way Athlon (1700) on top
of KDE 3.1.1. First, I had to comment out the sessionSaving method 
in kapplication.sip, are you sure, that this exists in 3.1.1? 
On that machine, I was catched by races in the Makefile in a parallel
make, because the kjs module needs to bind against khtml, which build
wasn't finished. As a band aid, I reordered the module build order 
with PyKDE-build3.diff. I you're going to accept this, I will add some
comments about this arkwardness. (15:42 for the full rpm build :-)

> Jim

Pete
["buildfix.diff" (text/x-diff)]

--- build.py~	2003-04-23 21:39:20.000000000 +0200
+++ build.py	2003-04-24 21:36:01.000000000 +0200
@@ -794,12 +794,12 @@
 
     # Check the installation directory is valid.
     global modDir
 
     if not os.access(modDir,os.F_OK) \
-        or runProgram (platMkdir, [modDir]) \
-        or not os.access(modDir,os.F_OK):
+        and runProgram (platMkdir, [modDir]) \
+        and not os.access(modDir,os.F_OK):
         error("The %s PyKDE destination directory cannot be created. Use the -d \
argument to set the correct directory or check permissions." % (modDir))  
     proPatches["DESTDIR"] = [re.compile("@BL_DESTDIR@",re.M), modDir]
 
     inform("%s is the PyKDE installation directory." % (modDir))


["PyKDE-build2.diff" (text/x-diff)]

--- build.py~	2003-04-24 19:19:04.000000000 +0200
+++ build.py	2003-04-24 20:55:25.000000000 +0200
@@ -1512,10 +1512,13 @@
     generateFeatures(maindir + "/features")
 
     # We don't need the temporary build directory anymore.
     mkTempBuildDir(maindir)
 
+    global proPatches, modDir
+    proPatches["BUILDDIR"] = [re.compile("@BL_BUILDDIR@",re.M), modDir]
+
 #    copySipFiles ()
 
 #    global buildModules
     buildModules = modList [str (kdeVersion) [0:2]]
     subdirs = ""

["PyKDE-build3.diff" (text/x-diff)]

--- build.py~	2003-04-24 21:06:38.000000000 +0200
+++ build.py	2003-04-24 21:42:05.000000000 +0200
@@ -71,11 +71,11 @@
 
 QtVers     = ["230", "231", "300", "301", "302", "304", "305", "306", "310", "311", \
"312"]  KDEVers    = ["211", "212", "220", "221", "222", "300", "301", "303", "310", \
"311"]  
 modList        = {}
-modList ["21"] = ["dcop", "kdecore", "kdesu", "kdeui", "kio", "kfile", "kparts", \
"khtml", "kjs", "kspell"] +modList ["21"] = ["dcop", "kdecore", "kdesu", "kdeui", \
"kio", "kfile", "kparts", "khtml", "kspell", "kjs"]  modList ["22"] = [] + modList \
["21"]  modList ["22"].append ("kdeprint")
 modList ["30"] = modList ["22"][0:3] + ["kdefx"] + modList ["22"][3:]
 modList ["31"] = modList ["30"]
 


["fixSipInclude.py" (text/x-python)]

#! /usr/bin/env python
"""
fix sip includes
usage: %s [-vb] files.sip
       -v verbose mode (cumulative)
       -b create backup (file.sip.bak)
"""
# (c)reated by Hans-Peter Jansen, LISA GmbH, Berlin
#
# Licence:      GPL http://www.gnu.org/licenses/gpl.html
#
# 2003-04-24    hp  initial version

import sys
import os
import getopt

verbose=0
backup=0
argv0=os.path.basename(sys.argv[0])

matchpat='unix:LIBS += -L@BL_SIPMODDIR@'
replacepat='unix:LIBS += -L@BL_BUILDDIR@ -L@BL_SIPMODDIR@'

def out(arg):
    err(arg, sys.stdout)

def vout(lvl, arg):
    if lvl > verbose:
        return
    err(arg)

def err(arg, ch = sys.stderr):
    if arg:
        ch.write(arg)
        if arg[-1] != "\n":
            ch.write("\n")
    else:
        ch.write("\n")
    ch.flush()

def usage(ret=0, arg=None):
    if arg:
        err("%s: %s" % (argv0, arg))
    err(__doc__ % (argv0))
    sys.exit(ret)

def strcmp(str, substr):
    l = len(substr)
    return len(str) >= l and str[:l] == substr

def filterFiles(files):
    for file in files:
        vout(2, "check: %s" % file)
        try:
            f = open(file, 'r')
        except:
            err("open file: %s %s" % (sys.exc_type, sys.exc_value))
            continue

        repf = "%s.$new$" % file
        try:
            rf = open(repf, 'w')
        except:
            err("open replace file: %s %s" % (sys.exc_type, sys.exc_value))
            continue

        match = 0
        while 1:
            line = f.readline()
            if not line:
                break
            # won't work if line is not properly terminated
            if strcmp(line, matchpat):
                vout(1, "match: %s" % file)
                match = 1
                line = replacepat + line[len(matchpat):]
            rf.write(line)

        f.close()
        rf.close()
        try:
            if match:
                if backup:
                    vout(2, "rename: %s -> %s" % (file, "%s.bak" % file))
                    os.rename(file, "%s.bak" % (file))
                vout(2, "rename: %s -> %s" % (repf, file))
                os.rename(repf, file)
            else:
                vout(2, "remove: %s" % (repf))
                os.remove(repf)
        except:
            err("replace old file: %s %s" % (sys.exc_type, sys.exc_value))
            continue

if __name__ == '__main__':
    try:
        optlist, args = getopt.getopt(sys.argv[1:], "vb")
    except getopt.error, msg:
        usage(1, msg)

    for opt, par in optlist:
        if opt == '-v':
            verbose += 1
        elif opt == '-b':
            backup = 1

    if not args:
        usage(1, "no files specified")

    sys.exit(filterFiles(args))

# vim:set et ts=4 sw=4:

_______________________________________________
PyKDE mailing list    PyKDE@mats.gmd.de
http://mats.gmd.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