944:1b59c4ba121e | 945:8cd4d08fa9f6 |
---|---|
20 from eric5config import getConfig | 20 from eric5config import getConfig |
21 except ImportError: | 21 except ImportError: |
22 print("The eric5 IDE doesn't seem to be installed. Aborting.") | 22 print("The eric5 IDE doesn't seem to be installed. Aborting.") |
23 sys.exit(1) | 23 sys.exit(1) |
24 | 24 |
25 | |
25 def getConfigDir(): | 26 def getConfigDir(): |
26 """ | 27 """ |
27 Global function to get the name of the directory storing the config data. | 28 Global function to get the name of the directory storing the config data. |
28 | 29 |
29 @return directory name of the config dir (string) | 30 @return directory name of the config dir (string) |
45 # Define the globals. | 46 # Define the globals. |
46 progName = None | 47 progName = None |
47 configDir = getConfigDir() | 48 configDir = getConfigDir() |
48 privateInstall = False | 49 privateInstall = False |
49 | 50 |
50 def usage(rcode = 2): | 51 |
52 def usage(rcode=2): | |
51 """ | 53 """ |
52 Display a usage message and exit. | 54 Display a usage message and exit. |
53 | 55 |
54 @param rcode return code passed back to the calling process (integer) | 56 @param rcode return code passed back to the calling process (integer) |
55 """ | 57 """ |
61 print("where:") | 63 print("where:") |
62 print(" -h display this help message") | 64 print(" -h display this help message") |
63 print(" -p install into the private area ({0})".format(configDir)) | 65 print(" -p install into the private area ({0})".format(configDir)) |
64 | 66 |
65 sys.exit(rcode) | 67 sys.exit(rcode) |
68 | |
66 | 69 |
67 def installTranslations(): | 70 def installTranslations(): |
68 """ | 71 """ |
69 Install the translation files into the right place. | 72 Install the translation files into the right place. |
70 """ | 73 """ |
83 'IOError: {0}\nTry install-i18n as root.\n'.format(msg)) | 86 'IOError: {0}\nTry install-i18n as root.\n'.format(msg)) |
84 except OSError as msg: | 87 except OSError as msg: |
85 sys.stderr.write( | 88 sys.stderr.write( |
86 'OSError: {0}\nTry install-i18n with admin rights.\n'.format(msg)) | 89 'OSError: {0}\nTry install-i18n with admin rights.\n'.format(msg)) |
87 | 90 |
91 | |
88 def main(argv): | 92 def main(argv): |
89 """ | 93 """ |
90 The main function of the script. | 94 The main function of the script. |
91 | 95 |
92 @param argv list of command line arguments (list of strings) | 96 @param argv list of command line arguments (list of strings) |
96 # Parse the command line. | 100 # Parse the command line. |
97 global progName, privateInstall | 101 global progName, privateInstall |
98 progName = os.path.basename(argv[0]) | 102 progName = os.path.basename(argv[0]) |
99 | 103 |
100 try: | 104 try: |
101 optlist, args = getopt.getopt(argv[1:],"hp") | 105 optlist, args = getopt.getopt(argv[1:], "hp") |
102 except getopt.GetoptError: | 106 except getopt.GetoptError: |
103 usage() | 107 usage() |
104 | 108 |
105 global platBinDir | 109 global platBinDir |
106 | 110 |