[prev in list] [next in list] [prev in thread] [next in thread]
List: pykde
Subject: Re: [PyKDE] [PATCH] new build.py options for lib64 and cat split
From: Hans-Peter Jansen <hpj () urpla ! net>
Date: 2003-03-26 16:17:20
[Download RAW message or body]
On Wednesday 26 March 2003 14:59, Phil Thompson wrote:
>
> Sorry, I think you've misunderstood. The -r flag should define the full
> path of the Qt library directory - not just a component of it - like the -i
> flag for the header files. This is more flexible because it allows any
> arbitary directory to be specified.
>
> Same for -t - or does the -d flag already do it?
>
> Phil
I understood your concerns, but hesitated to make such deep changes.
Attached is what you asked for ;-) Hopefully all is well, especially the
win32 changes, which I haven't tested.
Here is something (hopefully) suitable for the ChangeLog:
Added -r flag to the build system to explicitly specify the Qt library
directory. This is useful for 64 bit systems, where the libs are placed
in $QTDIR/lib64, unlike the default $QTDIR/lib.
Same goes for the new -t flag, which specify the python base directory,
which is /usr/lib64/python#.# on such systems. This option takes
priority over -d.
For concatenated builds (-c), a -j # flag was added to the build system
for splitting huge modules, consisting of more then 100 single c++ modules,
into # of pieces. This is useful in SMP environments, combined with
make -j #, where # should correspond, to saturate the CPUs. It's also
helpful for troubling c++ compilers and memory constraint systems, which
may fail on such big sources otherwise.
Pete
["PyQt-libopt-catsplit.diff" (text/x-diff)]
--- build.py.orig 2003-03-24 02:51:15.000000000 +0100
+++ build.py 2003-03-26 16:34:09.000000000 +0100
@@ -21,12 +21,14 @@
# Define the globals.
progName = None
qtDir = None
qtIncDir = None
+qtLibDir = None
qtVersion = 0
qtLib = None
+platPyBaseDir = None
platPyScriptDir = None
platPyDLLDir = None
platPySiteDir = None
platPyIncDir = None
platPyLib = None
@@ -57,38 +59,42 @@
debugMode = "release"
catCppFiles = 0
qpeTag = None
licType = None
gccFlags = []
+catSplit = 0
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, modDir, platQTDIRName, platPyBaseDir, \
sipIncDir
print "Usage:"
- print " %s [-h] [-a version] [-b dir] [-c] [-d dir] [-e dir] [-f gccflag] [-g \
prog] [-i dir] [-l Qt-library] [-m prog] [-n dir] [-o dir] [-p dir] [-q dir] [-s dir] \
[-u] [-w]" % (progName) + print " %s [-h] [-a version] [-b dir] [-c] [-d dir] \
[-e dir] [-f gccflag] [-g prog] [-i dir] [-j #] [-l Qt-library] [-m prog] [-n dir] \
[-o dir] [-p dir] [-q dir] [-r dir] [-s dir] [-t dir] [-u] [-w]" % (progName) print \
"where:" print " -h display this help message"
print " -a tag explicitly enable the qtpe module"
print " -b dir where pyuic and pylupdate will be installed [default \
%s]" % (platBinDir) print " -c concatenate each module's C++ source \
files"
print " -d dir where PyQt will be installed [default %s]" % (modDir)
print " -e dir the directory containing the SIP header files [default \
%s]" % (sipIncDir) print " -f gccflag additional GCC flag, eg. \
-fno-exceptions" 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 huge \
concatenated modules in # pieces"
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 " -n dir the directory containing the QScintilla header files \
[default %s%sinclude]" % (platQTDIRName, os.sep)
print " -o dir the directory containing the QScintilla library \
[default %s%slib]" % (platQTDIRName, os.sep)
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 Python base directory [default %s]" % \
(platPyBaseDir) print " -u build with debugging symbols"
print " -w enable the use of Python 1.5.x under Windows"
sys.exit(rcode)
@@ -151,11 +157,11 @@
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 platRmdir, modDir, pyFullVers, pyVersNr, sipIncDir
pyFullVers = string.split(sys.version)[0]
@@ -169,35 +175,39 @@
if sys.platform == "win32":
platMake = "nmake"
platCopy = "copy /y"
platMkdir = "mkdir"
platRmdir = "rmdir /s /q"
- platPyScriptDir = sys.prefix + "\\Lib"
- platPyDLLDir = sys.prefix + "\\DLLs"
+ if not platPyBaseDir:
+ platPyBaseDir = sys.prefix
+ platPyScriptDir = platPyBaseDir + "\\Lib"
+ platPyDLLDir = platPyBaseDir + "\\DLLs"
if pyVersNr < 22:
platPySiteDir = platPyScriptDir
else:
- platPySiteDir = sys.prefix + "\\Lib\\site-packages"
+ platPySiteDir = platPyBaseDir + "\\Lib\\site-packages"
- platPyIncDir = sys.prefix + "\\include"
+ platPyIncDir = platPyBaseDir + "\\include"
platQTDIRName = "%QTDIR%"
platBinDir = sys.exec_prefix
- platPyLib = sys.prefix + "\\libs\\python%d.lib" % (pyVersNr)
+ platPyLib = platPyBaseDir + "\\libs\\python%d.lib" % (pyVersNr)
else:
platMake = "make"
platCopy = "cp"
platMkdir = "mkdir"
platRmdir = "rm -rf"
- platPyScriptDir = sys.prefix + "/lib/python" + pyVers
- platPyDLLDir = sys.prefix + "/lib/python" + pyVers + "/lib-dynload"
+ if not platPyBaseDir:
+ platPyBaseDir = sys.prefix + "/lib/python" + pyVers
+ platPyScriptDir = platPyBaseDir
+ platPyDLLDir = platPyBaseDir + "/lib-dynload"
if pyVersNr < 20:
- platPySiteDir = sys.prefix + "/lib/python" + pyVers
+ platPySiteDir = platPyBaseDir
else:
- platPySiteDir = sys.prefix + "/lib/python" + pyVers + "/site-packages"
+ platPySiteDir = platPyBaseDir + "/site-packages"
platPyIncDir = sys.prefix + "/include/python" + pyVers
platQTDIRName = "$QTDIR"
platBinDir = "/usr/local/bin"
@@ -566,13 +576,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")
emlib = isQtLibrary(qtlibdir,"qte")
@@ -765,13 +778,13 @@
f.close()
# Check the SIP module can be found.
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:
@@ -965,12 +978,15 @@
if qtVersion >= 0x030000 and sciInstalled:
global sciLibDir
if not sciLibDir:
- global qtDir
- sciLibDir = qtDir + os.sep + "lib"
+ global qtDir, qtLibDir
+ if qtLibDir:
+ sciLibDir = qtLibDir
+ else:
+ sciLibDir = qtDir + os.sep + "lib"
if sys.platform == "win32":
lpatt = "\\qscintilla.lib"
else:
lpatt = "/libqscintilla.*"
@@ -1263,10 +1279,11 @@
def catFiles(pro):
"""Concatenate a modules C++ source files.
pro is the name of the project file.
"""
+ global catSplit
# 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))
@@ -1279,22 +1296,46 @@
srclist = buf[match.start(0):match.end(0)]
srclist = srclist[13:-1]
srclist = string.replace(srclist,"\\\n\t","")
srclist = string.split(srclist," ")
- # Concatenate the files.
- d = open(mname + "huge.cpp","w")
+ if catSplit and len(srclist) > 100:
+ # special case for huge modules: split them into requested pieces
+ i = 0
+ mlist = []
+ n = len(srclist)/catSplit
+ # Concatenate the files.
+ while srclist:
+ i = i + 1
+ m = mname + "huge%s.cpp" % i
+ mlist.append(m)
+ d = open(m,"w")
+
+ for cppfile in srclist[:n]:
+ 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()
+
+ srclist = srclist[n:]
- d.close()
+ # Replace the C++ file names in the project file.
+ buf = re.sub(pat,"SOURCES = " + string.join(mlist, " ") + "\n",buf)
+ else:
+ # Concatenate the files.
+ d = open(mname + "huge.cpp","w")
+
+ for cppfile in srclist:
+ f = open(cppfile,"r")
+ d.write(f.read())
+ f.close()
- # Replace the C++ file names in the project file.
- buf = re.sub(pat,"SOURCES = " + mname + "huge.cpp\n",buf)
+ d.close()
+
+ # Replace the C++ file names in the project file.
+ buf = re.sub(pat,"SOURCES = " + mname + "huge.cpp\n",buf)
f = open(pro + ".new","w")
f.write(buf)
f.close()
@@ -1373,11 +1414,11 @@
progName = os.path.basename(argv[0])
initGlobals()
try:
- optlist, args = getopt.getopt(argv[1:],"ha:b:cd:e:f:g:i:l:m:n:o:p:q:s:uw")
+ optlist, args = \
getopt.getopt(argv[1:],"ha:b:cd:e:f:g:i:j:l:m:n:o:p:q:r:s:t:uw") except \
getopt.GetoptError: usage()
global makeBin, platBinDir, qtLib, qpeTag
@@ -1406,10 +1447,17 @@
global makefileGen
makefileGen = arg
elif opt == "-i":
global qtIncDir
qtIncDir = arg
+ elif opt == "-j":
+ global catSplit
+ try:
+ catSplit = int(arg)
+ except:
+ print "invalid split count, please specify an int."
+ usage()
elif opt == "-l":
if arg in ("qt", "qt-mt", "qte"):
qtLib = arg
else:
usage()
@@ -1426,13 +1474,20 @@
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 platPyBaseDir
+ platPyBaseDir = arg
+ initGlobals() # init various python globals again
elif opt == "-u":
global debugMode
debugMode = "debug"
elif opt == "-w":
global enableOldPython
_______________________________________________
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