diff -r e9e7eca7efee -r bf71ee032bb4 scripts/install-i18n.py --- a/scripts/install-i18n.py Wed Jul 13 11:16:20 2022 +0200 +++ b/scripts/install-i18n.py Wed Jul 13 14:55:47 2022 +0200 @@ -23,21 +23,22 @@ # an incomplete or old config file was found print("The eric IDE seems to be installed incompletely. Aborting.") sys.exit(1) - + def getConfigDir(): """ Global function to get the name of the directory storing the config data. - + @return directory name of the config dir (string) """ cdn = ".eric7" - + hp = os.path.join(os.path.expanduser("~"), cdn) if not os.path.exists(hp): os.mkdir(hp) return hp - + + # Define the globals. progName = None configDir = getConfigDir() @@ -57,8 +58,7 @@ print(" {0} [-hp]".format(progName)) print("where:") print(" -h display this help message") - print(" -p install into the private area ({0})".format( - configDir)) + print(" -p install into the private area ({0})".format(configDir)) sys.exit(rcode) @@ -68,21 +68,20 @@ Install the translation files into the right place. """ global privateInstall, configDir - - targetDir = (configDir if privateInstall - else getConfig('ericTranslationsDir')) - + + targetDir = configDir if privateInstall else getConfig("ericTranslationsDir") + try: - for fn in glob.glob(os.path.join('eric', 'src', 'eric7', 'i18n', '*.qm')): + for fn in glob.glob(os.path.join("eric", "src", "eric7", "i18n", "*.qm")): shutil.copy2(fn, targetDir) os.chmod(os.path.join(targetDir, os.path.basename(fn)), 0o644) except OSError as msg: - sys.stderr.write( - 'OSError: {0}\nTry install-i18n as root.\n'.format(msg)) + sys.stderr.write("OSError: {0}\nTry install-i18n as root.\n".format(msg)) except OSError as msg: sys.stderr.write( - 'OSError: {0}\nTry install-i18n with admin rights.\n'.format(msg)) - + "OSError: {0}\nTry install-i18n with admin rights.\n".format(msg) + ) + def main(argv): """ @@ -102,24 +101,27 @@ usage() global platBinDir - + for opt, _arg in optlist: if opt == "-h": usage(0) elif opt == "-p": privateInstall = 1 - + installTranslations() + if __name__ == "__main__": try: main(sys.argv) except SystemExit: raise except Exception: - print("""An internal error occured. Please report all the output of""" - """ the program,\nincluding the following traceback, to""" - """ eric-bugs@eric-ide.python-projects.org.\n""") + print( + """An internal error occured. Please report all the output of""" + """ the program,\nincluding the following traceback, to""" + """ eric-bugs@eric-ide.python-projects.org.\n""" + ) raise #