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 |
1721 |
1728 |
1722 # Parse the command line. |
1729 # Parse the command line. |
1723 global progName, modDir, doCleanup, doCompile, distDir, cfg, apisDir |
1730 global progName, modDir, doCleanup, doCompile, distDir, cfg, apisDir |
1724 global sourceDir, eric6SourceDir, configName |
1731 global sourceDir, eric6SourceDir, configName |
1725 global macAppBundlePath, macAppBundleName, macPythonExe |
1732 global macAppBundlePath, macAppBundleName, macPythonExe |
1726 global installApis, doCleanDesktopLinks |
1733 global installApis, doCleanDesktopLinks, yes2All |
1727 |
1734 |
1728 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): |
1729 print('Sorry, eric6 requires at least Python 3.5 for running.') |
1736 print('Sorry, eric6 requires at least Python 3.5 for running.') |
1730 exit(5) |
1737 exit(5) |
1731 |
1738 |
1738 |
1745 |
1739 try: |
1746 try: |
1740 if sys.platform.startswith(("win", "cygwin")): |
1747 if sys.platform.startswith(("win", "cygwin")): |
1741 optlist, args = getopt.getopt( |
1748 optlist, args = getopt.getopt( |
1742 argv[1:], "chxza:b:d:f:", |
1749 argv[1:], "chxza:b:d:f:", |
1743 ["help", "no-apis"]) |
1750 ["help", "no-apis", "yes"]) |
1744 elif sys.platform == "darwin": |
1751 elif sys.platform == "darwin": |
1745 optlist, args = getopt.getopt( |
1752 optlist, args = getopt.getopt( |
1746 argv[1:], "chxza:b:d:f:i:m:n:p:", |
1753 argv[1:], "chxza:b:d:f:i:m:n:p:", |
1747 ["help", "no-apis"]) |
1754 ["help", "no-apis", "yes"]) |
1748 else: |
1755 else: |
1749 optlist, args = getopt.getopt( |
1756 optlist, args = getopt.getopt( |
1750 argv[1:], "chxza:b:d:f:i:", |
1757 argv[1:], "chxza:b:d:f:i:", |
1751 ["help", "no-apis"]) |
1758 ["help", "no-apis", "yes"]) |
1752 except getopt.GetoptError as err: |
1759 except getopt.GetoptError as err: |
1753 print(err) |
1760 print(err) |
1754 usage() |
1761 usage() |
1755 |
1762 |
1756 global platBinDir |
1763 global platBinDir |
1791 macPythonExe = arg |
1798 macPythonExe = arg |
1792 elif opt == "--no-apis": |
1799 elif opt == "--no-apis": |
1793 installApis = False |
1800 installApis = False |
1794 elif opt == "--clean-desktop": |
1801 elif opt == "--clean-desktop": |
1795 doCleanDesktopLinks = True |
1802 doCleanDesktopLinks = True |
|
1803 elif opt == "--yes": |
|
1804 yes2All = True |
1796 |
1805 |
1797 infoName = "" |
1806 infoName = "" |
1798 installFromSource = not os.path.isdir(sourceDir) |
1807 installFromSource = not os.path.isdir(sourceDir) |
1799 |
1808 |
1800 # check dependencies |
1809 # check dependencies |