scripts/install.py

branch
maintenance
changeset 7345
bc0ee7fadd03
parent 7322
cd8ee889589f
parent 7333
8479201bdf7b
child 7362
028bf21bb5a2
equal deleted inserted replaced
7323:83df7d69e61b 7345:bc0ee7fadd03
35 installApis = True 35 installApis = True
36 doCleanup = True 36 doCleanup = True
37 doCleanDesktopLinks = False 37 doCleanDesktopLinks = False
38 forceCleanDesktopLinks = False 38 forceCleanDesktopLinks = False
39 doCompile = True 39 doCompile = True
40 yes2All = False
40 cfg = {} 41 cfg = {}
41 progLanguages = ["Python", "Ruby", "QSS"] 42 progLanguages = ["Python", "Ruby", "QSS"]
42 sourceDir = "eric" 43 sourceDir = "eric"
43 eric6SourceDir = os.path.join(sourceDir, "eric6") 44 eric6SourceDir = os.path.join(sourceDir, "eric6")
44 configName = 'eric6config.py' 45 configName = 'eric6config.py'
108 global macAppBundleName, macAppBundlePath, macPythonExe 109 global macAppBundleName, macAppBundlePath, macPythonExe
109 110
110 print() 111 print()
111 print("Usage:") 112 print("Usage:")
112 if sys.platform == "darwin": 113 if sys.platform == "darwin":
113 print(" {0} [-chxyz] [-a dir] [-b dir] [-d dir] [-f file] [-i dir]" 114 print(" {0} [-chxz] [-a dir] [-b dir] [-d dir] [-f file] [-i dir]"
114 " [-m name] [-n path] [-p python] [--no-apis]" 115 " [-m name] [-n path] [-p python] [--no-apis] [--yes]"
115 .format(progName)) 116 .format(progName))
116 elif sys.platform.startswith(("win", "cygwin")): 117 elif sys.platform.startswith(("win", "cygwin")):
117 print(" {0} [-chxyz] [-a dir] [-b dir] [-d dir] [-f file]" 118 print(" {0} [-chxz] [-a dir] [-b dir] [-d dir] [-f file]"
118 " [--clean-desktop] [--no-apis]" 119 " [--clean-desktop] [--no-apis] [--yes]"
119 .format(progName)) 120 .format(progName))
120 else: 121 else:
121 print(" {0} [-chxyz] [-a dir] [-b dir] [-d dir] [-f file] [-i dir]" 122 print(" {0} [-chxz] [-a dir] [-b dir] [-d dir] [-f file] [-i dir]"
122 " [--no-apis]" 123 " [--no-apis] [--yes]"
123 .format(progName)) 124 .format(progName))
124 print("where:") 125 print("where:")
125 print(" -h, --help display this help message") 126 print(" -h, --help display this help message")
126 print(" -a dir where the API files will be installed") 127 print(" -a dir where the API files will be installed")
127 if apisDir: 128 if apisDir:
150 if sys.platform.startswith(("win", "cygwin")): 151 if sys.platform.startswith(("win", "cygwin")):
151 (" --clean-desktop delete desktop links before installation") 152 (" --clean-desktop delete desktop links before installation")
152 print(" -x don't perform dependency checks (use on your own" 153 print(" -x don't perform dependency checks (use on your own"
153 " risk)") 154 " risk)")
154 print(" -z don't compile the installed python files") 155 print(" -z don't compile the installed python files")
156 print(" --yes answer 'yes' to all questions")
155 print() 157 print()
156 print("The file given to the -f option must be valid Python code" 158 print("The file given to the -f option must be valid Python code"
157 " defining a") 159 " defining a")
158 print("dictionary called 'cfg' with the keys 'ericDir', 'ericPixDir'," 160 print("dictionary called 'cfg' with the keys 'ericDir', 'ericPixDir',"
159 " 'ericIconDir',") 161 " 'ericIconDir',")
1286 @param message message to be shown to the user 1288 @param message message to be shown to the user
1287 @type str 1289 @type str
1288 @return flag indicating a successful installation 1290 @return flag indicating a successful installation
1289 @rtype bool 1291 @rtype bool
1290 """ 1292 """
1293 global yes2All
1294
1291 ok = False 1295 ok = False
1292 print("{0}\n\nShall '{1}' be installed using pip? (Y/n)" 1296 if yes2All:
1293 .format(message, packageName), end=" ") 1297 answer = "y"
1294 answer = input() 1298 else:
1299 print("{0}\n\nShall '{1}' be installed using pip? (Y/n)"
1300 .format(message, packageName), end=" ")
1301 answer = input()
1295 if answer in ("", "Y", "y"): 1302 if answer in ("", "Y", "y"):
1296 exitCode = subprocess.call( 1303 exitCode = subprocess.call(
1297 [sys.executable, "-m", "pip", "install", packageName]) 1304 [sys.executable, "-m", "pip", "install", packageName])
1298 ok = (exitCode == 0) 1305 ok = (exitCode == 0)
1299 1306
1540 'Sorry, QScintilla2 version {0} is not compatible with' 1547 'Sorry, QScintilla2 version {0} is not compatible with'
1541 ' eric6.'.format(vers)) 1548 ' eric6.'.format(vers))
1542 print('Please install another version.') 1549 print('Please install another version.')
1543 exit(5) 1550 exit(5)
1544 1551
1552 # print version info for additional modules
1553 try:
1554 print("PyQtChart:", QtChart.PYQT_CHART_VERSION_STR)
1555 except (NameError, AttributeError):
1556 pass
1557 try:
1558 from PyQt5 import QtWebEngine
1559 print("PyQtWebEngine.", QtWebEngine.PYQT_WEBENGINE_VERSION_STR)
1560 except (ImportError, AttributeError):
1561 pass
1562
1545 print("All dependencies ok.") 1563 print("All dependencies ok.")
1546 print() 1564 print()
1547 1565
1548 1566
1549 def __pyName(py_dir, py_file): 1567 def __pyName(py_dir, py_file):
1710 1728
1711 # Parse the command line. 1729 # Parse the command line.
1712 global progName, modDir, doCleanup, doCompile, distDir, cfg, apisDir 1730 global progName, modDir, doCleanup, doCompile, distDir, cfg, apisDir
1713 global sourceDir, eric6SourceDir, configName 1731 global sourceDir, eric6SourceDir, configName
1714 global macAppBundlePath, macAppBundleName, macPythonExe 1732 global macAppBundlePath, macAppBundleName, macPythonExe
1715 global installApis, doCleanDesktopLinks 1733 global installApis, doCleanDesktopLinks, yes2All
1716 1734
1717 if sys.version_info < (3, 5, 0) or sys.version_info > (3, 99, 99): 1735 if sys.version_info < (3, 5, 0) or sys.version_info > (3, 99, 99):
1718 print('Sorry, eric6 requires at least Python 3.5 for running.') 1736 print('Sorry, eric6 requires at least Python 3.5 for running.')
1719 exit(5) 1737 exit(5)
1720 1738
1727 1745
1728 try: 1746 try:
1729 if sys.platform.startswith(("win", "cygwin")): 1747 if sys.platform.startswith(("win", "cygwin")):
1730 optlist, args = getopt.getopt( 1748 optlist, args = getopt.getopt(
1731 argv[1:], "chxza:b:d:f:", 1749 argv[1:], "chxza:b:d:f:",
1732 ["help", "no-apis"]) 1750 ["help", "no-apis", "yes"])
1733 elif sys.platform == "darwin": 1751 elif sys.platform == "darwin":
1734 optlist, args = getopt.getopt( 1752 optlist, args = getopt.getopt(
1735 argv[1:], "chxza:b:d:f:i:m:n:p:", 1753 argv[1:], "chxza:b:d:f:i:m:n:p:",
1736 ["help", "no-apis"]) 1754 ["help", "no-apis", "yes"])
1737 else: 1755 else:
1738 optlist, args = getopt.getopt( 1756 optlist, args = getopt.getopt(
1739 argv[1:], "chxza:b:d:f:i:", 1757 argv[1:], "chxza:b:d:f:i:",
1740 ["help", "no-apis"]) 1758 ["help", "no-apis", "yes"])
1741 except getopt.GetoptError as err: 1759 except getopt.GetoptError as err:
1742 print(err) 1760 print(err)
1743 usage() 1761 usage()
1744 1762
1745 global platBinDir 1763 global platBinDir
1780 macPythonExe = arg 1798 macPythonExe = arg
1781 elif opt == "--no-apis": 1799 elif opt == "--no-apis":
1782 installApis = False 1800 installApis = False
1783 elif opt == "--clean-desktop": 1801 elif opt == "--clean-desktop":
1784 doCleanDesktopLinks = True 1802 doCleanDesktopLinks = True
1803 elif opt == "--yes":
1804 yes2All = True
1785 1805
1786 infoName = "" 1806 infoName = ""
1787 installFromSource = not os.path.isdir(sourceDir) 1807 installFromSource = not os.path.isdir(sourceDir)
1788 1808
1789 # check dependencies 1809 # check dependencies

eric ide

mercurial