Drop python2 support.

Signed-off-by: Slávek Banko <slavek.banko@axis.cz>
pull/18/head r14.1.0
Slávek Banko 1 year ago
parent 2e6682f7d5
commit b81d9ec9ff
No known key found for this signature in database
GPG Key ID: 608F5293A04BE668

@ -133,7 +133,7 @@ class %{APPNAME}(QMainWindow):
def slotOpenFile(self): def slotOpenFile(self):
fileName = str(QFileDialog.getOpenFileName("", "", self)) fileName = str(QFileDialog.getOpenFileName("", "", self))
print fileName print(fileName)
if not fileName=="": if not fileName=="":
self.load(fileName) self.load(fileName)
else: else:

@ -7,7 +7,7 @@
# Test real_lines properly # Test real_lines properly
# Process Makefile.am's in sub-directories # Process Makefile.am's in sub-directories
from __future__ import generators
import sys import sys
import re import re
@ -49,13 +49,13 @@ for l in real_lines(mf):
variables[lhs]=rhs variables[lhs]=rhs
# look for app sources # look for app sources
for (var,data) in variables.items(): for (var,data) in list(variables.items()):
spl = var.split("_",1) spl = var.split("_",1)
spl.append("") spl.append("")
(prefix,primary) = (spl[0], spl[1]) (prefix,primary) = (spl[0], spl[1])
if primary=="PROGRAMS": if primary=="PROGRAMS":
target=data target=data
if variables.has_key(target + "_SOURCES"): if target + "_SOURCES" in variables:
sources = variables[target+"_SOURCES"].split() sources = variables[target+"_SOURCES"].split()
# change .ui into .py # change .ui into .py

@ -1,7 +1,7 @@
#!/usr/bin/env python #!/usr/bin/env python
def main(): def main():
print 'Hello world!' print('Hello world!')
main() main()

@ -1,4 +1,4 @@
from Tkinter import * from tkinter import *
widget = Label(None, text='Hello world!') widget = Label(None, text='Hello world!')
widget.pack() widget.pack()
widget.mainloop() widget.mainloop()

@ -6,7 +6,7 @@ __author__ = "David Nolden<david.kde@art-master.de>, Ka-Ping Yee <ping@lfw.org>
__version__ = "6 April 2006" __version__ = "6 April 2006"
import sys, imp, os, stat, re, types, cgi import sys, imp, os, stat, re, types, cgi
from repr import Repr from reprlib import Repr
from string import expandtabs, find, join, lower, split, strip, rstrip from string import expandtabs, find, join, lower, split, strip, rstrip
import pydoc import pydoc
@ -67,9 +67,9 @@ def writedocs(path, pkgpath='', depth=0, notprocessed=[]):
if(depth == 1): if(depth == 1):
if(len(notprocessed) != 0): if(len(notprocessed) != 0):
print "<br> the following paths were not processed because they are deeper than the maximum depth of " + str(__maxdepth) + ":<br>" print("<br> the following paths were not processed because they are deeper than the maximum depth of " + str(__maxdepth) + ":<br>")
for x in notprocessed: for x in notprocessed:
print cgi.escape(x) + " <br>" print(cgi.escape(x) + " <br>")
def writedoc(key,top=False): def writedoc(key,top=False):
"""Write HTML documentation to a file in the current directory.""" """Write HTML documentation to a file in the current directory."""
@ -86,19 +86,19 @@ def writedoc(key,top=False):
seen = {} seen = {}
for dir in pydoc.pathdirs(): for dir in pydoc.pathdirs():
indices.append(pydoc.html.index(dir, seen)) indices.append(pydoc.html.index(dir, seen))
print cleanlinks(heading + join(indices)) print(cleanlinks(heading + join(indices)))
return return
if(type(key) != types.ModuleType): if(type(key) != types.ModuleType):
object = pydoc.locate(key) object = pydoc.locate(key)
if(object == None and top): if(object == None and top):
print "could not locate module/object for key " + \ print("could not locate module/object for key " + \
cgi.escape(key) + "<br><a href=\"pydoc:modules\">go to index</a>"; cgi.escape(key) + "<br><a href=\"pydoc:modules\">go to index</a>");
else: else:
object = key object = key
if object: if object:
print cleanlinks(pydoc.html.page(pydoc.describe(object), pydoc.html.document(object))) print(cleanlinks(pydoc.html.page(pydoc.describe(object), pydoc.html.document(object))))
@ -109,9 +109,9 @@ if __name__ == '__main__':
try: try:
opts, args = getopt.getopt(sys.argv[1:], 'k:p:w') opts, args = getopt.getopt(sys.argv[1:], 'k:p:w')
print "<html>" print("<html>")
print "<head><meta http-equiv=\"Content-Type\" content=\"text/html; charset=utf-8\">" print("<head><meta http-equiv=\"Content-Type\" content=\"text/html; charset=utf-8\">")
print "</head><body>" print("</head><body>")
if args: if args:
for arg in args: for arg in args:
@ -121,11 +121,11 @@ if __name__ == '__main__':
if os.path.isfile(arg): if os.path.isfile(arg):
arg = pydoc.importfile(arg) arg = pydoc.importfile(arg)
writedoc(arg, True) writedoc(arg, True)
except pydoc.ErrorDuringImport, value: except pydoc.ErrorDuringImport as value:
print 'problem in %s - %s' % ( print('problem in %s - %s' % (
cgi.escape(value.filename), cgi.escape(value.exc)) cgi.escape(value.filename), cgi.escape(value.exc)))
else: else:
raise BadUsage raise BadUsage
except (getopt.error, BadUsage): except (getopt.error, BadUsage):
print "need parameters\n" print("need parameters\n")

@ -18,8 +18,12 @@ using namespace TDEIO;
PydocProtocol::PydocProtocol(const TQCString &pool, const TQCString &app) PydocProtocol::PydocProtocol(const TQCString &pool, const TQCString &app)
: SlaveBase("pydoc", pool, app), key() : SlaveBase("pydoc", pool, app), key()
{
python = TDEGlobal::dirs()->findExe("python3");
if(python.isEmpty())
{ {
python = TDEGlobal::dirs()->findExe("python"); python = TDEGlobal::dirs()->findExe("python");
}
script = locate("data", "tdeio_pydoc/kde_pydoc.py"); script = locate("data", "tdeio_pydoc/kde_pydoc.py");
} }

@ -31,18 +31,18 @@ def generate(env):
env['HELP']=1 env['HELP']=1
if env['HELP']: if env['HELP']:
print """ print("""
"""+BOLD+"""*** Generic options *** """+BOLD+"""*** Generic options ***
-----------------------"""+NORMAL+""" -----------------------"""+NORMAL+"""
"""+BOLD+"""* debug """+NORMAL+""": debug=1 (-g) or debug=full (-g3, slower) else use environment CXXFLAGS, or -O2 by default """+BOLD+"""* debug """+NORMAL+""": debug=1 (-g) or debug=full (-g3, slower) else use environment CXXFLAGS, or -O2 by default
"""+BOLD+"""* prefix """+NORMAL+""": the installation path """+BOLD+"""* prefix """+NORMAL+""": the installation path
"""+BOLD+"""* extraincludes """+NORMAL+""": a list of paths separated by ':' """+BOLD+"""* extraincludes """+NORMAL+""": a list of paths separated by ':'
ie: """+BOLD+"""scons configure debug=full prefix=/usr/local extraincludes=/tmp/include:/usr/local ie: """+BOLD+"""scons configure debug=full prefix=/usr/local extraincludes=/tmp/include:/usr/local
"""+NORMAL """+NORMAL)
## Global cache directory ## Global cache directory
## Put all project files in it so a rm -rf cache will clean up the config ## Put all project files in it so a rm -rf cache will clean up the config
if not env.has_key('CACHEDIR'): if 'CACHEDIR' not in env:
env['CACHEDIR'] = os.getcwd()+'/cache/' env['CACHEDIR'] = os.getcwd()+'/cache/'
if not os.path.isdir(env['CACHEDIR']): if not os.path.isdir(env['CACHEDIR']):
os.mkdir(env['CACHEDIR']) os.mkdir(env['CACHEDIR'])
@ -56,9 +56,9 @@ ie: """+BOLD+"""scons configure debug=full prefix=/usr/local extraincludes=/tmp/
# Special trick for installing rpms ... # Special trick for installing rpms ...
env['DESTDIR']='' env['DESTDIR']=''
if 'install' in sys.argv and os.environ.has_key('DESTDIR'): if 'install' in sys.argv and 'DESTDIR' in os.environ:
env['DESTDIR']=os.environ['DESTDIR']+'/' env['DESTDIR']=os.environ['DESTDIR']+'/'
print CYAN+'** Enabling DESTDIR for the project ** ' + NORMAL + env['DESTDIR'] print(CYAN+'** Enabling DESTDIR for the project ** ' + NORMAL + env['DESTDIR'])
# load the options # load the options
from SCons.Options import Options, PathOption from SCons.Options import Options, PathOption
@ -89,7 +89,7 @@ ie: """+BOLD+"""scons configure debug=full prefix=/usr/local extraincludes=/tmp/
env['_CONFIGURE']=0 env['_CONFIGURE']=0
# configure the environment if needed # configure the environment if needed
if not env['HELP'] and (env['_CONFIGURE'] or not env.has_key('ISCONFIGURED')): if not env['HELP'] and (env['_CONFIGURE'] or 'ISCONFIGURED' not in env):
import re import re
def makeHashTable(args): def makeHashTable(args):
@ -108,40 +108,40 @@ ie: """+BOLD+"""scons configure debug=full prefix=/usr/local extraincludes=/tmp/
env['ARGS']=makeHashTable(sys.argv) env['ARGS']=makeHashTable(sys.argv)
# be paranoid, unset existing variables # be paranoid, unset existing variables
if env.has_key('KDECXXFLAGS'): if 'KDECXXFLAGS' in env:
env.__delitem__('KDECXXFLAGS') env.__delitem__('KDECXXFLAGS')
if env.has_key('KDECCFLAGS'): if 'KDECCFLAGS' in env:
env.__delitem__('KDECCFLAGS') env.__delitem__('KDECCFLAGS')
if env.has_key('KDELINKFLAGS'): if 'KDELINKFLAGS' in env:
env.__delitem__('KDELINKFLAGS') env.__delitem__('KDELINKFLAGS')
if env.has_key('PREFIX'): if 'PREFIX' in env:
env.__delitem__('PREFIX') env.__delitem__('PREFIX')
if env.has_key('EXTRAINCLUDES'): if 'EXTRAINCLUDES' in env:
env.__delitem__('EXTRAINCLUDES') env.__delitem__('EXTRAINCLUDES')
if env.has_key('ISCONFIGURED'): if 'ISCONFIGURED' in env:
env.__delitem__('ISCONFIGURED') env.__delitem__('ISCONFIGURED')
if env['ARGS'].get('debug', None): if env['ARGS'].get('debug', None):
debuglevel = env['ARGS'].get('debug', None) debuglevel = env['ARGS'].get('debug', None)
print CYAN+'** Enabling debug for the project **' + NORMAL print(CYAN+'** Enabling debug for the project **' + NORMAL)
if (debuglevel == "full"): if (debuglevel == "full"):
env['KDECXXFLAGS'] = ['-DDEBUG', '-g3'] env['KDECXXFLAGS'] = ['-DDEBUG', '-g3']
else: else:
env['KDECXXFLAGS'] = ['-DDEBUG', '-g'] env['KDECXXFLAGS'] = ['-DDEBUG', '-g']
else: else:
if os.environ.has_key('CXXFLAGS'): if 'CXXFLAGS' in os.environ:
# user-defined flags (gentooers will be elighted) # user-defined flags (gentooers will be elighted)
env['KDECXXFLAGS'] = SCons.Util.CLVar( os.environ['CXXFLAGS'] ) env['KDECXXFLAGS'] = SCons.Util.CLVar( os.environ['CXXFLAGS'] )
env.Append( KDECXXFLAGS = ['-DNDEBUG', '-DNO_DEBUG'] ) env.Append( KDECXXFLAGS = ['-DNDEBUG', '-DNO_DEBUG'] )
else: else:
env.Append(KDECXXFLAGS = ['-O2', '-DNDEBUG', '-DNO_DEBUG']) env.Append(KDECXXFLAGS = ['-O2', '-DNDEBUG', '-DNO_DEBUG'])
if os.environ.has_key('CFLAGS'): if 'CFLAGS' in os.environ:
env['KDECCFLAGS'] = SCons.Util.CLVar( os.environ['CFLAGS'] ) env['KDECCFLAGS'] = SCons.Util.CLVar( os.environ['CFLAGS'] )
## FreeBSD settings (contributed by will at freebsd dot org) ## FreeBSD settings (contributed by will at freebsd dot org)
if os.uname()[0] == "FreeBSD": if os.uname()[0] == "FreeBSD":
if os.environ.has_key('PTHREAD_LIBS'): if 'PTHREAD_LIBS' in os.environ:
env.AppendUnique( KDELINKFLAGS = SCons.Util.CLVar( os.environ['PTHREAD_LIBS'] ) ) env.AppendUnique( KDELINKFLAGS = SCons.Util.CLVar( os.environ['PTHREAD_LIBS'] ) )
else: else:
syspf = os.popen('/sbin/sysctl kern.osreldate') syspf = os.popen('/sbin/sysctl kern.osreldate')
@ -159,15 +159,15 @@ ie: """+BOLD+"""scons configure debug=full prefix=/usr/local extraincludes=/tmp/
# User-specified prefix # User-specified prefix
if env['ARGS'].get('prefix', None): if env['ARGS'].get('prefix', None):
env['PREFIX'] = env['ARGS'].get('prefix', None) env['PREFIX'] = env['ARGS'].get('prefix', None)
print CYAN+'** set the installation prefix for the project : ' + env['PREFIX'] +' **'+ NORMAL print(CYAN+'** set the installation prefix for the project : ' + env['PREFIX'] +' **'+ NORMAL)
elif env.has_key('PREFIX'): elif 'PREFIX' in env:
env.__delitem__('PREFIX') env.__delitem__('PREFIX')
# User-specified include paths # User-specified include paths
env['EXTRAINCLUDES'] = env['ARGS'].get('extraincludes', None) env['EXTRAINCLUDES'] = env['ARGS'].get('extraincludes', None)
if env['ARGS'].get('extraincludes', None): if env['ARGS'].get('extraincludes', None):
print CYAN+'** set extra include paths for the project : ' + env['EXTRAINCLUDES'] +' **'+ NORMAL print(CYAN+'** set extra include paths for the project : ' + env['EXTRAINCLUDES'] +' **'+ NORMAL)
elif env.has_key('EXTRAINCLUDES'): elif 'EXTRAINCLUDES' in env:
env.__delitem__('EXTRAINCLUDES') env.__delitem__('EXTRAINCLUDES')
env['ISCONFIGURED']=1 env['ISCONFIGURED']=1
@ -175,16 +175,16 @@ ie: """+BOLD+"""scons configure debug=full prefix=/usr/local extraincludes=/tmp/
# And finally save the options in the cache # And finally save the options in the cache
opts.Save(cachefile, env) opts.Save(cachefile, env)
if env.has_key('KDECXXFLAGS'): if 'KDECXXFLAGS' in env:
env.AppendUnique( CPPFLAGS = env['KDECXXFLAGS'] ) env.AppendUnique( CPPFLAGS = env['KDECXXFLAGS'] )
if env.has_key('KDECCFLAGS'): if 'KDECCFLAGS' in env:
env.AppendUnique( CCFLAGS = env['KDECCFLAGS'] ) env.AppendUnique( CCFLAGS = env['KDECCFLAGS'] )
if env.has_key('KDELINKFLAGS'): if 'KDELINKFLAGS' in env:
env.AppendUnique( LINKFLAGS = env['KDELINKFLAGS'] ) env.AppendUnique( LINKFLAGS = env['KDELINKFLAGS'] )
if env.has_key('EXTRAINCLUDES'): if 'EXTRAINCLUDES' in env:
incpaths = [] incpaths = []
for dir in str(env['EXTRAINCLUDES']).split(':'): for dir in str(env['EXTRAINCLUDES']).split(':'):
incpaths.append( dir ) incpaths.append( dir )

@ -43,109 +43,109 @@ def detect_kde(env):
libdir = libdir+libsuffix libdir = libdir+libsuffix
## Detect the kde libraries ## Detect the kde libraries
print "Checking for tde-config : ", print("Checking for tde-config : ", end=' ')
kde_config = os.popen("which tde-config 2>/dev/null").read().strip() kde_config = os.popen("which tde-config 2>/dev/null").read().strip()
if len(kde_config): if len(kde_config):
print GREEN+"tde-config was found"+NORMAL print(GREEN+"tde-config was found"+NORMAL)
else: else:
print RED+"tde-config was NOT found in your PATH"+NORMAL print(RED+"tde-config was NOT found in your PATH"+NORMAL)
print "Make sure kde is installed properly" print("Make sure kde is installed properly")
print "(missing package tdebase-devel?)" print("(missing package tdebase-devel?)")
env.Exit(1) env.Exit(1)
env['TDEDIR'] = os.popen('tde-config -prefix').read().strip() env['TDEDIR'] = os.popen('tde-config -prefix').read().strip()
print "Checking for kde version : ", print("Checking for kde version : ", end=' ')
kde_version = os.popen("tde-config --version|grep KDE").read().strip().split()[1] kde_version = os.popen("tde-config --version|grep KDE").read().strip().split()[1]
if int(kde_version[0]) != 3 or int(kde_version[2]) < 2: if int(kde_version[0]) != 3 or int(kde_version[2]) < 2:
print RED+kde_version print(RED+kde_version)
print RED+"Your kde version can be too old"+NORMAL print(RED+"Your kde version can be too old"+NORMAL)
print RED+"Please make sure kde is at least 3.2"+NORMAL print(RED+"Please make sure kde is at least 3.2"+NORMAL)
else: else:
print GREEN+kde_version+NORMAL print(GREEN+kde_version+NORMAL)
## Detect the qt library ## Detect the qt library
print "Checking for the qt library : ", print("Checking for the qt library : ", end=' ')
qtdir = os.getenv("TQTDIR") qtdir = os.getenv("TQTDIR")
if qtdir: if qtdir:
print GREEN+"qt is in "+qtdir+NORMAL print(GREEN+"qt is in "+qtdir+NORMAL)
else: else:
libdir = os.popen('tde-config --expandvars --install lib').read().strip() libdir = os.popen('tde-config --expandvars --install lib').read().strip()
libtdeuiSO = libdir+'/'+getSOfromLA(libdir+'/libtdeui.la') libtdeuiSO = libdir+'/'+getSOfromLA(libdir+'/libtdeui.la')
m = re.search('(.*)/lib/libtqt.*', os.popen('ldd ' + libtdeuiSO + ' | grep libtqt').read().strip().split()[2]) m = re.search('(.*)/lib/libtqt.*', os.popen('ldd ' + libtdeuiSO + ' | grep libtqt').read().strip().split()[2])
if m: if m:
qtdir = m.group(1) qtdir = m.group(1)
print YELLOW+"qt was found as "+m.group(1)+NORMAL print(YELLOW+"qt was found as "+m.group(1)+NORMAL)
else: else:
print RED+"qt was not found"+NORMAL print(RED+"qt was not found"+NORMAL)
print RED+"Please set TQTDIR first (/usr/lib/qt3?)"+NORMAL print(RED+"Please set TQTDIR first (/usr/lib/qt3?)"+NORMAL)
env.Exit(1) env.Exit(1)
env['TQTDIR'] = qtdir.strip() env['TQTDIR'] = qtdir.strip()
## Find the necessary programs uic and moc ## Find the necessary programs uic and moc
print "Checking for uic : ", print("Checking for uic : ", end=' ')
uic = qtdir + "/bin/uic" uic = qtdir + "/bin/uic"
if os.path.isfile(uic): if os.path.isfile(uic):
print GREEN+"uic was found as "+uic+NORMAL print(GREEN+"uic was found as "+uic+NORMAL)
else: else:
uic = os.popen("which uic 2>/dev/null").read().strip() uic = os.popen("which uic 2>/dev/null").read().strip()
if len(uic): if len(uic):
print YELLOW+"uic was found as "+uic+NORMAL print(YELLOW+"uic was found as "+uic+NORMAL)
else: else:
uic = os.popen("which uic 2>/dev/null").read().strip() uic = os.popen("which uic 2>/dev/null").read().strip()
if len(uic): if len(uic):
print YELLOW+"uic was found as "+uic+NORMAL print(YELLOW+"uic was found as "+uic+NORMAL)
else: else:
print RED+"uic was not found - set TQTDIR put it in your PATH ?"+NORMAL print(RED+"uic was not found - set TQTDIR put it in your PATH ?"+NORMAL)
env.Exit(1) env.Exit(1)
env['QT_UIC'] = uic env['QT_UIC'] = uic
print "Checking for moc : ", print("Checking for moc : ", end=' ')
moc = qtdir + "/bin/moc" moc = qtdir + "/bin/moc"
if os.path.isfile(moc): if os.path.isfile(moc):
print GREEN + "moc was found as " + moc + NORMAL print(GREEN + "moc was found as " + moc + NORMAL)
else: else:
moc = os.popen("which moc 2>/dev/null").read().strip() moc = os.popen("which moc 2>/dev/null").read().strip()
if len(moc): if len(moc):
print YELLOW + "moc was found as " + moc + NORMAL print(YELLOW + "moc was found as " + moc + NORMAL)
elif os.path.isfile("/usr/share/qt3/bin/moc"): elif os.path.isfile("/usr/share/qt3/bin/moc"):
moc = "/usr/share/qt3/bin/moc" moc = "/usr/share/qt3/bin/moc"
print YELLOW + "moc was found as " + moc + NORMAL print(YELLOW + "moc was found as " + moc + NORMAL)
else: else:
print RED + "moc was not found - set TQTDIR or put it in your PATH ?" + NORMAL print(RED + "moc was not found - set TQTDIR or put it in your PATH ?" + NORMAL)
env.Exit(1) env.Exit(1)
env['QT_MOC'] = moc env['QT_MOC'] = moc
## check for the qt and kde includes ## check for the qt and kde includes
print "Checking for the qt includes : ", print("Checking for the qt includes : ", end=' ')
if qtincludes and os.path.isfile(qtincludes + "/qtqlayout.h"): if qtincludes and os.path.isfile(qtincludes + "/qtqlayout.h"):
# The user told where to look for and it looks valid # The user told where to look for and it looks valid
print GREEN + "ok " + qtincludes + NORMAL print(GREEN + "ok " + qtincludes + NORMAL)
else: else:
if os.path.isfile(qtdir + "/include/qtqlayout.h"): if os.path.isfile(qtdir + "/include/qtqlayout.h"):
# Automatic detection # Automatic detection
print GREEN + "ok " + qtdir + "/include/ " + NORMAL print(GREEN + "ok " + qtdir + "/include/ " + NORMAL)
qtincludes = qtdir + "/include/" qtincludes = qtdir + "/include/"
elif os.path.isfile("/usr/include/qt3/qtqlayout.h"): elif os.path.isfile("/usr/include/qt3/qtqlayout.h"):
# Debian probably # Debian probably
print YELLOW + "the qt headers were found in /usr/include/qt3/ " + NORMAL print(YELLOW + "the qt headers were found in /usr/include/qt3/ " + NORMAL)
qtincludes = "/usr/include/qt3" qtincludes = "/usr/include/qt3"
else: else:
print RED + "the qt headers were not found" + NORMAL print(RED + "the qt headers were not found" + NORMAL)
env.Exit(1) env.Exit(1)
print "Checking for the kde includes : ", print("Checking for the kde includes : ", end=' ')
kdeprefix = os.popen("tde-config --prefix").read().strip() kdeprefix = os.popen("tde-config --prefix").read().strip()
if not kdeincludes: if not kdeincludes:
kdeincludes = kdeprefix+"/include/" kdeincludes = kdeprefix+"/include/"
if os.path.isfile(kdeincludes + "/klineedit.h"): if os.path.isfile(kdeincludes + "/klineedit.h"):
print GREEN + "ok " + kdeincludes + NORMAL print(GREEN + "ok " + kdeincludes + NORMAL)
else: else:
if os.path.isfile(kdeprefix+"/include/tde/klineedit.h"): if os.path.isfile(kdeprefix+"/include/tde/klineedit.h"):
# Debian, Fedora probably # Debian, Fedora probably
print YELLOW + "the kde headers were found in " + kdeprefix + "/include/tde/" + NORMAL print(YELLOW + "the kde headers were found in " + kdeprefix + "/include/tde/" + NORMAL)
kdeincludes = kdeprefix + "/include/tde/" kdeincludes = kdeprefix + "/include/tde/"
else: else:
print RED + "The kde includes were NOT found" + NORMAL print(RED + "The kde includes were NOT found" + NORMAL)
env.Exit(1) env.Exit(1)
if prefix: if prefix:
@ -206,7 +206,7 @@ def detect_kde(env):
def generate(env): def generate(env):
""""Set up the qt and kde environment and builders - the moc part is difficult to understand """ """"Set up the qt and kde environment and builders - the moc part is difficult to understand """
if env['HELP']: if env['HELP']:
print """ print("""
"""+BOLD+"""*** KDE options *** """+BOLD+"""*** KDE options ***
-------------------"""+NORMAL+""" -------------------"""+NORMAL+"""
"""+BOLD+"""* prefix """+NORMAL+""": base install path, ie: /usr/local """+BOLD+"""* prefix """+NORMAL+""": base install path, ie: /usr/local
@ -219,7 +219,7 @@ def generate(env):
"""+BOLD+"""* tdelibs """+NORMAL+""": path to the kde libs, for linking the programs """+BOLD+"""* tdelibs """+NORMAL+""": path to the kde libs, for linking the programs
"""+BOLD+"""* tqtlibs """+NORMAL+""": same punishment, for qt libraries """+BOLD+"""* tqtlibs """+NORMAL+""": same punishment, for qt libraries
ie: """+BOLD+"""scons configure libdir=/usr/local/lib qtincludes=/usr/include/qt ie: """+BOLD+"""scons configure libdir=/usr/local/lib qtincludes=/usr/include/qt
"""+NORMAL """+NORMAL)
import SCons.Defaults import SCons.Defaults
import SCons.Tool import SCons.Tool
@ -280,12 +280,12 @@ ie: """+BOLD+"""scons configure libdir=/usr/local/lib qtincludes=/usr/include/qt
if not obj.has_builder(): if not obj.has_builder():
# binary obj file provided # binary obj file provided
if qtdebug: if qtdebug:
print "scons: qt: '%s' seems to be a binary. Discarded." % str(obj) print("scons: qt: '%s' seems to be a binary. Discarded." % str(obj))
continue continue
cpp = obj.sources[0] cpp = obj.sources[0]
if not splitext(str(cpp))[1] in source_extensions: if not splitext(str(cpp))[1] in source_extensions:
if qtdebug: if qtdebug:
print "scons: qt: '%s' is no cxx file. Discarded." % str(cpp) print("scons: qt: '%s' is no cxx file. Discarded." % str(cpp))
# c or fortran source # c or fortran source
continue continue
#cpp_contents = comment.sub('', cpp.get_contents()) #cpp_contents = comment.sub('', cpp.get_contents())
@ -300,7 +300,7 @@ ie: """+BOLD+"""scons configure libdir=/usr/local/lib qtincludes=/usr/include/qt
ui = find_file(uiname, (cpp.get_dir(),), FS.File) ui = find_file(uiname, (cpp.get_dir(),), FS.File)
if ui: if ui:
if qtdebug: if qtdebug:
print "scons: qt: found .ui file of header" #% (str(h), str(cpp)) print("scons: qt: found .ui file of header") #% (str(h), str(cpp))
#h_contents = comment.sub('', h.get_contents()) #h_contents = comment.sub('', h.get_contents())
break break
@ -315,18 +315,18 @@ ie: """+BOLD+"""scons configure libdir=/usr/local/lib qtincludes=/usr/include/qt
h = find_file(hname, (cpp.get_dir(),), FS.File) h = find_file(hname, (cpp.get_dir(),), FS.File)
if h: if h:
if qtdebug: if qtdebug:
print "scons: qt: Scanning '%s' (header of '%s')" % (str(h), str(cpp)) print("scons: qt: Scanning '%s' (header of '%s')" % (str(h), str(cpp)))
#h_contents = comment.sub('', h.get_contents()) #h_contents = comment.sub('', h.get_contents())
h_contents = h.get_contents() h_contents = h.get_contents()
break break
if not h and qtdebug: if not h and qtdebug:
print "scons: qt: no header for '%s'." % (str(cpp)) print("scons: qt: no header for '%s'." % (str(cpp)))
if h and q_object_search.search(h_contents): if h and q_object_search.search(h_contents):
# h file with the Q_OBJECT macro found -> add .moc or _moc.cpp file # h file with the Q_OBJECT macro found -> add .moc or _moc.cpp file
moc_cpp = None moc_cpp = None
if env.has_key('NOMOCSCAN'): if 'NOMOCSCAN' in env:
moc_cpp = env.Moc(h) moc_cpp = env.Moc(h)
else: else:
reg = '\n\s*#include\s*("|<)'+splitext(cpp.name)[0]+'.moc("|>)' reg = '\n\s*#include\s*("|<)'+splitext(cpp.name)[0]+'.moc("|>)'
@ -338,12 +338,12 @@ ie: """+BOLD+"""scons configure libdir=/usr/local/lib qtincludes=/usr/include/qt
moc_o = objBuilder(moc_cpp) moc_o = objBuilder(moc_cpp)
out_sources.append(moc_o) out_sources.append(moc_o)
if qtdebug: if qtdebug:
print "scons: qt: found Q_OBJECT macro in '%s', moc'ing to '%s'" % (str(h), str(moc_cpp[0])) print("scons: qt: found Q_OBJECT macro in '%s', moc'ing to '%s'" % (str(h), str(moc_cpp[0])))
if cpp and q_object_search.search(cpp_contents): if cpp and q_object_search.search(cpp_contents):
print "error, bksys cannot handle cpp files with Q_OBJECT classes" print("error, bksys cannot handle cpp files with Q_OBJECT classes")
print "if you are sure this is a feature worth the effort, " print("if you are sure this is a feature worth the effort, ")
print "report this to the authors tnagyemail-mail yahoo.fr" print("report this to the authors tnagyemail-mail yahoo.fr")
# restore the original env attributes (FIXME) # restore the original env attributes (FIXME)
objBuilder.env = objBuilderEnv objBuilder.env = objBuilderEnv
@ -392,7 +392,7 @@ ie: """+BOLD+"""scons configure libdir=/usr/local/lib qtincludes=/usr/include/qt
opts.Update(env) opts.Update(env)
# reconfigure when things are missing # reconfigure when things are missing
if not env['HELP'] and (env['_CONFIGURE'] or not env.has_key('TQTDIR') or not env.has_key('TDEDIR')): if not env['HELP'] and (env['_CONFIGURE'] or 'TQTDIR' not in env or 'TDEDIR' not in env):
detect_kde(env) detect_kde(env)
# finally save the configuration to the cache file # finally save the configuration to the cache file
@ -501,7 +501,7 @@ ie: """+BOLD+"""scons configure libdir=/usr/local/lib qtincludes=/usr/include/qt
if len(source) <2: if len(source) <2:
if not os.path.isfile(str(source[0])): if not os.path.isfile(str(source[0])):
print RED+'kcfg file given'+str(source[0])+' does not exist !'+NORMAL print(RED+'kcfg file given'+str(source[0])+' does not exist !'+NORMAL)
return target, source return target, source
kfcgfilename="" kfcgfilename=""
kcfgFileDeclRx = re.compile("^[fF]ile\s*=\s*(.+)\s*$") kcfgFileDeclRx = re.compile("^[fF]ile\s*=\s*(.+)\s*$")
@ -604,7 +604,7 @@ ie: """+BOLD+"""scons configure libdir=/usr/local/lib qtincludes=/usr/include/qt
## return a list of things ## return a list of things
def make_list(e): def make_list(e):
if type(e) is types.ListType: if type(e) is list:
return e return e
else: else:
return e.split() return e.split()
@ -650,13 +650,13 @@ ie: """+BOLD+"""scons configure libdir=/usr/local/lib qtincludes=/usr/include/qt
for file in ui_files: for file in ui_files:
for ofile in other_files: for ofile in other_files:
if ofile == file: if ofile == file:
print RED+"WARNING: You have included "+file+".ui and another file of the same prefix"+NORMAL print(RED+"WARNING: You have included "+file+".ui and another file of the same prefix"+NORMAL)
print "Files generated by uic (file.h, file.cpp must not be included" print("Files generated by uic (file.h, file.cpp must not be included")
for file in kcfg_files: for file in kcfg_files:
for ofile in other_files: for ofile in other_files:
if ofile == file: if ofile == file:
print RED+"WARNING: You have included "+file+".kcfg and another file of the same prefix"+NORMAL print(RED+"WARNING: You have included "+file+".kcfg and another file of the same prefix"+NORMAL)
print "Files generated by tdeconfig_compiler (settings.h, settings.cpp) must not be included" print("Files generated by tdeconfig_compiler (settings.h, settings.cpp) must not be included")
return src return src
@ -670,8 +670,8 @@ ie: """+BOLD+"""scons configure libdir=/usr/local/lib qtincludes=/usr/include/qt
return return
basedir=env['DESTDIR'] basedir=env['DESTDIR']
if len(restype)>0: if len(restype)>0:
if not lenv.has_key(restype): if restype not in lenv:
print RED+"unknown resource type "+restype+NORMAL print(RED+"unknown resource type "+restype+NORMAL)
else: else:
basedir += lenv[restype]+'/' basedir += lenv[restype]+'/'
#print file # <- useful to trace stuff :) #print file # <- useful to trace stuff :)
@ -684,8 +684,8 @@ ie: """+BOLD+"""scons configure libdir=/usr/local/lib qtincludes=/usr/include/qt
return return
basedir=env['DESTDIR'] basedir=env['DESTDIR']
if len(restype)>0: if len(restype)>0:
if not lenv.has_key(restype): if restype not in lenv:
print RED+"unknown resource type "+restype+NORMAL print(RED+"unknown resource type "+restype+NORMAL)
else: else:
basedir += lenv[restype]+'/' basedir += lenv[restype]+'/'
install_list = env.InstallAs(basedir+destfile, file) install_list = env.InstallAs(basedir+destfile, file)
@ -697,7 +697,7 @@ ie: """+BOLD+"""scons configure libdir=/usr/local/lib qtincludes=/usr/include/qt
The program is installed except if one sets env['NOAUTOINSTALL'] """ The program is installed except if one sets env['NOAUTOINSTALL'] """
src = KDEfiles(lenv, target, source) src = KDEfiles(lenv, target, source)
program_list = lenv.Program(target, src) program_list = lenv.Program(target, src)
if not lenv.has_key('NOAUTOINSTALL'): if 'NOAUTOINSTALL' not in lenv:
KDEinstall(lenv, 'KDEBIN', '', target) KDEinstall(lenv, 'KDEBIN', '', target)
return program_list return program_list
@ -708,7 +708,7 @@ ie: """+BOLD+"""scons configure libdir=/usr/local/lib qtincludes=/usr/include/qt
lenv['LIBPREFIX']=libprefix lenv['LIBPREFIX']=libprefix
library_list = lenv.SharedLibrary(target, src) library_list = lenv.SharedLibrary(target, src)
lafile_list = lenv.LaFile(target, library_list) lafile_list = lenv.LaFile(target, library_list)
if not lenv.has_key('NOAUTOINSTALL'): if 'NOAUTOINSTALL' not in lenv:
install_dir = 'KDEMODULE' install_dir = 'KDEMODULE'
if kdelib==1: if kdelib==1:
install_dir = 'KDELIBPATH' install_dir = 'KDELIBPATH'
@ -800,13 +800,13 @@ ie: """+BOLD+"""scons configure libdir=/usr/local/lib qtincludes=/usr/include/qt
filename = lst[ len(lst) - 1 ] filename = lst[ len(lst) - 1 ]
tmp = filename.split('-') tmp = filename.split('-')
if len(tmp)!=3: if len(tmp)!=3:
print RED+'WARNING: icon filename has unknown format: '+iconfile+NORMAL print(RED+'WARNING: icon filename has unknown format: '+iconfile+NORMAL)
continue continue
[icon_dir, icon_type, icon_filename]=tmp [icon_dir, icon_type, icon_filename]=tmp
try: try:
destfile = '%s/%s/%s/%s' % (lenv['KDEICONS'], dir_dic[icon_dir], type_dic[icon_type], icon_filename) destfile = '%s/%s/%s/%s' % (lenv['KDEICONS'], dir_dic[icon_dir], type_dic[icon_type], icon_filename)
except KeyError: except KeyError:
print RED+'WARNING: unknown icon type: '+iconfile+NORMAL print(RED+'WARNING: unknown icon type: '+iconfile+NORMAL)
continue continue
## Do not use KDEinstallas here, as parsing from an ide will be necessary ## Do not use KDEinstallas here, as parsing from an ide will be necessary
if env['_INSTALL']: if env['_INSTALL']:

Loading…
Cancel
Save