[prev in list] [next in list] [prev in thread] [next in thread]
List: pykde
Subject: [PyKDE] [PATCH] some more build.py tweaks
From: Hans-Peter Jansen <hpj () urpla ! net>
Date: 2003-04-23 21:33:48
[Download RAW message or body]
Hi Jim,
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.
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
RPM_BUILD_ROOT) and some cleanups.
README diff provided.
I've chosen PyKDE's build.py for the thread hackings, because
it spared me the win32 hassles which I cannot test, either. If
it proves useful for PyKDE, I will adapt it to PyQt.
If one of your systems is SMP, I'm sure, you will enjoy it.
I was able to build the PyKDE rpm as an ordinary user. The
make -j problem, I noted before, vanished, btw.
System: 2 way 1GHz PIII
Time for build.py reduced from 12 min to 6 min.
Time to build rpm
Before: build -c && make -j2: 31:44
Now: build -cj2 && make -j2: 25:26
Well, using MAKEFLAGS is indeed questionable, but was the
easiest way to spare just another command line option, and
works nicely in the specs.
Please let me know, what do you think.
Thanks,
Pete
["PyKDE-kdepyuic.diff" (text/x-diff)]
--- /dev/null 2002-09-09 22:24:09.000000000 +0200
+++ kdepyuic 2003-04-19 20:49:50.000000000 +0200
@@ -0,0 +1,150 @@
+#!/usr/bin/env python
+
+#Terms and Conditions
+
+#Copyright (c) 2002 Jim Bublitz (jbublitz@nwinternet.com)
+
+#Permission is hereby granted, free of charge, to any person obtaining a copy of
+#this software and associated documentation files (the "Software"), to deal in
+#the Software without restriction, including without limitation the rights to
+#use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
+#of the Software, and to permit persons to whom the Software is furnished to do
+#so, subject to the following conditions:
+
+#The above copyright notice and this permission notice shall be included in all
+#copies or substantial portions of the Software.
+
+#THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+#IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+#FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+#COPYRIGHT HOLDER BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
+#IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+#CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+#Except as contained in this notice, the names of the copyright holders shall not
+#be used in advertising or otherwise to promote the sale, use or other dealings
+#in this Software without prior written authorization from the copyright holders.
+
+# 2003/04/19: some minor bits from Hans-Peter Jansen, <hpj@urpla.net>
+
+import sys, getopt, os, os.path, string
+
+#---------- globals ----------
+
+FALSE = 0
+TRUE = not FALSE
+addApp = TRUE
+addImport = TRUE
+pyuicPath = "pyuic"
+filename = ""
+
+
+# --------- support functions ----------
+
+def getOptions ():
+ global filename
+
+ opterr = 0
+ shortOptions = "aip:"
+ longOptions = "noapp noimport pyuic="
+
+ try:
+ optlist, args = getopt.getopt (sys.argv [1:], shortOptions, longOptions)
+ except getopt.GetoptError:
+ opterr = 1
+ optlist = []
+ args = []
+
+ if opterr or (len (args) != 1):
+ print """\nUsage:
+
+ kdepyuic [options] filename.ui
+
+ Options:
+ -a, --noapp Don't add KApplication code
+ -i, --noimport Don't add kdecore, kdeui import statements
+ -p, --pyuic Path to pyuic program
+ """
+ return FALSE
+
+ filename = args[0]
+ return checkOptions (optlist)
+
+def checkOptions (optlist):
+ global addApp, addImport, pyuicPath
+
+ for pair in optlist:
+ if (pair [0] == '--noapp') or (pair [0] == '-a'):
+ addApp = FALSE
+
+ elif (pair [0] == '--noimport') or (pair [0] == '-i'):
+ addImport = FALSE
+
+ elif (pair [0] == '--pyuic') or (pair [0] == '-p'):
+ pyuicPath = pair [1]
+
+
+
+# --------- operations ----------
+
+def addimport (n):
+ if addApp:
+ n.write ('from kdecore import KCmdLineArgs, KApplication\n')
+ n.write ('from kdeui import *\n\n')
+
+
+def addapp (indent, n):
+ n.write (indent + 'appname = ""\n')
+ n.write (indent + 'description = ""\n')
+ n.write (indent + 'version = ""\n')
+ n.write ('\n')
+ n.write (indent + 'KCmdLineArgs.init (sys.argv, appname, description, version)\n')
+ n.write (indent + 'a = KApplication ()\n\n')
+
+def doPyuic ():
+
+ fn = os.path.splitext (os.path.basename(filename)) [0] + '.py'
+
+ if addApp:
+ opts = ' -x -o '
+ else:
+ opts = ' -o '
+
+ if os.system (pyuicPath + opts + fn + ' ' + filename) != 0:
+ print pyuicPath + opts + fn + ' ' + filename + " failed"
+ sys.exit (-1)
+
+ if addApp or addImport:
+ m = open (fn, 'r')
+ n = open (fn + '.tmp', 'w')
+
+ buff = m.readlines ()
+
+ for line in buff:
+ if addImport and (string.strip (line) == 'from qt import *'):
+ n.write (line)
+ addimport (n)
+ elif addApp and (string.strip (line) == 'a = QApplication(sys.argv)'):
+ indent = 0
+ while line [indent] in string.whitespace:
+ indent = indent + 1
+ addapp (line[:indent], n)
+ elif string.find(line, " = KDatePicker(") != -1:
+ o = string.find(line, ",")
+ n.write (line[:o] + ",QDate.currentDate()" + line[o:])
+ else:
+ n.write (line)
+
+ m.close ()
+ n.close ()
+
+ os.unlink (fn)
+ os.rename (fn + '.tmp', fn)
+
+ print fn + ' written'
+
+
+# --------- main ----------
+
+getOptions ()
+doPyuic ()
["PyKDE-build.diff" (text/x-diff)]
--- build.py.orig 2003-04-20 19:49:54.000000000 +0200
+++ build.py 2003-04-23 21:39:20.000000000 +0200
@@ -22,17 +22,19 @@
qtDir = None
qtIncDir = None
qtVersion = 0
qtLib = None
+qtLibDir = None
kdeDir = None
kdeIncDir = None
kdeVersion = 0
kdeLib = None
pyQtSipDir = None
+platPyBaseDir = None
platPyScriptDir = None
platPyDLLDir = None
platPySiteDir = None
platPyIncDir = None
platPyLib = None
@@ -56,10 +58,12 @@
tempBuildDir = None
usingTmake = 0
enableOldPython = 0
catCppFiles = 0
qpeTag = None
+catSplit = 1
+nrThreads = 0
FALSE = 0
TRUE = not FALSE
Release = "3.5-2"
@@ -94,29 +98,32 @@
def usage(rcode = 2):
"""Display a usage message and exit.
rcode is the return code passed back to the calling process.
"""
- global progName, platBinDir, platMake, modDir, platQTDIRName, sipIncDir
+ global progName, platBinDir, platMake, platQTDIRName, platPyBaseDir, \
platPySiteDir, sipIncDir
print "Usage:"
print " %s [-h] " % (progName)
print " %s [options]\n" % (progName)
print "where:"
print " -h display this help message\n"
print " options:\n"
+ print " -b dir Python base directory [default %s]" % (platPyBaseDir)
print " -c concatenate each module's C++ source files"
- print " -d dir where PyKDE will be installed [default %s]" % (modDir)
+ 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 \
concatenated C++ source files in # pieces [default 1]"
print " -k dir the KDE base directory [default %s]" % \
(platKDEDIRName)
print " -l Qt-library explicitly specify the type of Qt library, either qt, \
qt-mt or qte"
print " -m prog the name of the Make program [default %s]" % \
(platMake)
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 Qt lib directory [default %s%slib]" % \
(platQTDIRName, os.sep) print " -s dir the directory containing the SIP \
module"
print " -t dir the directory containing the KDE header files [default \
%s/include]" % (platKDEDIRName)
print " -u dir the directory containing the KDE lib files [default \
%s/lib]" % (platKDEDIRName)
print " -v dir the directory containing the PyQt sip files\n"
print " -z file the name of a file containing command line flags"
@@ -183,11 +190,11 @@
return ver
def initGlobals():
"""Sets the values of globals that need more than a simple assignment.
"""
- global platMake, platCopy, platPyScriptDir, platPyDLLDir, platPySiteDir
+ global platMake, platCopy, platPyBaseDir, platPyScriptDir, platPyDLLDir, \
platPySiteDir global platPyIncDir, platPyLib, platQTDIRName, platBinDir, platMkdir
global modDir, pyFullVers, sipIncDir, platKDEDIRName
pyFullVers = string.split(sys.version)[0]
@@ -200,21 +207,30 @@
else:
vl = string.split(pyFullVers,".")
pyVers = vl[0] + "." + vl[1]
platMake = "make"
- platCopy = "cp"
- platMkdir = "mkdir"
- platPyScriptDir = sys.prefix + "/lib/python" + pyVers
- platPyDLLDir = sys.prefix + "/lib/python" + pyVers + "/lib-dynload"
- platPySiteDir = sys.prefix + "/lib/python" + pyVers + "/site-packages"
+ platCopy = "cp -f"
+ platMkdir = "mkdir -p"
+
+ if not platPyBaseDir:
+ platPyBaseDir = sys.prefix + "/lib/python" + pyVers
+ platPyScriptDir = platPyBaseDir
+ platPyDLLDir = platPyBaseDir + "/lib-dynload"
+
+ if pyVersNr < 20:
+ platPySiteDir = platPyBaseDir
+ else:
+ platPySiteDir = platPyBaseDir + "/site-packages"
+
platPyIncDir = sys.prefix + "/include/python" + pyVers
platQTDIRName = "$QTDIR"
platKDEDIRName = "$KDEDIR"
platBinDir = "/usr/local/bin"
- modDir = platPySiteDir
+ if not modDir:
+ modDir = platPySiteDir
sipIncDir = platPyIncDir
def searchPath(prog,xtradir = None):
"""Search the PATH for a program and return it's absolute pathname.
@@ -604,13 +620,16 @@
def checkQtLibrary():
"""Check which Qt library is to be used.
"""
- global qtDir, qtLib
+ global qtDir, qtLibDir, qtLib
- qtlibdir = qtDir + os.sep + "lib"
+ if qtLibDir:
+ qtlibdir = qtLibDir
+ else:
+ qtlibdir = qtDir + os.sep + "lib"
if qtLib is None:
mtlib = isQtLibrary(qtlibdir,"qt-mt")
stlib = isQtLibrary(qtlibdir,"qt")
@@ -649,11 +668,11 @@
proPatches["THREAD"] = [re.compile("@BL_THREAD@",re.M), ""]
inform("Qt thread support is disabled.")
def checkThreading ():
- qtmodlib = modDir + '/libqtcmodule.so'
+ qtmodlib = platPySiteDir + '/libqtcmodule.so'
os.system ('ldd ' + qtmodlib + ' > lddtmp')
f = open ('lddtmp', 'r')
buff = f.read ()
pat = re.compile("libqt\.so" ,re.M)
if re.search (pat, buff) is None:
@@ -751,15 +770,15 @@
inform ("PyQt/sip directory found at %s" % pyQtSipDir)
def copySipFiles ():
# copy the top-level sip module files (eg dcop.sip) for this version
inform ("Copying sip module files for version KDE%s to sip directory" % str \
(kdeVersion))
- runProgram ("cp -f", ['sip/kde' + str (kdeVersion) [0:2] + '/*.sip', 'sip'])
+ runProgram (platCopy, ['sip/kde' + str (kdeVersion) [0:2] + '/*.sip', \
'sip'])
# copy the extraH files for this version
inform ("Copying version specific h files for KDE%s to extraH directory" % \
str (kdeVersion))
- runProgram ("cp -f", ['extraH/kde' + str (kdeVersion) + '/*', 'extraH'])
+ runProgram (platCopy, ['extraH/kde' + str (kdeVersion) + '/*', 'extraH'])
def installChecks():
"""Carry out basic checks about the installation.
"""
@@ -774,12 +793,14 @@
error("This program must be run from the top level directory of the package, \
ie. the directory containing this program")
# Check the installation directory is valid.
global modDir
- if not os.access(modDir,os.F_OK):
- error("The %s PyKDE destination directory does not seem to exist. Use the -d \
argument to set the correct directory" % (modDir)) + if not \
os.access(modDir,os.F_OK) \ + or runProgram (platMkdir, [modDir]) \
+ or 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))
@@ -826,13 +847,13 @@
inform("%s contains sipQt.h." % (sipIncDir))
global sipModuleDir
if sipModuleDir is None:
- global platPyScriptDir, platPyDLLDir, platPySiteDir
+ global platPyScriptDir, platPyDLLDir, platPySiteDir
- dirlist = [platPyDLLDir, platPyScriptDir, platPySiteDir]
+ dirlist = [platPyDLLDir, platPyScriptDir, platPySiteDir]
else:
dirlist = [sipModuleDir]
sipModuleDir = None
for d in dirlist:
@@ -1041,18 +1062,21 @@
runProgram("qttest")
inform("Generated the features file.")
-def generateSource(mname,plattag,qttag,xtrtag = None):
+def generateSource(mname,plattag,qttag,cpu_pool = None,xtrtag = None):
"""Generate the C++ source code for a particular PyQt module.
mname is the name of the module.
plattag is the SIP tag for the platform.
qttag is the SIP tag for the Qt version.
xtrtag is an optional extra SIP tag.
"""
+ if cpu_pool:
+ cpu_pool.acquire()
+
inform("Generating the C++ source for the %s module." % (mname))
try:
shutil.rmtree(mname)
except:
@@ -1074,11 +1098,11 @@
"-t", qttag,
"-t", kdetag,
"-z", "features",
"-I", "sip",
"-I", pyQtSipDir,
- "-m", mname + "/" + pro,
+ "-m", mname + os.sep + pro,
"-c", mname,
fullmname]
# "sip/" + modules [mname] + ".sip"]
if xtrtag:
@@ -1087,46 +1111,45 @@
# print qttag, kdetag
global sipBin
runProgram (sipBin, argv)
- runProgram (sys.executable + " postproc", ['-p', mname, "-o", "tr", "*.cpp"])
+ runProgram (sys.executable + " postproc", ["-p", mname, "-o", "tr", "*.cpp"])
if mname == "kdeui":
- runProgram (sys.executable + " postproc", ["-p ", mname, "-o", "shpix", \
"sipkdeuiKSharedPixmap.cpp"])
-
+ runProgram (sys.executable + " postproc", ["-p", mname, "-o", "shpix", \
"sipkdeuiKSharedPixmap.cpp"]) elif mname == "kfile":
- runProgram (sys.executable + " postproc", ["-p ", mname, "-o", "notify", \
"kfile.py"]) + runProgram (sys.executable + " postproc", ["-p", mname, "-o", \
"notify", "kfile.py"])
# Python names binary modules differently on different platforms.
- global proPatches, makefilePatches
+ global proPatches, makefilePatches, catCppFiles
target = mname + "cmodule"
# Generate the Makefile.
inform("Generating the Makefile for the %s module." % (mname))
- olddir = pushDir(mname)
+ #olddir = pushDir(mname)
- proPatches["TARGET"] = [re.compile("@BL_TARGET@",re.M), target]
+ #proPatches["TARGET"] = [re.compile("@BL_TARGET@",re.M), target]
+ _propat = proPatches.copy()
+ _propat["TARGET"] = [re.compile("@BL_TARGET@",re.M), target]
- global catCppFiles
- buildMakefile(pro,catCppFiles)
+ buildMakefile(pro,catCppFiles,_propat,mname)
fixInstallTarget(mname)
- del proPatches["TARGET"]
-
- if sys.platform == "win32":
- del makefilePatches["TARGET"]
+ #del proPatches["TARGET"]
# Compile the Python part of the module.
- pyname = mname + ".py"
+ pyname = mname + os.sep + mname + ".py"
inform("Compiling %s." % (pyname))
py_compile.compile(pyname)
- popDir(olddir)
+ #popDir(olddir)
+ if cpu_pool:
+ cpu_pool.release()
def pushDir(newdir):
"""Change to a new directory and return the old one.
@@ -1144,11 +1167,17 @@
olddir is the old directory.
"""
os.chdir(olddir)
-def runProgram(prog,argv = [],fatal = 1):
+def addDir(file,wd):
+ if wd:
+ file = wd + os.sep + file
+ return file
+
+
+def runProgram(prog,argv = [],fatal = 1,wd = None):
"""Execute a program.
prog is the name of the program.
argv is the optional list of program arguments.
fatal is non-zero if an error is considered fatal.
@@ -1158,11 +1187,15 @@
# Use the basename to avoid problems with pathnames containing spaces.
# Huh? argv.insert(0,os.path.basename(prog))
try:
# rc = os.spawnv (os.P_WAIT, prog, argv) <--- didn't work
- rc = os.system (prog + ' ' + string.join (argv))
+ run = prog + ' ' + string.join (argv)
+ if wd:
+ run = 'cd ' + wd + ' >/dev/null && ' + run
+ #print run
+ rc = os.system (run)
# except AttributeError:
# print string.join (argv)
# rc = os.system (string.join(argv))
except:
raise
@@ -1189,43 +1222,51 @@
argv = [target]
return runProgram(makeBin,argv,fatal)
-def buildMakefile(pro,catcpp = 0):
+def buildMakefile(pro,catcpp = 0,patches = None,wd = None):
"""Run qmake or tmake to create a Makefile from a project file.
pro is the name of the project file.
catcpp is non-zero if the project file is for a module whose C++ files are
to be concatenated.
"""
global makefileGen, proPatches, makefilePatches
+ if not patches:
+ patches = proPatches
+
+ pf = addDir(pro,wd)
# Preserve the original project file.
- probak = pro + ".bak"
- patchFile(pro,proPatches,probak)
+ probak = pf + ".bak"
+ patchFile(pf,patches,probak)
if catcpp:
- catFiles(pro)
+ catFiles(pro,wd)
- runProgram(makefileGen,['-o', 'Makefile', pro])
- os.remove(pro)
- os.rename(probak,pro)
+ runProgram(makefileGen,['-o', 'Makefile', pro],1,wd)
+ # save Makefile for debug purposes
+ #os.rename(pf, pf + ".patched")
+ os.remove(pf)
+ os.rename(probak,pf)
- patchFile("Makefile",makefilePatches)
+ mf = addDir("Makefile",wd)
+ patchFile(mf,makefilePatches)
-def catFiles(pro):
+def catFiles(pro,wd = None):
"""Concatenate a modules C++ source files.
pro is the name of the project file.
"""
# Extract the module name from the project file name.
mname = os.path.splitext(pro)[0]
inform("Concatenating the C++ files for the %s module." % (mname))
+ pro = addDir(pro,wd)
f = open(pro,"r")
buf = f.read()
f.close()
pat = re.compile("^SOURCES =.*.cpp\n",re.M | re.S)
@@ -1234,21 +1275,36 @@
srclist = srclist[13:-1]
srclist = string.replace(srclist,"\\\n\t","")
srclist = string.split(srclist," ")
# Concatenate the files.
- d = open(mname + "huge.cpp","w")
+ global catSplit
+
+ nrinpiece = len(srclist) / catSplit
+ plist = []
+ p = 0
+
+ # Do each piece.
+ while srclist:
+ pname = "%shuge%d.cpp" % (mname, p)
+ plist.append(pname)
+
+ d = open(addDir(pname,wd),"w")
+
+ for cppfile in srclist[:nrinpiece]:
+ cppfile = addDir(cppfile,wd)
+ f = open(cppfile,"r")
+ d.write(f.read())
+ f.close()
- for cppfile in srclist:
- f = open(cppfile,"r")
- d.write(f.read())
- f.close()
+ d.close()
- d.close()
+ srclist = srclist[nrinpiece:]
+ p = p + 1
# Replace the C++ file names in the project file.
- buf = re.sub(pat,"SOURCES = " + mname + "huge.cpp\n",buf)
+ buf = re.sub(pat,"SOURCES = " + string.join(plist," ") + "\n",buf)
f = open(pro + ".new","w")
f.write(buf)
f.close()
@@ -1260,11 +1316,14 @@
"""Fix the install target for a Makefile.
mname is the name of the PyQt module, or None if the target isn't for a
module.
"""
- f = open("Makefile","a")
+ if mname:
+ f = open(mname + os.sep + "Makefile","a")
+ else:
+ f = open("Makefile","a")
f.write("\ninstall:\n")
if mname:
global modDir, platCopy
@@ -1311,14 +1370,23 @@
# Parse the command line.
global progName
progName = os.path.basename(argv[0])
+ global nrThreads
+ try:
+ makeopts = os.environ["MAKEFLAGS"]
+ i = string.find(makeopts, "-j")
+ if i != -1:
+ nrThreads = int(string.split(makeopts[i+2:])[0])
+ except:
+ pass
+
initGlobals()
try:
- optlist, args = getopt.getopt(argv[1:],"hcd:e:g:i:k:l:m:p:q:s:t:u:v:z:")
+ optlist, args = \
getopt.getopt(argv[1:],"hb:cd:e:g:i:j:k:l:m:p:q:r:s:t:u:v:z:") except \
getopt.GetoptError: usage()
# Look for '-z' first and process that switch
# (command line switches override file switches)
@@ -1331,10 +1399,13 @@
explicitMake = 0
for opt, arg in optlist:
if opt == "-h":
usage(0)
+ elif opt == "-b":
+ global platPyBaseDir
+ platPyBaseDir = arg
elif opt == "-c":
global catCppFiles
catCppFiles = 1
elif opt == "-d":
global modDir
@@ -1346,10 +1417,18 @@
global makefileGen
makefileGen = arg
elif opt == "-i":
global qtIncDir
qtIncDir = arg
+ elif opt == "-j":
+ global catSplit
+ try:
+ catSplit = int(arg)
+ except:
+ catSplit = 0
+ if catSplit < 1:
+ usage()
elif opt == "-k":
global kdeDir
kdeDir = arg
elif opt == "-l":
if arg in ("qt", "qt-mt"):
@@ -1363,10 +1442,13 @@
global sipBin
sipBin = arg
elif opt == "-q":
global qtDir
qtDir = arg
+ elif opt == "-r":
+ global qtLibDir
+ qtLibDir = arg
elif opt == "-s":
global sipModuleDir
sipModuleDir = arg
elif opt == "-t":
global kdeIncDir
@@ -1378,10 +1460,12 @@
global pyQtSipDir
pyQtSipDir = arg
elif opt == "-z":
pass
+ initGlobals()
+
installChecks()
maindir = mkTempBuildDir()
compileChecks()
# Work out the platform and Qt version tags to pass to SIP to generate the
@@ -1431,19 +1515,41 @@
# copySipFiles ()
# global buildModules
buildModules = modList [str (kdeVersion) [0:2]]
subdirs = ""
- for mname in buildModules:
- generateSource(mname, plattag, qttag)
- subdirs = subdirs + " " + mname
+ if not nrThreads:
+ for mname in buildModules:
+ generateSource(mname, plattag, qttag)
+ subdirs = subdirs + " " + mname
+ else:
+ import signal
+ from threading import Thread, BoundedSemaphore
+ cpu_pool = BoundedSemaphore(nrThreads)
+ threads = []
+ print "Starting %d builder threads for %s" % (nrThreads, " \
".join(buildModules)) + for mname in buildModules:
+ t = Thread(target=generateSource, name=mname, args=(mname, plattag, \
qttag, cpu_pool)) + threads.append(t)
+ t.start()
+ subdirs = subdirs + " " + mname
+
+ while TRUE:
+ for t in threads:
+ if t.isAlive():
+ t.join(1.0)
+ else:
+ del threads[threads.index(t)]
+ if not threads:
+ break
+ print "Builder threads finished."
# Generate the top-level Makefile.
inform("Creating top level Makefile.")
- copyToFile("PyQt.pro","TEMPLATE = subdirs\nSUBDIRS =" + subdirs + "\n")
- buildMakefile("PyQt.pro")
+ copyToFile("PyKDE.pro","TEMPLATE = subdirs\nSUBDIRS =" + subdirs + "\n")
+ buildMakefile("PyKDE.pro")
# Tell the user what to do next.
if explicitMake:
mk = makeBin
else:
["PyKDE-postproc.diff" (text/x-diff)]
--- postproc.orig 2003-03-31 02:51:34.000000000 +0200
+++ postproc 2003-04-22 23:21:31.000000000 +0200
@@ -201,11 +201,10 @@
return TRUE
def notify ():
fn = os.path.join (opPath, pattern)
- print fn
m = open (fn, "r")
tmpname = fn + '.tmp'
buff = m.readlines ()
m.close ()
["PyKDE-readme.diff" (text/x-diff)]
--- ChangeLog.orig 2003-04-23 20:48:51.000000000 +0200
+++ ChangeLog 2003-04-23 22:19:08.000000000 +0200
@@ -1,5 +1,11 @@
+2003/4/23 20:49:00 hpj@urpla.net
+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
+RPM_BUILD_ROOT) and some cleanups.
+
2003/4/8 22:12:00 jim
PyKDE-3.5-2 bug fixes to build.py (PYQT_VERSION
converted to string, kdeDir fixed); QList instances
versioned out/replaced by QPtrList for KDE >= 3.0.0;
changed 'python' invocation to 'sys.executable' in
--- README.orig 2003-04-23 20:12:37.000000000 +0200
+++ README 2003-04-23 20:57:20.000000000 +0200
@@ -31,13 +31,14 @@
with, normally:
python build.py [options]
The '-c' option will reduce compile time by up to 80% but requires
-a large amount of RAM/swap space. Other options will allow you to
-specify directories for various include, library, or PyQt sip files.
-Run:
+a large amount of RAM/swap space (by concatenating each module's
+C++ source files to one huge module). Other options will allow you
+to specify directories for various include, library, or PyQt sip
+files. Run:
python build.py -h
for a list of options.
@@ -53,16 +54,29 @@
compilation times (varies with machine speed and memory) are:
with -c: 6 to 20 minutes
no -c: 50 to 90 minutes or longer
+The new -j # option allows to cut the concatenated source files
+into # pieces. This will help reducing build time on SMP builds.
+
By default, build.py expects that the QTDIR and KDEDIR (and
TMAKEPATH for Qt2) environment variables are set correctly.
You can set the environment variables with, for example:
export KDEDIR=/opt/kde3
+Some further build time reduction can be archived on SMP
+systems by speeding up build.py with threaded execution. This
+is controlled with the MAKEFLAGS environment variable.
+On a dual SMP system, you would typically use:
+
+ export MAKEFLAGS=-j2
+
+Note, that this will affect the make run as well (similar to
+using the appropriate make option). Rule of thump: use the
+same value in -j option for both make and build.py.
For setups which require a large number of option flags to
specify the correct directories for building, the option
flags can be placed in a text file (one option with parameter
per line) and build.py run with a single -z switch specifying
_______________________________________________
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