86 """ |
85 """ |
87 Display a usage message and exit. |
86 Display a usage message and exit. |
88 |
87 |
89 @param rcode the return code passed back to the calling process. |
88 @param rcode the return code passed back to the calling process. |
90 """ |
89 """ |
91 global progName, scriptsDir, modDir, distDir, apisDir, macAppBundleName |
90 global progName, modDir, distDir, apisDir, macAppBundleName |
92 global macPythonExe |
91 global macPythonExe |
93 |
92 |
94 print() |
93 print() |
95 print("Usage:") |
94 print("Usage:") |
96 if sys.platform == "darwin": |
95 if sys.platform == "darwin": |
108 if apisDir: |
107 if apisDir: |
109 print(" (default: {0})".format(apisDir)) |
108 print(" (default: {0})".format(apisDir)) |
110 else: |
109 else: |
111 print(" (no default value)") |
110 print(" (no default value)") |
112 print(" -b dir where the binaries will be installed") |
111 print(" -b dir where the binaries will be installed") |
113 print(" (default: {0})".format(scriptsDir)) |
112 print(" (default: {0})".format(platBinDir)) |
114 print(" -d dir where eric5 python files will be installed") |
113 print(" -d dir where eric5 python files will be installed") |
115 print(" (default: {0})".format(modDir)) |
114 print(" (default: {0})".format(modDir)) |
116 print(" -f file configuration file naming the various installation paths") |
115 print(" -f file configuration file naming the various installation paths") |
117 if not sys.platform.startswith("win"): |
116 if not sys.platform.startswith("win"): |
118 print(" -i dir temporary install prefix") |
117 print(" -i dir temporary install prefix") |
139 |
138 |
140 def initGlobals(): |
139 def initGlobals(): |
141 """ |
140 """ |
142 Sets the values of globals that need more than a simple assignment. |
141 Sets the values of globals that need more than a simple assignment. |
143 """ |
142 """ |
144 global platBinDir, scriptsDir, modDir, pyModDir, apisDir |
143 global platBinDir, modDir, pyModDir, apisDir |
145 |
144 |
146 if sys.platform.startswith("win"): |
145 if sys.platform.startswith("win"): |
147 platBinDir = sys.exec_prefix |
146 platBinDir = sys.exec_prefix |
148 if platBinDir.endswith("\\"): |
147 if platBinDir.endswith("\\"): |
149 platBinDir = platBinDir[:-1] |
148 platBinDir = platBinDir[:-1] |
150 scriptsDir = os.path.join(platBinDir, "Scripts") |
|
151 else: |
149 else: |
152 platBinDir = "/usr/local/bin" |
150 platBinDir = "/usr/local/bin" |
153 scriptsDir = platBinDir |
|
154 |
151 |
155 modDir = distutils.sysconfig.get_python_lib(True) |
152 modDir = distutils.sysconfig.get_python_lib(True) |
156 pyModDir = modDir |
153 pyModDir = modDir |
157 |
154 |
158 try: |
155 try: |
358 "eric5_snap", |
355 "eric5_snap", |
359 ] |
356 ] |
360 |
357 |
361 try: |
358 try: |
362 for rem_wname in rem_wnames: |
359 for rem_wname in rem_wnames: |
363 for d in [platBinDir, scriptsDir, getConfig('bindir')]: |
360 for d in [platBinDir, getConfig('bindir')]: |
364 rwname = wrapperName(d, rem_wname) |
361 rwname = wrapperName(d, rem_wname) |
365 if os.path.exists(rwname): |
362 if os.path.exists(rwname): |
366 os.remove(rwname) |
363 os.remove(rwname) |
367 |
364 |
368 # Cleanup our config file(s) |
365 # Cleanup our config file(s) |
682 |
679 |
683 def createInstallConfig(): |
680 def createInstallConfig(): |
684 """ |
681 """ |
685 Create the installation config dictionary. |
682 Create the installation config dictionary. |
686 """ |
683 """ |
687 global modDir, scriptsDir, cfg, apisDir |
684 global modDir, platBinDir, cfg, apisDir |
688 |
685 |
689 ericdir = os.path.join(modDir, "eric5") |
686 ericdir = os.path.join(modDir, "eric5") |
690 cfg = { |
687 cfg = { |
691 'ericDir': ericdir, |
688 'ericDir': ericdir, |
692 'ericPixDir': os.path.join(ericdir, "pixmaps"), |
689 'ericPixDir': os.path.join(ericdir, "pixmaps"), |
698 'ericExamplesDir': os.path.join(ericdir, "Examples"), |
695 'ericExamplesDir': os.path.join(ericdir, "Examples"), |
699 'ericTranslationsDir': os.path.join(ericdir, "i18n"), |
696 'ericTranslationsDir': os.path.join(ericdir, "i18n"), |
700 'ericTemplatesDir': os.path.join(ericdir, "DesignerTemplates"), |
697 'ericTemplatesDir': os.path.join(ericdir, "DesignerTemplates"), |
701 'ericCodeTemplatesDir': os.path.join(ericdir, 'CodeTemplates'), |
698 'ericCodeTemplatesDir': os.path.join(ericdir, 'CodeTemplates'), |
702 'ericOthersDir': ericdir, |
699 'ericOthersDir': ericdir, |
703 'bindir': scriptsDir, |
700 'bindir': platBinDir, |
704 'mdir': modDir, |
701 'mdir': modDir, |
705 } |
702 } |
706 if apisDir: |
703 if apisDir: |
707 cfg['apidir'] = apisDir |
704 cfg['apidir'] = apisDir |
708 else: |
705 else: |
1026 else: |
1023 else: |
1027 optlist, args = getopt.getopt(argv[1:], "chxza:b:d:f:i:") |
1024 optlist, args = getopt.getopt(argv[1:], "chxza:b:d:f:i:") |
1028 except getopt.GetoptError: |
1025 except getopt.GetoptError: |
1029 usage() |
1026 usage() |
1030 |
1027 |
1031 global scriptsDir |
1028 global platBinDir |
1032 |
1029 |
1033 depChecks = True |
1030 depChecks = True |
1034 |
1031 |
1035 for opt, arg in optlist: |
1032 for opt, arg in optlist: |
1036 if opt == "-h": |
1033 if opt == "-h": |
1037 usage(0) |
1034 usage(0) |
1038 elif opt == "-a": |
1035 elif opt == "-a": |
1039 apisDir = arg |
1036 apisDir = arg |
1040 elif opt == "-b": |
1037 elif opt == "-b": |
1041 scriptsDir = arg |
1038 platBinDir = arg |
1042 elif opt == "-d": |
1039 elif opt == "-d": |
1043 modDir = arg |
1040 modDir = arg |
1044 elif opt == "-i": |
1041 elif opt == "-i": |
1045 distDir = os.path.normpath(arg) |
1042 distDir = os.path.normpath(arg) |
1046 elif opt == "-x": |
1043 elif opt == "-x": |