scripts/install.py

branch
eric7
changeset 10264
f06151820839
parent 10261
fa560567d555
child 10272
7ae72d1df070
child 10300
60e8f2175b3b
equal deleted inserted replaced
10263:f4bb67586615 10264:f06151820839
51 progLanguages = ["MicroPython", "Python3", "QSS"] 51 progLanguages = ["MicroPython", "Python3", "QSS"]
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 if os.getuid() == 0: 56 defaultMacAppBundlePath = "/Applications"
57 defaultMacAppBundlePath = "/Applications" 57 defaultMacUserAppBundlePath = os.path.expanduser("~/Applications")
58 else:
59 defaultMacAppBundlePath = os.path.expanduser("~/Applications")
60 defaultMacPythonExe = "{0}/Resources/Python.app/Contents/MacOS/Python".format( 58 defaultMacPythonExe = "{0}/Resources/Python.app/Contents/MacOS/Python".format(
61 sys.exec_prefix 59 sys.exec_prefix
62 ) 60 )
63 if not os.path.exists(defaultMacPythonExe): 61 if not os.path.exists(defaultMacPythonExe):
64 defaultMacPythonExe = "" 62 defaultMacPythonExe = ""
199 def initGlobals(): 197 def initGlobals():
200 """ 198 """
201 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
202 simple assignment. 200 simple assignment.
203 """ 201 """
204 global platBinDir, modDir, pyModDir, apisDir 202 global platBinDir, modDir, pyModDir, apisDir, macAppBundlePath
205 203
206 if sys.platform.startswith(("win", "cygwin")): 204 if sys.platform.startswith(("win", "cygwin")):
207 platBinDir = sysconfig.get_path("scripts") 205 platBinDir = sysconfig.get_path("scripts")
208 else: 206 else:
209 # install the eric scripts along the python executable 207 # install the eric scripts along the python executable
238 236
239 qtDataDir = QLibraryInfo.path(QLibraryInfo.LibraryPath.DataPath) 237 qtDataDir = QLibraryInfo.path(QLibraryInfo.LibraryPath.DataPath)
240 except ImportError: 238 except ImportError:
241 qtDataDir = None 239 qtDataDir = None
242 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
243 247
244 248
245 def copyToFile(name, text): 249 def copyToFile(name, text):
246 """ 250 """
247 Copy a string to a file. 251 Copy a string to a file.
670 674
671 try: 675 try:
672 macAppBundlePath = getConfig("macAppBundlePath") 676 macAppBundlePath = getConfig("macAppBundlePath")
673 macAppBundleName = getConfig("macAppBundleName") 677 macAppBundleName = getConfig("macAppBundleName")
674 except AttributeError: 678 except AttributeError:
675 macAppBundlePath = defaultMacAppBundlePath 679 macAppBundlePath = (
680 defaultMacAppBundlePath
681 if os.getpid() == 0
682 else defaultMacUserAppBundlePath
683 )
676 macAppBundleName = defaultMacAppBundleName 684 macAppBundleName = defaultMacAppBundleName
677 for bundlePath in [ 685 for bundlePath in [
678 os.path.join(defaultMacAppBundlePath, macAppBundleName), 686 os.path.join(defaultMacAppBundlePath, macAppBundleName),
687 os.path.join(defaultMacUserAppBundlePath, macAppBundleName),
679 os.path.join(macAppBundlePath, macAppBundleName), 688 os.path.join(macAppBundlePath, macAppBundleName),
680 ]: 689 ]:
681 if os.path.exists(bundlePath): 690 if os.path.exists(bundlePath):
682 shutil.rmtree(bundlePath) 691 shutil.rmtree(bundlePath)
683 692
1580 "pyqt6-qscintilla": 0x20D00, # v2.13.0 1589 "pyqt6-qscintilla": 0x20D00, # v2.13.0
1581 "sip": 0x60100, # v6.1.0 1590 "sip": 0x60100, # v6.1.0
1582 } 1591 }
1583 1592
1584 try: 1593 try:
1585 isSudo = os.getuid() == 0 and sys.platform != "darwin" 1594 isSudo = os.getuid() == 0
1586 # disregard sudo installs on macOS 1595 # disregard sudo installs on macOS
1587 except AttributeError: 1596 except AttributeError:
1588 isSudo = False 1597 isSudo = False
1589 1598
1590 print("Checking dependencies") 1599 print("Checking dependencies")
2271 " It will be ignored. Installation will be performed with" 2280 " It will be ignored. Installation will be performed with"
2272 " defaults.".format(arg) 2281 " defaults.".format(arg)
2273 ) 2282 )
2274 print("ERROR: {0}".format(str(exc))) 2283 print("ERROR: {0}".format(str(exc)))
2275 cfg = {} 2284 cfg = {}
2276 elif opt == "-m": 2285 elif opt == "-m" and sys.platform == "darwin":
2277 macAppBundleName = arg 2286 macAppBundleName = arg
2278 elif opt == "-n": 2287 elif opt == "-n" and sys.platform == "darwin":
2279 macAppBundlePath = arg 2288 macAppBundlePath = arg
2280 elif opt == "-p": 2289 elif opt == "-p" and sys.platform == "darwin":
2281 macPythonExe = arg 2290 macPythonExe = arg
2282 elif opt == "--no-apis": 2291 elif opt == "--no-apis":
2283 installApis = False 2292 installApis = False
2284 elif opt == "--clean-desktop": 2293 elif opt == "--clean-desktop":
2285 doCleanDesktopLinks = True 2294 doCleanDesktopLinks = True

eric ide

mercurial