scripts/install.py

branch
eric7-maintenance
changeset 10272
7ae72d1df070
parent 10222
1146cc8fbf5d
parent 10264
f06151820839
child 10349
df7edc29cbfb
equal deleted inserted replaced
10226:3a99ac054b39 10272:7ae72d1df070
52 sourceDir = "eric" 52 sourceDir = "eric"
53 eric7SourceDir = "" 53 eric7SourceDir = ""
54 configName = "eric7config.py" 54 configName = "eric7config.py"
55 defaultMacAppBundleName = "eric7.app" 55 defaultMacAppBundleName = "eric7.app"
56 defaultMacAppBundlePath = "/Applications" 56 defaultMacAppBundlePath = "/Applications"
57 defaultMacUserAppBundlePath = os.path.expanduser("~/Applications")
57 defaultMacPythonExe = "{0}/Resources/Python.app/Contents/MacOS/Python".format( 58 defaultMacPythonExe = "{0}/Resources/Python.app/Contents/MacOS/Python".format(
58 sys.exec_prefix 59 sys.exec_prefix
59 ) 60 )
60 if not os.path.exists(defaultMacPythonExe): 61 if not os.path.exists(defaultMacPythonExe):
61 defaultMacPythonExe = "" 62 defaultMacPythonExe = ""
196 def initGlobals(): 197 def initGlobals():
197 """ 198 """
198 Module function to set the values of globals that need more than a 199 Module function to set the values of globals that need more than a
199 simple assignment. 200 simple assignment.
200 """ 201 """
201 global platBinDir, modDir, pyModDir, apisDir 202 global platBinDir, modDir, pyModDir, apisDir, macAppBundlePath
202 203
203 if sys.platform.startswith(("win", "cygwin")): 204 if sys.platform.startswith(("win", "cygwin")):
204 platBinDir = sysconfig.get_path("scripts") 205 platBinDir = sysconfig.get_path("scripts")
205 else: 206 else:
206 # install the eric scripts along the python executable 207 # install the eric scripts along the python executable
235 236
236 qtDataDir = QLibraryInfo.path(QLibraryInfo.LibraryPath.DataPath) 237 qtDataDir = QLibraryInfo.path(QLibraryInfo.LibraryPath.DataPath)
237 except ImportError: 238 except ImportError:
238 qtDataDir = None 239 qtDataDir = None
239 apisDir = os.path.join(qtDataDir, "qsci", "api") if qtDataDir else None 240 apisDir = os.path.join(qtDataDir, "qsci", "api") if qtDataDir else None
241
242 if sys.platform == "darwin":
243 if os.getuid() == 0:
244 macAppBundlePath = defaultMacAppBundlePath
245 else:
246 macAppBundlePath = defaultMacUserAppBundlePath
240 247
241 248
242 def copyToFile(name, text): 249 def copyToFile(name, text):
243 """ 250 """
244 Copy a string to a file. 251 Copy a string to a file.
667 674
668 try: 675 try:
669 macAppBundlePath = getConfig("macAppBundlePath") 676 macAppBundlePath = getConfig("macAppBundlePath")
670 macAppBundleName = getConfig("macAppBundleName") 677 macAppBundleName = getConfig("macAppBundleName")
671 except AttributeError: 678 except AttributeError:
672 macAppBundlePath = defaultMacAppBundlePath 679 macAppBundlePath = (
680 defaultMacAppBundlePath
681 if os.getpid() == 0
682 else defaultMacUserAppBundlePath
683 )
673 macAppBundleName = defaultMacAppBundleName 684 macAppBundleName = defaultMacAppBundleName
674 for bundlePath in [ 685 for bundlePath in [
675 os.path.join(defaultMacAppBundlePath, macAppBundleName), 686 os.path.join(defaultMacAppBundlePath, macAppBundleName),
687 os.path.join(defaultMacUserAppBundlePath, macAppBundleName),
676 os.path.join(macAppBundlePath, macAppBundleName), 688 os.path.join(macAppBundlePath, macAppBundleName),
677 ]: 689 ]:
678 if os.path.exists(bundlePath): 690 if os.path.exists(bundlePath):
679 shutil.rmtree(bundlePath) 691 shutil.rmtree(bundlePath)
680 692
1577 "pyqt6-qscintilla": 0x20D00, # v2.13.0 1589 "pyqt6-qscintilla": 0x20D00, # v2.13.0
1578 "sip": 0x60100, # v6.1.0 1590 "sip": 0x60100, # v6.1.0
1579 } 1591 }
1580 1592
1581 try: 1593 try:
1582 isSudo = os.getuid() == 0 and sys.platform != "darwin" 1594 isSudo = os.getuid() == 0
1583 # disregard sudo installs on macOS 1595 # disregard sudo installs on macOS
1584 except AttributeError: 1596 except AttributeError:
1585 isSudo = False 1597 isSudo = False
1586 1598
1587 print("Checking dependencies") 1599 print("Checking dependencies")
2268 " It will be ignored. Installation will be performed with" 2280 " It will be ignored. Installation will be performed with"
2269 " defaults.".format(arg) 2281 " defaults.".format(arg)
2270 ) 2282 )
2271 print("ERROR: {0}".format(str(exc))) 2283 print("ERROR: {0}".format(str(exc)))
2272 cfg = {} 2284 cfg = {}
2273 elif opt == "-m": 2285 elif opt == "-m" and sys.platform == "darwin":
2274 macAppBundleName = arg 2286 macAppBundleName = arg
2275 elif opt == "-n": 2287 elif opt == "-n" and sys.platform == "darwin":
2276 macAppBundlePath = arg 2288 macAppBundlePath = arg
2277 elif opt == "-p": 2289 elif opt == "-p" and sys.platform == "darwin":
2278 macPythonExe = arg 2290 macPythonExe = arg
2279 elif opt == "--no-apis": 2291 elif opt == "--no-apis":
2280 installApis = False 2292 installApis = False
2281 elif opt == "--clean-desktop": 2293 elif opt == "--clean-desktop":
2282 doCleanDesktopLinks = True 2294 doCleanDesktopLinks = True

eric ide

mercurial