diff options
author | Michele Calgaro <michele.calgaro@yahoo.it> | 2023-01-03 15:29:41 +0900 |
---|---|---|
committer | Michele Calgaro <michele.calgaro@yahoo.it> | 2023-01-07 22:14:56 +0900 |
commit | 4ce11cc30df1805459a615960fdec204a975548a (patch) | |
tree | 084f1e1fa404bdf0d082b1a58acf392b5d177326 /configure.py | |
parent | 065f41b4908b11278d4334e8c85150ec0fd4a9f6 (diff) | |
download | pytde-4ce11cc30df1805459a615960fdec204a975548a.tar.gz pytde-4ce11cc30df1805459a615960fdec204a975548a.zip |
Drop python2 support.
Signed-off-by: Michele Calgaro <michele.calgaro@yahoo.it>
Diffstat (limited to 'configure.py')
-rw-r--r-- | configure.py | 130 |
1 files changed, 64 insertions, 66 deletions
diff --git a/configure.py b/configure.py index fde3a4d..9ee62de 100644 --- a/configure.py +++ b/configure.py @@ -167,10 +167,10 @@ def check_gcc (): os.system ("gcc -dumpversion > gccvers.txt") m = open ('gccvers.txt', 'r') - vers = m.read ().strip () + vers = m.read().strip() m.close () os.unlink ('gccvers.txt') - print "gcc version %s" % vers + print("gcc version %s" % vers) if opt_concat == None: if vers < "4.0.0" or vers >= "4.0.3": @@ -179,10 +179,10 @@ def check_gcc (): opt_concat = 0 if opt_concat == 1: - print "concatenating files" + print("concatenating files") else: - print "no concatenation" - print + print("no concatenation") + print() def init_and_check_sanity (): """ Do some initialization and check various versions and @@ -225,25 +225,25 @@ def usage(rcode = 2): rcode is the return code passed back to the calling process. """ - print "Usage:" - print " python configure.py [-h] [-c] [-d dir] [-g] [-j #] [-k] [-n dir] [-o dir] [-r] [-u] [-v dir] [-z file]" - print "where:" - print " -h displays this help message" - print " -c concatenates each module's C/C++ source files [default]" - print " -d dir where the PyKDE modules will be installed [default %s]" % opt_pytdemoddir - print " -e lib explicitly specify the python library" - print " -g always release the GIL (SIP-TQt v3.x behaviour)" - print " -i no concatenation of each module's C/C++ source files" - print " -j # splits the concatenated C++ source files into # pieces [default 1]" - print " -k dir the KDE base directory" - print " -L dir the library directory name [default lib]" - print " -n dir the directory containing the KDE lib files" - print " -o dir the directory containing the KDE header files" - print " -r generates code with tracing enabled [default disabled]" - print " -u build with debugging symbols" - print " -v dir where the PyKDE .sip files will be installed [default %s]" % opt_pytdesipdir - print " -w turn on KDE deprecated object warnings when compiling [default off]" - print " -z file the name of a file containing command line flags" + print("Usage:") + print(" python configure.py [-h] [-c] [-d dir] [-g] [-j #] [-k] [-n dir] [-o dir] [-r] [-u] [-v dir] [-z file]") + print("where:") + print(" -h displays this help message") + print(" -c concatenates each module's C/C++ source files [default]") + print(" -d dir where the PyKDE modules will be installed [default %s]" % opt_pytdemoddir) + print(" -e lib explicitly specify the python library") + print(" -g always release the GIL (SIP-TQt v3.x behaviour)") + print(" -i no concatenation of each module's C/C++ source files") + print(" -j # splits the concatenated C++ source files into # pieces [default 1]") + print(" -k dir the KDE base directory") + print(" -L dir the library directory name [default lib]") + print(" -n dir the directory containing the KDE lib files") + print(" -o dir the directory containing the KDE header files") + print(" -r generates code with tracing enabled [default disabled]") + print(" -u build with debugging symbols") + print(" -v dir where the PyKDE .sip files will be installed [default %s]" % opt_pytdesipdir) + print(" -w turn on KDE deprecated object warnings when compiling [default off]") + print(" -z file the name of a file containing command line flags") sys.exit(rcode) @@ -252,23 +252,23 @@ def inform_user(stage): """Tell the user the option values that are going to be used. """ if stage == 0: - print - print " PyKDE version %s" % pytde_version_str - print " -------" - print + print() + print(" PyKDE version %s" % pytde_version_str) + print(" -------") + print() sip_tqt_config.inform ("Python include directory is %s" % sipcfg.py_inc_dir) sip_tqt_config.inform ("Python version is %s" % sip_tqt_config.version_to_string (sipcfg.py_version)) - print + print() sip_tqt_config.inform ("sip-tqt version is %s (%s)" % (sipcfg.sip_version_str, sip_tqt_config.version_to_string (sipcfg.sip_version))) - print + print() sip_tqt_config.inform ("TQt directory is %s" % pyqtcfg.qt_dir) sip_tqt_config.inform ("TQt version is %s" % sip_tqt_config.version_to_string (pyqtcfg.qt_version)) - print + print() sip_tqt_config.inform ("PyTQt directory is %s" % pyqtcfg.pyqt_sip_dir) sip_tqt_config.inform ("PyTQt version is %s (%s)" % (pyqtcfg.pyqt_version_str, sip_tqt_config.version_to_string (pyqtcfg.pyqt_version))) - print + print() elif stage == 1: sip_tqt_config.inform ("KDE base directory is %s" % opt_tdebasedir) @@ -278,11 +278,11 @@ def inform_user(stage): elif stage == 2: sip_tqt_config.inform ("KDE version is %s (0x%x)" % (kde_version_str, kde_version)) - print + print() sip_tqt_config.inform("PyKDE modules will be installed in %s" % opt_pytdemoddir) sip_tqt_config.inform("PyKDE .sip files will be installed in %s" % opt_pytdesipdir) - print + print() @@ -332,16 +332,16 @@ def getKDEVersion (versFile): ok = 0 while not ok and l: - wl = string.split(l) + wl = l.split() if len(wl) == 3 and wl[0] == "#define": if wl[1] == "TDE_VERSION_MAJOR": - major = string.strip (wl[2]) + major = wl[2].strip() if wl[1] == "TDE_VERSION_MINOR": - minor = string.strip (wl[2]) + minor = wl[2].strip() if wl[1] == "TDE_VERSION_RELEASE": - micro = string.strip (wl[2]) + micro = wl[2].strip() if major and minor and micro: ok = 1 @@ -357,18 +357,18 @@ def getKDEVersion (versFile): kde_version = (int (major) << 16) + (int (minor) << 8) + int (micro) if kde_version > kde_max_version: - print + print() sip_tqt_config.inform ("*** True KDE version is %s -- building for KDE %s ***" % (hex (kde_version), hex (kde_max_version))) - print + print() kde_version = kde_max_version major = hex ((kde_version & 0xff0000) >> 16) [ 2:] minor = hex ((kde_version & 0x00ff00) >> 8) [ 2:] micro = hex (kde_version & 0x0000ff) [ 2:] if ok: - kde_version_str = string.join ([major, minor, micro], ".") - kde_version_sfx = string.join (["-kde", major, minor, micro, ".diff"], "") - kde_version_extra = string.join (["kde", major, minor, micro], "") + kde_version_str = ".".join([major, minor, micro]) + kde_version_sfx = "".join(["-kde", major, minor, micro, ".diff"]) + kde_version_extra = "".join(["kde", major, minor, micro]) else: sip_tqt_config.error ("KDE version not found in %s" % versFile) @@ -454,9 +454,9 @@ def create_top_level (mname): d = open (diff) line = d.readline() while line: - if string.find (line, "+") == 0: + if line.find ("+") == 0: plus.append (line [2:]) - elif string.find (line, "-") == 0: + elif line.find ("-") == 0: minus.append (line [2:]) line = d.readline() @@ -466,16 +466,16 @@ def create_top_level (mname): line = sipin.readline() while line: - if string.find (line, "%Include") == 0: + if line.find("%Include") == 0: inclFound = 1 if minus and line in minus: line = sipin.readline() continue sipout.write (line) - elif string.find (line, "@mark@") == 0: + elif line.find ("@mark@") == 0: for p in plus: sipout.write (p) - elif mname == "tdeabc" and kde_version < 0x030200 and string.find (line, "tderesourcesmod.sip") >= 0: + elif mname == "tdeabc" and kde_version < 0x030200 and line.find("tderesourcesmod.sip") >= 0: pass else: sipout.write (line) @@ -629,20 +629,19 @@ def generate_code(mname, imports=None, extra_cflags=None, extra_cxxflags=None, e argv.append (pyqtcfg.pyqt_sip_dir) pyqtInclPathSeen = 1 - elif mod == "dcop" or string.find (mod, "k") == 0 or string.find (mod, "tde") == 0: + elif mod == "dcop" or mod.find("k") == 0 or mod.find("tde") == 0: subdir = os.path.join(srcPath("sip"), mod) argv.append("-I") argv.append(subdir) # SIP-TQt assumes POSIX style path separators. - argv.append(srcPath(string.join(["sip", mname, mname + "mod.sip"], "/"))) + argv.append(srcPath("/".join(["sip", mname, mname + "mod.sip"]))) -# print string.join (argv) # finally, run SIP-TQt and generate the C++ code - os.system (string.join(argv)) + os.system (" ".join(argv)) # post process the C++ code for TQT_NO_TRANSLATION - if os.system (string.join ([sys.executable, srcPath("postproc")] + ['-p', mname, "-o", "tr", "*.cpp"])) != 0: + if os.system (" ".join ([sys.executable, srcPath("postproc")] + ['-p', mname, "-o", "tr", "*.cpp"])) != 0: sip_tqt_config.error ("Post processing of C++ code failed %s (tr)" % mname) # Check the result. @@ -662,7 +661,7 @@ def generate_code(mname, imports=None, extra_cflags=None, extra_cxxflags=None, e # needs to be here (not earlier) to catch .py files if any if postProcess [mname]: for s in postProcess [mname]: - if os.system (string.join ([sys.executable, srcPath("postproc")] + s)) != 0: + if os.system (" ".join ([sys.executable, srcPath("postproc")] + s)) != 0: sip_tqt_config.error ("Post processing of C++ code failed %s (%s)" % (mname, s [3])) # Generate the Makefile. @@ -777,7 +776,7 @@ def generate_code(mname, imports=None, extra_cflags=None, extra_cxxflags=None, e makefile.extra_libs.insert(0, makefile.module_as_lib(im)) makefile.generate() - print + print() def create_makefiles(): @@ -806,14 +805,14 @@ def fileOpts (fn): if (line [0] == '#') or (line == '\n'): continue elif line [0] == '-': - opts.append ((line [0:2], string.strip (line [2:]))) + opts.append ((line [0:2], line[2:].strip())) else: - opts.append (("-" + line [0:1], string.strip (line [1:]))) + opts.append (("-" + line [0:1], line[1:].strip())) - print 'Additional options: ', + print('Additional options: ', end=' ') for opt, arg in opts: - print "%s %s " %(opt, arg) - print + print("%s %s " %(opt, arg)) + print() return opts @@ -928,7 +927,7 @@ def main(argv): except: sip_tqt_config.error ("%s is not a PyKDE module" % opt_startModName) - print "PyKDE modules to be built:\n %s\n" % string.join(pytde_modules [opt_startmod:opt_endmod]) + print("PyKDE modules to be built:\n %s\n" % " ".join(pytde_modules[opt_startmod:opt_endmod])) set_sip_flags() @@ -946,7 +945,7 @@ def main(argv): def reporting_msg (): - print """ + print(""" If reporting errors, paste all of the output above into your message and post to the PyKDE mailing list at: @@ -954,7 +953,7 @@ message and post to the PyKDE mailing list at: subscribe: http://mats.imk.fraunhofer.de/mailman/listinfo/pytde You can redirect the output into a file (> output.txt) if needed -""" +""") @@ -970,9 +969,8 @@ if __name__ == "__main__": raise except: reporting_msg () - print \ -""" + print(""" An internal error occured. Please report all output from the program, including the following traceback, to the PyKDE mailing list -""" +""") raise |