summaryrefslogtreecommitdiffstats
path: root/parts/appwizard/common/scons/admin/kde.py
diff options
context:
space:
mode:
Diffstat (limited to 'parts/appwizard/common/scons/admin/kde.py')
-rw-r--r--parts/appwizard/common/scons/admin/kde.py130
1 files changed, 65 insertions, 65 deletions
diff --git a/parts/appwizard/common/scons/admin/kde.py b/parts/appwizard/common/scons/admin/kde.py
index 84b2c812..3d54ce93 100644
--- a/parts/appwizard/common/scons/admin/kde.py
+++ b/parts/appwizard/common/scons/admin/kde.py
@@ -43,109 +43,109 @@ def detect_kde(env):
libdir = libdir+libsuffix
## 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()
if len(kde_config):
- print GREEN+"tde-config was found"+NORMAL
+ print(GREEN+"tde-config was found"+NORMAL)
else:
- print RED+"tde-config was NOT found in your PATH"+NORMAL
- print "Make sure kde is installed properly"
- print "(missing package tdebase-devel?)"
+ print(RED+"tde-config was NOT found in your PATH"+NORMAL)
+ print("Make sure kde is installed properly")
+ print("(missing package tdebase-devel?)")
env.Exit(1)
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]
if int(kde_version[0]) != 3 or int(kde_version[2]) < 2:
- print RED+kde_version
- print RED+"Your kde version can be too old"+NORMAL
- print RED+"Please make sure kde is at least 3.2"+NORMAL
+ print(RED+kde_version)
+ print(RED+"Your kde version can be too old"+NORMAL)
+ print(RED+"Please make sure kde is at least 3.2"+NORMAL)
else:
- print GREEN+kde_version+NORMAL
+ print(GREEN+kde_version+NORMAL)
## Detect the qt library
- print "Checking for the qt library : ",
+ print("Checking for the qt library : ", end=' ')
qtdir = os.getenv("TQTDIR")
if qtdir:
- print GREEN+"qt is in "+qtdir+NORMAL
+ print(GREEN+"qt is in "+qtdir+NORMAL)
else:
libdir = os.popen('tde-config --expandvars --install lib').read().strip()
libtdeuiSO = libdir+'/'+getSOfromLA(libdir+'/libtdeui.la')
m = re.search('(.*)/lib/libtqt.*', os.popen('ldd ' + libtdeuiSO + ' | grep libtqt').read().strip().split()[2])
if m:
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:
- print RED+"qt was not found"+NORMAL
- print RED+"Please set TQTDIR first (/usr/lib/qt3?)"+NORMAL
+ print(RED+"qt was not found"+NORMAL)
+ print(RED+"Please set TQTDIR first (/usr/lib/qt3?)"+NORMAL)
env.Exit(1)
env['TQTDIR'] = qtdir.strip()
## Find the necessary programs uic and moc
- print "Checking for uic : ",
+ print("Checking for uic : ", end=' ')
uic = qtdir + "/bin/uic"
if os.path.isfile(uic):
- print GREEN+"uic was found as "+uic+NORMAL
+ print(GREEN+"uic was found as "+uic+NORMAL)
else:
uic = os.popen("which uic 2>/dev/null").read().strip()
if len(uic):
- print YELLOW+"uic was found as "+uic+NORMAL
+ print(YELLOW+"uic was found as "+uic+NORMAL)
else:
uic = os.popen("which uic 2>/dev/null").read().strip()
if len(uic):
- print YELLOW+"uic was found as "+uic+NORMAL
+ print(YELLOW+"uic was found as "+uic+NORMAL)
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['QT_UIC'] = uic
- print "Checking for moc : ",
+ print("Checking for moc : ", end=' ')
moc = qtdir + "/bin/moc"
if os.path.isfile(moc):
- print GREEN + "moc was found as " + moc + NORMAL
+ print(GREEN + "moc was found as " + moc + NORMAL)
else:
moc = os.popen("which moc 2>/dev/null").read().strip()
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"):
moc = "/usr/share/qt3/bin/moc"
- print YELLOW + "moc was found as " + moc + NORMAL
+ print(YELLOW + "moc was found as " + moc + NORMAL)
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['QT_MOC'] = moc
## 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"):
# The user told where to look for and it looks valid
- print GREEN + "ok " + qtincludes + NORMAL
+ print(GREEN + "ok " + qtincludes + NORMAL)
else:
if os.path.isfile(qtdir + "/include/qtqlayout.h"):
# Automatic detection
- print GREEN + "ok " + qtdir + "/include/ " + NORMAL
+ print(GREEN + "ok " + qtdir + "/include/ " + NORMAL)
qtincludes = qtdir + "/include/"
elif os.path.isfile("/usr/include/qt3/qtqlayout.h"):
# 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"
else:
- print RED + "the qt headers were not found" + NORMAL
+ print(RED + "the qt headers were not found" + NORMAL)
env.Exit(1)
- print "Checking for the kde includes : ",
+ print("Checking for the kde includes : ", end=' ')
kdeprefix = os.popen("tde-config --prefix").read().strip()
if not kdeincludes:
kdeincludes = kdeprefix+"/include/"
if os.path.isfile(kdeincludes + "/klineedit.h"):
- print GREEN + "ok " + kdeincludes + NORMAL
+ print(GREEN + "ok " + kdeincludes + NORMAL)
else:
if os.path.isfile(kdeprefix+"/include/tde/klineedit.h"):
# 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/"
else:
- print RED + "The kde includes were NOT found" + NORMAL
+ print(RED + "The kde includes were NOT found" + NORMAL)
env.Exit(1)
if prefix:
@@ -206,7 +206,7 @@ def detect_kde(env):
def generate(env):
""""Set up the qt and kde environment and builders - the moc part is difficult to understand """
if env['HELP']:
- print """
+ print("""
"""+BOLD+"""*** KDE options ***
-------------------"""+NORMAL+"""
"""+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+"""* tqtlibs """+NORMAL+""": same punishment, for qt libraries
ie: """+BOLD+"""scons configure libdir=/usr/local/lib qtincludes=/usr/include/qt
-"""+NORMAL
+"""+NORMAL)
import SCons.Defaults
import SCons.Tool
@@ -264,8 +264,8 @@ ie: """+BOLD+"""scons configure libdir=/usr/local/lib qtincludes=/usr/include/qt
objBuilder = getattr(env, self.objBuilderName)
# some regular expressions:
- # Q_OBJECT detection
- q_object_search = re.compile(r'[^A-Za-z0-9]Q_OBJECT[^A-Za-z0-9]')
+ # TQ_OBJECT detection
+ q_object_search = re.compile(r'[^A-Za-z0-9]TQ_OBJECT[^A-Za-z0-9]')
# The following is kind of hacky to get builders working properly (FIXME) ??
objBuilderEnv = objBuilder.env
@@ -280,12 +280,12 @@ ie: """+BOLD+"""scons configure libdir=/usr/local/lib qtincludes=/usr/include/qt
if not obj.has_builder():
# binary obj file provided
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
cpp = obj.sources[0]
if not splitext(str(cpp))[1] in source_extensions:
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
continue
#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)
if ui:
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())
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)
if h:
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 = h.get_contents()
break
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):
- # h file with the Q_OBJECT macro found -> add .moc or _moc.cpp file
+ # h file with the TQ_OBJECT macro found -> add .moc or _moc.cpp file
moc_cpp = None
- if env.has_key('NOMOCSCAN'):
+ if 'NOMOCSCAN' in env:
moc_cpp = env.Moc(h)
else:
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)
out_sources.append(moc_o)
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 TQ_OBJECT macro in '%s', moc'ing to '%s'" % (str(h), str(moc_cpp[0])))
if cpp and q_object_search.search(cpp_contents):
- print "error, bksys cannot handle cpp files with Q_OBJECT classes"
- print "if you are sure this is a feature worth the effort, "
- print "report this to the authors tnagyemail-mail yahoo.fr"
+ print("error, bksys cannot handle cpp files with TQ_OBJECT classes")
+ print("if you are sure this is a feature worth the effort, ")
+ print("report this to the authors tnagyemail-mail yahoo.fr")
# restore the original env attributes (FIXME)
objBuilder.env = objBuilderEnv
@@ -392,7 +392,7 @@ ie: """+BOLD+"""scons configure libdir=/usr/local/lib qtincludes=/usr/include/qt
opts.Update(env)
# 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)
# 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 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
kfcgfilename=""
kcfgFileDeclRx = re.compile("^[fF]ile\s*=\s*(.+)\s*$")
@@ -523,7 +523,7 @@ ie: """+BOLD+"""scons configure libdir=/usr/local/lib qtincludes=/usr/include/qt
def dcopGenerator(target, source, env, for_signature):
act=[]
act.append('dcopidl '+source[0].path+' > '+target[1].path+'|| ( rm -f '+target[1].path+' ; false)')
- act.append('dcopidl2cpp --c++-suffix cpp --no-Q_SIGNALS --no-stub '+target[1].path)
+ act.append('dcopidl2cpp --c++-suffix cpp --no-signals --no-stub '+target[1].path)
return act
def dcopEmitter(target, source, env):
@@ -604,7 +604,7 @@ ie: """+BOLD+"""scons configure libdir=/usr/local/lib qtincludes=/usr/include/qt
## return a list of things
def make_list(e):
- if type(e) is types.ListType:
+ if type(e) is list:
return e
else:
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 ofile in other_files:
if ofile == file:
- 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(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")
for file in kcfg_files:
for ofile in other_files:
if ofile == file:
- 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(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")
return src
@@ -670,8 +670,8 @@ ie: """+BOLD+"""scons configure libdir=/usr/local/lib qtincludes=/usr/include/qt
return
basedir=env['DESTDIR']
if len(restype)>0:
- if not lenv.has_key(restype):
- print RED+"unknown resource type "+restype+NORMAL
+ if restype not in lenv:
+ print(RED+"unknown resource type "+restype+NORMAL)
else:
basedir += lenv[restype]+'/'
#print file # <- useful to trace stuff :)
@@ -684,8 +684,8 @@ ie: """+BOLD+"""scons configure libdir=/usr/local/lib qtincludes=/usr/include/qt
return
basedir=env['DESTDIR']
if len(restype)>0:
- if not lenv.has_key(restype):
- print RED+"unknown resource type "+restype+NORMAL
+ if restype not in lenv:
+ print(RED+"unknown resource type "+restype+NORMAL)
else:
basedir += lenv[restype]+'/'
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'] """
src = KDEfiles(lenv, target, source)
program_list = lenv.Program(target, src)
- if not lenv.has_key('NOAUTOINSTALL'):
+ if 'NOAUTOINSTALL' not in lenv:
KDEinstall(lenv, 'KDEBIN', '', target)
return program_list
@@ -708,7 +708,7 @@ ie: """+BOLD+"""scons configure libdir=/usr/local/lib qtincludes=/usr/include/qt
lenv['LIBPREFIX']=libprefix
library_list = lenv.SharedLibrary(target, src)
lafile_list = lenv.LaFile(target, library_list)
- if not lenv.has_key('NOAUTOINSTALL'):
+ if 'NOAUTOINSTALL' not in lenv:
install_dir = 'KDEMODULE'
if kdelib==1:
install_dir = 'KDELIBPATH'
@@ -800,13 +800,13 @@ ie: """+BOLD+"""scons configure libdir=/usr/local/lib qtincludes=/usr/include/qt
filename = lst[ len(lst) - 1 ]
tmp = filename.split('-')
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
[icon_dir, icon_type, icon_filename]=tmp
try:
destfile = '%s/%s/%s/%s' % (lenv['KDEICONS'], dir_dic[icon_dir], type_dic[icon_type], icon_filename)
except KeyError:
- print RED+'WARNING: unknown icon type: '+iconfile+NORMAL
+ print(RED+'WARNING: unknown icon type: '+iconfile+NORMAL)
continue
## Do not use KDEinstallas here, as parsing from an ide will be necessary
if env['_INSTALL']: