summaryrefslogtreecommitdiffstats
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
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>
-rw-r--r--languages/python/app_templates/pyqt/app.py2
-rw-r--r--languages/python/app_templates/pyqt/pyqt-am-preproc.py6
-rw-r--r--languages/python/app_templates/pythonhello/app.py2
-rw-r--r--languages/python/app_templates/pytk/app.py2
-rwxr-xr-xlanguages/python/kde_pydoc.py28
-rw-r--r--languages/python/pydoc.cpp8
-rw-r--r--parts/appwizard/common/scons/admin/generic.py48
-rw-r--r--parts/appwizard/common/scons/admin/kde.py122
8 files changed, 111 insertions, 107 deletions
diff --git a/languages/python/app_templates/pyqt/app.py b/languages/python/app_templates/pyqt/app.py
index ede8dc54..d2207de3 100644
--- a/languages/python/app_templates/pyqt/app.py
+++ b/languages/python/app_templates/pyqt/app.py
@@ -133,7 +133,7 @@ class %{APPNAME}(QMainWindow):
def slotOpenFile(self):
fileName = str(QFileDialog.getOpenFileName("", "", self))
- print fileName
+ print(fileName)
if not fileName=="":
self.load(fileName)
else:
diff --git a/languages/python/app_templates/pyqt/pyqt-am-preproc.py b/languages/python/app_templates/pyqt/pyqt-am-preproc.py
index ff7b5a16..b58f3328 100644
--- a/languages/python/app_templates/pyqt/pyqt-am-preproc.py
+++ b/languages/python/app_templates/pyqt/pyqt-am-preproc.py
@@ -7,7 +7,7 @@
# Test real_lines properly
# Process Makefile.am's in sub-directories
-from __future__ import generators
+
import sys
import re
@@ -49,13 +49,13 @@ for l in real_lines(mf):
variables[lhs]=rhs
# look for app sources
-for (var,data) in variables.items():
+for (var,data) in list(variables.items()):
spl = var.split("_",1)
spl.append("")
(prefix,primary) = (spl[0], spl[1])
if primary=="PROGRAMS":
target=data
- if variables.has_key(target + "_SOURCES"):
+ if target + "_SOURCES" in variables:
sources = variables[target+"_SOURCES"].split()
# change .ui into .py
diff --git a/languages/python/app_templates/pythonhello/app.py b/languages/python/app_templates/pythonhello/app.py
index 3257ce62..33b8be2c 100644
--- a/languages/python/app_templates/pythonhello/app.py
+++ b/languages/python/app_templates/pythonhello/app.py
@@ -1,7 +1,7 @@
#!/usr/bin/env python
def main():
- print 'Hello world!'
+ print('Hello world!')
main()
diff --git a/languages/python/app_templates/pytk/app.py b/languages/python/app_templates/pytk/app.py
index 39f4aa84..d86508cf 100644
--- a/languages/python/app_templates/pytk/app.py
+++ b/languages/python/app_templates/pytk/app.py
@@ -1,4 +1,4 @@
-from Tkinter import *
+from tkinter import *
widget = Label(None, text='Hello world!')
widget.pack()
widget.mainloop()
diff --git a/languages/python/kde_pydoc.py b/languages/python/kde_pydoc.py
index 0516f172..c7c246bc 100755
--- a/languages/python/kde_pydoc.py
+++ b/languages/python/kde_pydoc.py
@@ -6,7 +6,7 @@ __author__ = "David Nolden<david.kde@art-master.de>, Ka-Ping Yee <ping@lfw.org>
__version__ = "6 April 2006"
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
import pydoc
@@ -67,9 +67,9 @@ def writedocs(path, pkgpath='', depth=0, notprocessed=[]):
if(depth == 1):
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:
- print cgi.escape(x) + " <br>"
+ print(cgi.escape(x) + " <br>")
def writedoc(key,top=False):
"""Write HTML documentation to a file in the current directory."""
@@ -86,19 +86,19 @@ def writedoc(key,top=False):
seen = {}
for dir in pydoc.pathdirs():
indices.append(pydoc.html.index(dir, seen))
- print cleanlinks(heading + join(indices))
+ print(cleanlinks(heading + join(indices)))
return
if(type(key) != types.ModuleType):
object = pydoc.locate(key)
if(object == None and top):
- print "could not locate module/object for key " + \
- cgi.escape(key) + "<br><a href=\"pydoc:modules\">go to index</a>";
+ print("could not locate module/object for key " + \
+ cgi.escape(key) + "<br><a href=\"pydoc:modules\">go to index</a>");
else:
object = key
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:
opts, args = getopt.getopt(sys.argv[1:], 'k:p:w')
- print "<html>"
- print "<head><meta http-equiv=\"Content-Type\" content=\"text/html; charset=utf-8\">"
- print "</head><body>"
+ print("<html>")
+ print("<head><meta http-equiv=\"Content-Type\" content=\"text/html; charset=utf-8\">")
+ print("</head><body>")
if args:
for arg in args:
@@ -121,11 +121,11 @@ if __name__ == '__main__':
if os.path.isfile(arg):
arg = pydoc.importfile(arg)
writedoc(arg, True)
- except pydoc.ErrorDuringImport, value:
- print 'problem in %s - %s' % (
- cgi.escape(value.filename), cgi.escape(value.exc))
+ except pydoc.ErrorDuringImport as value:
+ print('problem in %s - %s' % (
+ cgi.escape(value.filename), cgi.escape(value.exc)))
else:
raise BadUsage
except (getopt.error, BadUsage):
- print "need parameters\n"
+ print("need parameters\n")
diff --git a/languages/python/pydoc.cpp b/languages/python/pydoc.cpp
index bcb38b1e..86027d3a 100644
--- a/languages/python/pydoc.cpp
+++ b/languages/python/pydoc.cpp
@@ -19,8 +19,12 @@ using namespace TDEIO;
PydocProtocol::PydocProtocol(const TQCString &pool, const TQCString &app)
: SlaveBase("pydoc", pool, app), key()
{
- python = TDEGlobal::dirs()->findExe("python");
- script = locate("data", "tdeio_pydoc/kde_pydoc.py");
+ python = TDEGlobal::dirs()->findExe("python3");
+ if(python.isEmpty())
+ {
+ python = TDEGlobal::dirs()->findExe("python");
+ }
+ script = locate("data", "tdeio_pydoc/kde_pydoc.py");
}
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']: