summaryrefslogtreecommitdiffstats
path: root/parts
diff options
context:
space:
mode:
authorSlávek Banko <slavek.banko@axis.cz>2023-01-16 21:04:18 +0100
committerSlávek Banko <slavek.banko@axis.cz>2023-01-16 21:04:18 +0100
commitb81d9ec9ffdb93cf988e4f74c3f4680340ff184f (patch)
treeee4a606286019b692bb5606abece598e1d1df499 /parts
parent2e6682f7d5d9247244429a117954488816f8450c (diff)
downloadtdevelop-b81d9ec9ffdb93cf988e4f74c3f4680340ff184f.tar.gz
tdevelop-b81d9ec9ffdb93cf988e4f74c3f4680340ff184f.zip
Drop python2 support.r14.1.0
Signed-off-by: Slávek Banko <slavek.banko@axis.cz>
Diffstat (limited to 'parts')
-rw-r--r--parts/appwizard/common/scons/admin/generic.py48
-rw-r--r--parts/appwizard/common/scons/admin/kde.py122
2 files changed, 85 insertions, 85 deletions
diff --git a/parts/appwizard/common/scons/admin/generic.py b/parts/appwizard/common/scons/admin/generic.py
index 55c37c90..52c4e3bc 100644
--- a/parts/appwizard/common/scons/admin/generic.py
+++ b/parts/appwizard/common/scons/admin/generic.py
@@ -31,18 +31,18 @@ def generate(env):
env['HELP']=1
if env['HELP']:
- print """
+ print("""
"""+BOLD+"""*** Generic options ***
-----------------------"""+NORMAL+"""
"""+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+"""* extraincludes """+NORMAL+""": a list of paths separated by ':'
ie: """+BOLD+"""scons configure debug=full prefix=/usr/local extraincludes=/tmp/include:/usr/local
-"""+NORMAL
+"""+NORMAL)
## Global cache directory
## 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/'
if not os.path.isdir(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 ...
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']+'/'
- print CYAN+'** Enabling DESTDIR for the project ** ' + NORMAL + env['DESTDIR']
+ print(CYAN+'** Enabling DESTDIR for the project ** ' + NORMAL + env['DESTDIR'])
# load the options
from SCons.Options import Options, PathOption
@@ -89,7 +89,7 @@ ie: """+BOLD+"""scons configure debug=full prefix=/usr/local extraincludes=/tmp/
env['_CONFIGURE']=0
# 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
def makeHashTable(args):
@@ -108,40 +108,40 @@ ie: """+BOLD+"""scons configure debug=full prefix=/usr/local extraincludes=/tmp/
env['ARGS']=makeHashTable(sys.argv)
# be paranoid, unset existing variables
- if env.has_key('KDECXXFLAGS'):
+ if 'KDECXXFLAGS' in env:
env.__delitem__('KDECXXFLAGS')
- if env.has_key('KDECCFLAGS'):
+ if 'KDECCFLAGS' in env:
env.__delitem__('KDECCFLAGS')
- if env.has_key('KDELINKFLAGS'):
+ if 'KDELINKFLAGS' in env:
env.__delitem__('KDELINKFLAGS')
- if env.has_key('PREFIX'):
+ if 'PREFIX' in env:
env.__delitem__('PREFIX')
- if env.has_key('EXTRAINCLUDES'):
+ if 'EXTRAINCLUDES' in env:
env.__delitem__('EXTRAINCLUDES')
- if env.has_key('ISCONFIGURED'):
+ if 'ISCONFIGURED' in env:
env.__delitem__('ISCONFIGURED')
if 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"):
env['KDECXXFLAGS'] = ['-DDEBUG', '-g3']
else:
env['KDECXXFLAGS'] = ['-DDEBUG', '-g']
else:
- if os.environ.has_key('CXXFLAGS'):
+ if 'CXXFLAGS' in os.environ:
# user-defined flags (gentooers will be elighted)
env['KDECXXFLAGS'] = SCons.Util.CLVar( os.environ['CXXFLAGS'] )
env.Append( KDECXXFLAGS = ['-DNDEBUG', '-DNO_DEBUG'] )
else:
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'] )
## FreeBSD settings (contributed by will at freebsd dot org)
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'] ) )
else:
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
if env['ARGS'].get('prefix', None):
env['PREFIX'] = env['ARGS'].get('prefix', None)
- print CYAN+'** set the installation prefix for the project : ' + env['PREFIX'] +' **'+ NORMAL
- elif env.has_key('PREFIX'):
+ print(CYAN+'** set the installation prefix for the project : ' + env['PREFIX'] +' **'+ NORMAL)
+ elif 'PREFIX' in env:
env.__delitem__('PREFIX')
# User-specified include paths
env['EXTRAINCLUDES'] = env['ARGS'].get('extraincludes', None)
if env['ARGS'].get('extraincludes', None):
- print CYAN+'** set extra include paths for the project : ' + env['EXTRAINCLUDES'] +' **'+ NORMAL
- elif env.has_key('EXTRAINCLUDES'):
+ print(CYAN+'** set extra include paths for the project : ' + env['EXTRAINCLUDES'] +' **'+ NORMAL)
+ elif 'EXTRAINCLUDES' in env:
env.__delitem__('EXTRAINCLUDES')
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
opts.Save(cachefile, env)
- if env.has_key('KDECXXFLAGS'):
+ if 'KDECXXFLAGS' in env:
env.AppendUnique( CPPFLAGS = env['KDECXXFLAGS'] )
- if env.has_key('KDECCFLAGS'):
+ if 'KDECCFLAGS' in env:
env.AppendUnique( CCFLAGS = env['KDECCFLAGS'] )
- if env.has_key('KDELINKFLAGS'):
+ if 'KDELINKFLAGS' in env:
env.AppendUnique( LINKFLAGS = env['KDELINKFLAGS'] )
- if env.has_key('EXTRAINCLUDES'):
+ if 'EXTRAINCLUDES' in env:
incpaths = []
for dir in str(env['EXTRAINCLUDES']).split(':'):
incpaths.append( dir )
diff --git a/parts/appwizard/common/scons/admin/kde.py b/parts/appwizard/common/scons/admin/kde.py
index 84b2c812..c67e0f41 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
@@ -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
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 Q_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 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")
# 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*$")
@@ -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']: