diff -r b0996e4a289e -r 1d8dd9706f46 install.py --- a/install.py Fri Jan 01 16:11:36 2010 +0000 +++ b/install.py Sat Jan 02 15:11:35 2010 +0000 @@ -1,4 +1,4 @@ -#!/usr/bin/env python +#!/usr/bin/env python3 # -*- coding: utf-8 -*- # Copyright (c) 2002-2009 Detlev Offenbach <detlev@die-offenbachs.de> @@ -39,35 +39,35 @@ """ global progName, platBinDir, modDir, distDir, apisDir - print - print "Usage:" - print " %s [-chxz] [-a dir] [-b dir] [-d dir] [-f file] [-i dir]" % (progName) - print "where:" - print " -h display this help message" - print " -a dir where the API files will be installed" + print() + print("Usage:") + print(" %s [-chxz] [-a dir] [-b dir] [-d dir] [-f file] [-i dir]" % (progName)) + print("where:") + print(" -h display this help message") + print(" -a dir where the API files will be installed") if apisDir: - print " (default: %s)" % (apisDir) + print(" (default: %s)" % (apisDir)) else: - print " (no default value)" - print " -b dir where the binaries will be installed" - print " (default: %s)" % (platBinDir) - print " -d dir where eric4 python files will be installed" - print " (default: %s)" % (modDir) - print " -f file configuration file naming the various installation paths" + print(" (no default value)") + print(" -b dir where the binaries will be installed") + print(" (default: %s)" % (platBinDir)) + print(" -d dir where eric4 python files will be installed") + print(" (default: %s)" % (modDir)) + print(" -f file configuration file naming the various installation paths") if not sys.platform.startswith("win"): - print " -i dir temporary install prefix" - print " (default: %s)" % (distDir) - print " -x don't perform dependency checks (use on your own risk)" - print " -c don't cleanup old installation first" - print " -z don't compile the installed python files" - print - print "The file given to the -f option must be valid Python code defining a" - print "dictionary called 'cfg' with the keys 'ericDir', 'ericPixDir', 'ericIconDir'," - print "'ericDTDDir', 'ericCSSDir', 'ericStylesDir', 'ericDocDir', 'ericExamplesDir'," - print "'ericTranslationsDir', 'ericTemplatesDir', 'ericCodeTemplatesDir'," - print "'ericOthersDir','bindir', 'mdir' and 'apidir." - print "These define the directories for the installation of the various parts of"\ - " eric4." + print(" -i dir temporary install prefix") + print(" (default: %s)" % (distDir)) + print(" -x don't perform dependency checks (use on your own risk)") + print(" -c don't cleanup old installation first") + print(" -z don't compile the installed python files") + print() + print("The file given to the -f option must be valid Python code defining a") + print("dictionary called 'cfg' with the keys 'ericDir', 'ericPixDir', 'ericIconDir',") + print("'ericDTDDir', 'ericCSSDir', 'ericStylesDir', 'ericDocDir', 'ericExamplesDir',") + print("'ericTranslationsDir', 'ericTemplatesDir', 'ericCodeTemplatesDir',") + print("'ericOthersDir','bindir', 'mdir' and 'apidir.") + print("These define the directories for the installation of the various parts of"\ + " eric4.") sys.exit(rcode) @@ -162,7 +162,7 @@ ''' % (sys.executable, pydir, wfile) copyToFile(wname, wrapper) - os.chmod(wname, 0755) + os.chmod(wname, 0o755) return wname @@ -206,8 +206,8 @@ fname = os.path.join(pdir, "__init__.py") if not os.path.exists(fname): if not os.path.exists(pdir): - os.mkdir(pdir, 0755) - f = open(fname, "wb") + os.mkdir(pdir, 0o755) + f = open(fname, "w") f.write(\ '''# -*- coding: utf-8 -*- @@ -224,7 +224,7 @@ Uninstall the old eric files. """ try: - from eric4config import getConfig + from .eric4config import getConfig except ImportError: # eric4 wasn't installed previously return @@ -308,13 +308,13 @@ # set install prefix, if not None if distDir: - for key in cfg.keys(): + for key in list(cfg.keys()): cfg[key] = os.path.normpath(distDir + os.sep + cfg[key]) try: # Install the files # make the install directories - for key in cfg.keys(): + for key in list(cfg.keys()): if not os.path.isdir(cfg[key]): os.makedirs(cfg[key]) @@ -363,7 +363,7 @@ # create the global plugins directory createGlobalPluginsDir() - except IOError, msg: + except IOError as msg: sys.stderr.write('IOError: %s\nTry install as root.\n' % msg) sys.exit(7) @@ -372,19 +372,19 @@ try: shutil.copy('eric%s%s' % (os.sep, name), cfg['ericDocDir']) except EnvironmentError: - print "Could not install 'eric%s%s'." % (os.sep, name) + print("Could not install 'eric%s%s'." % (os.sep, name)) for name in glob.glob(os.path.join('eric', 'README*.*')): try: shutil.copy(name, cfg['ericDocDir']) except EnvironmentError: - print "Could not install 'eric%s%s'." % (os.sep, name) + print("Could not install 'eric%s%s'." % (os.sep, name)) # copy some more stuff for name in ['default.e4k']: try: shutil.copy('eric%s%s' % (os.sep, name), cfg['ericOthersDir']) except EnvironmentError: - print "Could not install 'eric%s%s'." % (os.sep, name) + print("Could not install 'eric%s%s'." % (os.sep, name)) # install the API file for progLanguage in progLanguages: @@ -395,7 +395,7 @@ try: shutil.copy(apiName, apidir) except EnvironmentError: - print "Could not install '%s'." % apiName + print("Could not install '%s'." % apiName) def createInstallConfig(): @@ -490,41 +490,41 @@ """ Perform some dependency checks. """ - print 'Checking dependencies' + print('Checking dependencies') # perform dependency checks if sys.version_info < (2, 6, 0): - print 'Sorry, you must have Python 2.6.0 or higher.' + print('Sorry, you must have Python 2.6.0 or higher.') sys.exit(5) if sys.version_info > (2, 9, 9): - print 'Sorry, eric4 requires Python 2 for running.' + print('Sorry, eric4 requires Python 2 for running.') sys.exit(5) - print "Python Version: %d.%d.%d" % sys.version_info[:3] + print("Python Version: %d.%d.%d" % sys.version_info[:3]) try: from PyQt4.QtCore import qVersion, PYQT_VERSION - except ImportError, msg: - print 'Sorry, please install PyQt4.' - print 'Error: %s' % msg + except ImportError as msg: + print('Sorry, please install PyQt4.') + print('Error: %s' % msg) sys.exit(1) - print "Found PyQt" + print("Found PyQt") try: from PyQt4 import Qsci - except ImportError, msg: - print "Sorry, please install QScintilla2 and" - print "it's PyQt4 wrapper." - print 'Error: %s' % msg + except ImportError as msg: + print("Sorry, please install QScintilla2 and") + print("it's PyQt4 wrapper.") + print('Error: %s' % msg) sys.exit(1) - print "Found QScintilla2" + print("Found QScintilla2") # check version of Qt qtMajor = int(qVersion().split('.')[0]) qtMinor = int(qVersion().split('.')[1]) if qtMajor < 4 or (qtMajor == 4 and qtMinor < 5): - print 'Sorry, you must have Qt version 4.5.0 or higher.' + print('Sorry, you must have Qt version 4.5.0 or higher.') sys.exit(2) - print "Qt Version: %s" % qVersion() + print("Qt Version: %s" % qVersion()) #check version of PyQt from PyQt4.QtCore import PYQT_VERSION_STR @@ -538,10 +538,10 @@ min = int(min) pat = int(pat) if maj < 4 or (maj == 4 and min < 7): - print 'Sorry, you must have PyQt 4.7.0 or higher or' \ - ' a recent snapshot release.' + print('Sorry, you must have PyQt 4.7.0 or higher or' \ + ' a recent snapshot release.') sys.exit(3) - print "PyQt Version: ", pyqtVersion + print("PyQt Version: ", pyqtVersion) #check version of QScintilla from PyQt4.Qsci import QSCINTILLA_VERSION_STR @@ -555,12 +555,12 @@ min = int(min) pat = int(pat) if maj < 2 or (maj == 2 and min < 4): - print 'Sorry, you must have QScintilla 2.4.0 or higher or' \ - ' a recent snapshot release.' + print('Sorry, you must have QScintilla 2.4.0 or higher or' \ + ' a recent snapshot release.') sys.exit(4) - print "QScintilla Version: ", QSCINTILLA_VERSION_STR - print "All dependencies ok." - print + print("QScintilla Version: ", QSCINTILLA_VERSION_STR) + print("All dependencies ok.") + print() def compileUiFiles(): """ @@ -605,7 +605,7 @@ # Allow the caller to change the name of the .py file or generate # it in a different directory. if map is not None: - py_dir, py_file = map(py_dir, py_file) + py_dir, py_file = list(map(py_dir, py_file)) # Make sure the destination directory exists. try: @@ -691,10 +691,10 @@ doCompile = False elif opt == "-f": try: - execfile(arg, globals()) + exec(compile(open(arg).read(), arg, 'exec'), globals()) if len(cfg) != configLength: - print "The configuration dictionary in '%s' is incorrect. Aborting"\ - % arg + print("The configuration dictionary in '%s' is incorrect. Aborting"\ + % arg) sys.exit(6) except: cfg = {} @@ -718,18 +718,18 @@ shutil.rmtree(distDir, True) else: cleanUp() - except IOError, msg: + except IOError as msg: sys.stderr.write('IOError: %s\nTry install as root.\n' % msg) # Create a config file and delete the default one createConfig() # Compile .ui files - print "Compiling user interface files..." + print("Compiling user interface files...") compileUiFiles() if doCompile: - print "\nCompiling source files..." + print("\nCompiling source files...") if distDir: compileall.compile_dir("eric", ddir = os.path.join(distDir, modDir, cfg['ericDir']), @@ -744,24 +744,24 @@ quiet = True) py_compile.compile("eric4config.py", dfile = os.path.join(modDir, "eric4config.py")) - print "\nInstalling eric4 ..." + print("\nInstalling eric4 ...") installEric() - print "\nInstallation complete." - print + print("\nInstallation complete.") + print() # check PyXML version and output a message for broken PyXML (< 0.8.6) try: import _xmlplus v = _xmlplus.version_info if v < (0, 8, 6): - from eric4.patch_pyxml import isPatched, patchPyXML + from .eric4.patch_pyxml import isPatched, patchPyXML if not isPatched(): - print "NOTE:" - print " Found PyXML %d.%d.%d, which needs a patch to work correctly" % \ - (v[0], v[1], v[2]) - print " with foreign characters. Please see 'README-PyXML.txt' for" - print " details." - res = raw_input(" Shall pyXML be patched now (y/n)? ") + print("NOTE:") + print(" Found PyXML %d.%d.%d, which needs a patch to work correctly" % \ + (v[0], v[1], v[2])) + print(" with foreign characters. Please see 'README-PyXML.txt' for") + print(" details.") + res = input(" Shall pyXML be patched now (y/n)? ") if res in ["Y", "y"]: patchPyXML() except ImportError: @@ -779,13 +779,13 @@ min = int(min) pat = int(pat) if min < 5: - print - print "You have to patch PyQt QNetworkAccessManager." - print "See the patches directory for details." + print() + print("You have to patch PyQt QNetworkAccessManager.") + print("See the patches directory for details.") - print + print() if sys.platform.startswith("win"): - raw_input("Press enter to continue...") + input("Press enter to continue...") if __name__ == "__main__": @@ -794,8 +794,7 @@ except SystemExit: raise except: - print \ -"""An internal error occured. Please report all the output of the program, + print("""An internal error occured. Please report all the output of the program, including the following traceback, to eric5-bugs@eric-ide.python-projects.org. -""" +""") raise