install.py

branch
maintenance
changeset 6693
3629d88ae235
parent 6664
50c9c1c9cf30
child 6760
448de556dd34
equal deleted inserted replaced
6647:2a11e1b2dcbe 6693:3629d88ae235
45 platBinDirOld = None 45 platBinDirOld = None
46 distDir = None 46 distDir = None
47 apisDir = None 47 apisDir = None
48 installApis = True 48 installApis = True
49 doCleanup = True 49 doCleanup = True
50 doCleanDesktopLinks = False
51 forceCleanDesktopLinks = False
50 doCompile = True 52 doCompile = True
51 includePythonVariant = False 53 includePythonVariant = False
52 cfg = {} 54 cfg = {}
53 progLanguages = ["Python", "Ruby", "QSS"] 55 progLanguages = ["Python", "Ruby", "QSS"]
54 sourceDir = "eric" 56 sourceDir = "eric"
139 141
140 print() 142 print()
141 print("Usage:") 143 print("Usage:")
142 if sys.platform == "darwin": 144 if sys.platform == "darwin":
143 print(" {0} [-chxyz] [-a dir] [-b dir] [-d dir] [-f file] [-i dir]" 145 print(" {0} [-chxyz] [-a dir] [-b dir] [-d dir] [-f file] [-i dir]"
144 " [-m name] [-p python] [--pyqt=version]".format(progName)) 146 " [-m name] [-n path] [-p python] [--no-apis] [--pyqt=version]"
147 .format(progName))
145 elif sys.platform.startswith(("win", "cygwin")): 148 elif sys.platform.startswith(("win", "cygwin")):
146 print(" {0} [-chxyz] [-a dir] [-b dir] [-d dir] [-f file]" 149 print(" {0} [-chxyz] [-a dir] [-b dir] [-d dir] [-f file]"
147 " [--pyqt=version]" 150 " [--clean-desktop] [--no-apis] [--pyqt=version]"
148 .format(progName)) 151 .format(progName))
149 else: 152 else:
150 print(" {0} [-chxyz] [-a dir] [-b dir] [-d dir] [-f file] [-i dir]" 153 print(" {0} [-chxyz] [-a dir] [-b dir] [-d dir] [-f file] [-i dir]"
151 " [--pyqt=version]" 154 " [--no-apis] [--pyqt=version]"
152 .format(progName)) 155 .format(progName))
153 print("where:") 156 print("where:")
154 print(" -h, --help display this help message") 157 print(" -h, --help display this help message")
155 print(" -a dir where the API files will be installed") 158 print(" -a dir where the API files will be installed")
156 if apisDir: 159 if apisDir:
157 print(" (default: {0})".format(apisDir)) 160 print(" (default: {0})".format(apisDir))
158 else: 161 else:
159 print(" (no default value)") 162 print(" (no default value)")
160 print(" --noapis don't install API files") 163 print(" --no-apis don't install API files")
161 print(" -b dir where the binaries will be installed") 164 print(" -b dir where the binaries will be installed")
162 print(" (default: {0})".format(platBinDir)) 165 print(" (default: {0})".format(platBinDir))
163 print(" -d dir where eric6 python files will be installed") 166 print(" -d dir where eric6 python files will be installed")
164 print(" (default: {0})".format(modDir)) 167 print(" (default: {0})".format(modDir))
165 print(" -f file configuration file naming the various installation" 168 print(" -f file configuration file naming the various installation"
174 print(" be created in") 177 print(" be created in")
175 print(" (default: {0})".format(macAppBundlePath)) 178 print(" (default: {0})".format(macAppBundlePath))
176 print(" -p python path of the python executable") 179 print(" -p python path of the python executable")
177 print(" (default: {0})".format(macPythonExe)) 180 print(" (default: {0})".format(macPythonExe))
178 print(" -c don't cleanup old installation first") 181 print(" -c don't cleanup old installation first")
182 if sys.platform.startswith(("win", "cygwin")):
183 (" --clean-desktop delete desktop links before installation")
179 print(" -x don't perform dependency checks (use on your own" 184 print(" -x don't perform dependency checks (use on your own"
180 " risk)") 185 " risk)")
181 print(" -y add the Python variant to the executable names") 186 print(" -y add the Python variant to the executable names")
182 print(" -z don't compile the installed python files") 187 print(" -z don't compile the installed python files")
183 print(" --pyqt=version version of PyQt to be used (one of 4 or 5)") 188 print(" --pyqt=version version of PyQt to be used (one of 4 or 5)")
735 740
736 def cleanUpWindowsLinks(): 741 def cleanUpWindowsLinks():
737 """ 742 """
738 Clean up the Desktop and Start Menu entries for Windows. 743 Clean up the Desktop and Start Menu entries for Windows.
739 """ 744 """
745 global doCleanDesktopLinks, forceCleanDesktopLinks
746
740 try: 747 try:
741 from pywintypes import com_error # __IGNORE_WARNING__ 748 from pywintypes import com_error # __IGNORE_WARNING__
742 except ImportError: 749 except ImportError:
743 # links were not created by install.py 750 # links were not created by install.py
744 return 751 return
745 752
746 regPath = "Software\\Microsoft\\Windows\\CurrentVersion\\Explorer" + \ 753 regPath = "Software\\Microsoft\\Windows\\CurrentVersion\\Explorer" + \
747 "\\User Shell Folders" 754 "\\User Shell Folders"
748 755
749 # 1. cleanup desktop links 756 if doCleanDesktopLinks or forceCleanDesktopLinks:
750 regName = "Desktop" 757 # 1. cleanup desktop links
751 desktopEntry = getWinregEntry(regName, regPath) 758 regName = "Desktop"
752 if desktopEntry: 759 desktopEntry = getWinregEntry(regName, regPath)
753 desktopFolder = os.path.normpath(os.path.expandvars(desktopEntry)) 760 if desktopEntry:
754 for linkName in windowsDesktopNames(): 761 desktopFolder = os.path.normpath(os.path.expandvars(desktopEntry))
755 linkPath = os.path.join(desktopFolder, linkName) 762 for linkName in windowsDesktopNames():
756 if os.path.exists(linkPath): 763 linkPath = os.path.join(desktopFolder, linkName)
757 try: 764 if os.path.exists(linkPath):
758 os.remove(linkPath) 765 try:
759 except EnvironmentError: 766 os.remove(linkPath)
760 # maybe restrictions prohibited link removal 767 except EnvironmentError:
761 print("Could not remove '{0}'.".format(linkPath)) 768 # maybe restrictions prohibited link removal
769 print("Could not remove '{0}'.".format(linkPath))
762 770
763 # 2. cleanup start menu entry 771 # 2. cleanup start menu entry
764 regName = "Programs" 772 regName = "Programs"
765 programsEntry = getWinregEntry(regName, regPath) 773 programsEntry = getWinregEntry(regName, regPath)
766 if programsEntry: 774 if programsEntry:
1227 os.chmod(wname, 0o755) 1235 os.chmod(wname, 0o755)
1228 1236
1229 shutilCopy(os.path.join(sourceDir, "pixmaps", "eric_2.icns"), 1237 shutilCopy(os.path.join(sourceDir, "pixmaps", "eric_2.icns"),
1230 os.path.join(dirs["icns"], "eric.icns")) 1238 os.path.join(dirs["icns"], "eric.icns"))
1231 1239
1240 if os.path.exists(os.path.join("eric", "UI", "Info.py")):
1241 # Installing from archive
1242 from eric.UI.Info import Version, CopyrightShort
1243 elif os.path.exists(os.path.join("UI", "Info.py")):
1244 # Installing from source tree
1245 from UI.Info import Version, CopyrightShort
1246 else:
1247 Version = "Unknown"
1248 CopyrightShort = "(c) 2002 - 2019 Detlev Offenbach"
1249
1232 copyToFile( 1250 copyToFile(
1233 os.path.join(dirs["contents"], "Info.plist"), 1251 os.path.join(dirs["contents"], "Info.plist"),
1234 '''<?xml version="1.0" encoding="UTF-8"?>\n''' 1252 '''<?xml version="1.0" encoding="UTF-8"?>\n'''
1235 '''<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN"\n''' 1253 '''<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN"\n'''
1236 ''' "http://www.apple.com/DTDs/PropertyList-1.0.dtd">\n''' 1254 ''' "http://www.apple.com/DTDs/PropertyList-1.0.dtd">\n'''
1239 ''' <key>CFBundleExecutable</key>\n''' 1257 ''' <key>CFBundleExecutable</key>\n'''
1240 ''' <string>eric6</string>\n''' 1258 ''' <string>eric6</string>\n'''
1241 ''' <key>CFBundleIconFile</key>\n''' 1259 ''' <key>CFBundleIconFile</key>\n'''
1242 ''' <string>eric.icns</string>\n''' 1260 ''' <string>eric.icns</string>\n'''
1243 ''' <key>CFBundleInfoDictionaryVersion</key>\n''' 1261 ''' <key>CFBundleInfoDictionaryVersion</key>\n'''
1244 ''' <string>1.0</string>\n''' 1262 ''' <string>{1}</string>\n'''
1245 ''' <key>CFBundleName</key>\n''' 1263 ''' <key>CFBundleName</key>\n'''
1246 ''' <string>{0}</string>\n''' 1264 ''' <string>{0}</string>\n'''
1247 ''' <key>CFBundleDisplayName</key>\n''' 1265 ''' <key>CFBundleDisplayName</key>\n'''
1248 ''' <string>{0}</string>\n''' 1266 ''' <string>{0}</string>\n'''
1249 ''' <key>CFBundlePackageType</key>\n''' 1267 ''' <key>CFBundlePackageType</key>\n'''
1250 ''' <string>APPL</string>\n''' 1268 ''' <string>APPL</string>\n'''
1251 ''' <key>CFBundleSignature</key>\n''' 1269 ''' <key>CFBundleSignature</key>\n'''
1252 ''' <string>????</string>\n''' 1270 ''' <string>ERIC-IDE</string>\n'''
1253 ''' <key>CFBundleVersion</key>\n''' 1271 ''' <key>CFBundleVersion</key>\n'''
1254 ''' <string>1.0</string>\n''' 1272 ''' <string>{1}</string>\n'''
1273 ''' <key>CFBundleGetInfoString</key>\n'''
1274 ''' <string>{1}, {2}</string>\n'''
1255 ''' <key>CFBundleIdentifier</key>\n''' 1275 ''' <key>CFBundleIdentifier</key>\n'''
1256 ''' <string>org.python-projects.eric-ide</string>\n''' 1276 ''' <string>org.python-projects.eric-ide</string>\n'''
1257 '''</dict>\n''' 1277 '''</dict>\n'''
1258 '''</plist>\n'''.format(macAppBundleName.replace(".app", ""))) 1278 '''</plist>\n'''.format(
1279 macAppBundleName.replace(".app", ""),
1280 Version.split(None, 1)[0],
1281 CopyrightShort))
1259 1282
1260 1283
1261 def createInstallConfig(): 1284 def createInstallConfig():
1262 """ 1285 """
1263 Create the installation config dictionary. 1286 Create the installation config dictionary.
1470 1493
1471 if pyqtVariant != "PyQt4": 1494 if pyqtVariant != "PyQt4":
1472 try: 1495 try:
1473 from PyQt5 import QtWebEngineWidgets # __IGNORE_WARNING__ 1496 from PyQt5 import QtWebEngineWidgets # __IGNORE_WARNING__
1474 except ImportError as msg: 1497 except ImportError as msg:
1475 installed = pipInstall( 1498 from PyQt5.QtCore import PYQT_VERSION
1476 "PyQtWebEngine", 1499 if PYQT_VERSION >= 0x50c00:
1477 "PyQtWebEngine could not be detected.\nError: {0}".format(msg) 1500 # PyQt 5.12 separated QtWebEngine into a separate wheel
1478 ) 1501 installed = pipInstall(
1502 "PyQtWebEngine",
1503 "PyQtWebEngine could not be detected.\nError: {0}"
1504 .format(msg)
1505 )
1479 1506
1480 try: 1507 try:
1481 if pyqtVariant == "PyQt4": 1508 if pyqtVariant == "PyQt4":
1482 from PyQt4 import Qsci # __IGNORE_WARNING__ 1509 from PyQt4 import Qsci # __IGNORE_WARNING__
1483 else: 1510 else:
1569 qtMajor = int(qVersion().split('.')[0]) 1596 qtMajor = int(qVersion().split('.')[0])
1570 qtMinor = int(qVersion().split('.')[1]) 1597 qtMinor = int(qVersion().split('.')[1])
1571 print("Qt Version: {0}".format(qVersion().strip())) 1598 print("Qt Version: {0}".format(qVersion().strip()))
1572 if qtMajor < 4 or \ 1599 if qtMajor < 4 or \
1573 (qtMajor == 4 and qtMinor < 8) or \ 1600 (qtMajor == 4 and qtMinor < 8) or \
1574 (qtMajor == 5 and qtMinor < 3): 1601 (qtMajor == 5 and qtMinor < 6):
1575 print('Sorry, you must have Qt version 4.8.0 or better or') 1602 print('Sorry, you must have Qt version 4.8.0 or better or')
1576 print('5.3.0 or better.') 1603 print('5.6.0 or better.')
1577 exit(2) 1604 exit(2)
1578 1605
1579 # check version of sip 1606 # check version of sip
1580 try: 1607 try:
1581 try: 1608 try:
1625 pat = int(pat) 1652 pat = int(pat)
1626 if major < 4 or \ 1653 if major < 4 or \
1627 (major == 4 and minor < 10) or \ 1654 (major == 4 and minor < 10) or \
1628 (major == 5 and minor < 3): 1655 (major == 5 and minor < 3):
1629 print('Sorry, you must have PyQt 4.10.0 or better or') 1656 print('Sorry, you must have PyQt 4.10.0 or better or')
1630 print('PyQt 5.3.0 or better or' 1657 print('PyQt 5.6.0 or better or'
1631 ' a recent snapshot release.') 1658 ' a recent snapshot release.')
1632 exit(4) 1659 exit(4)
1633 # check for blacklisted versions 1660 # check for blacklisted versions
1634 for vers in BlackLists[pyqtVariant] + PlatformBlackLists[pyqtVariant]: 1661 for vers in BlackLists[pyqtVariant] + PlatformBlackLists[pyqtVariant]:
1635 if vers == pyqtVersion: 1662 if vers == pyqtVersion:
1858 1885
1859 # Parse the command line. 1886 # Parse the command line.
1860 global progName, modDir, doCleanup, doCompile, distDir, cfg, apisDir 1887 global progName, modDir, doCleanup, doCompile, distDir, cfg, apisDir
1861 global sourceDir, configName, includePythonVariant 1888 global sourceDir, configName, includePythonVariant
1862 global macAppBundlePath, macAppBundleName, macPythonExe 1889 global macAppBundlePath, macAppBundleName, macPythonExe
1863 global pyqtVariant, pyqtOverride, installApis 1890 global pyqtVariant, pyqtOverride, installApis, doCleanDesktopLinks
1864 1891
1865 if sys.version_info < (2, 7, 0) or sys.version_info > (3, 9, 9): 1892 if sys.version_info < (2, 7, 0) or sys.version_info > (3, 9, 9):
1866 print('Sorry, eric6 requires at least Python 2.7 or ' 1893 print('Sorry, eric6 requires at least Python 2.7 or '
1867 'Python 3 for running.') 1894 'Python 3 for running.')
1868 exit(5) 1895 exit(5)
1931 if arg not in ["4", "5"]: 1958 if arg not in ["4", "5"]:
1932 print("Invalid PyQt version given; should be 4 or 5. Aborting") 1959 print("Invalid PyQt version given; should be 4 or 5. Aborting")
1933 exit(6) 1960 exit(6)
1934 pyqtVariant = "PyQt{0}".format(arg) 1961 pyqtVariant = "PyQt{0}".format(arg)
1935 pyqtOverride = True 1962 pyqtOverride = True
1936 elif "--noapis": 1963 elif opt == "--no-apis":
1937 installApis = False 1964 installApis = False
1965 elif opt == "--clean-desktop":
1966 doCleanDesktopLinks = True
1938 1967
1939 infoName = "" 1968 infoName = ""
1940 installFromSource = not os.path.isdir(sourceDir) 1969 installFromSource = not os.path.isdir(sourceDir)
1941 1970
1942 # check dependencies 1971 # check dependencies

eric ide

mercurial