--- a/scripts/install.py Wed Nov 06 22:30:54 2019 +0100 +++ b/scripts/install.py Wed Nov 13 18:57:47 2019 +0100 @@ -37,6 +37,7 @@ doCleanDesktopLinks = False forceCleanDesktopLinks = False doCompile = True +yes2All = False cfg = {} progLanguages = ["Python", "Ruby", "QSS"] sourceDir = "eric" @@ -110,16 +111,16 @@ print() print("Usage:") if sys.platform == "darwin": - print(" {0} [-chxyz] [-a dir] [-b dir] [-d dir] [-f file] [-i dir]" - " [-m name] [-n path] [-p python] [--no-apis]" + print(" {0} [-chxz] [-a dir] [-b dir] [-d dir] [-f file] [-i dir]" + " [-m name] [-n path] [-p python] [--no-apis] [--yes]" .format(progName)) elif sys.platform.startswith(("win", "cygwin")): - print(" {0} [-chxyz] [-a dir] [-b dir] [-d dir] [-f file]" - " [--clean-desktop] [--no-apis]" + print(" {0} [-chxz] [-a dir] [-b dir] [-d dir] [-f file]" + " [--clean-desktop] [--no-apis] [--yes]" .format(progName)) else: - print(" {0} [-chxyz] [-a dir] [-b dir] [-d dir] [-f file] [-i dir]" - " [--no-apis]" + print(" {0} [-chxz] [-a dir] [-b dir] [-d dir] [-f file] [-i dir]" + " [--no-apis] [--yes]" .format(progName)) print("where:") print(" -h, --help display this help message") @@ -152,6 +153,7 @@ print(" -x don't perform dependency checks (use on your own" " risk)") print(" -z don't compile the installed python files") + print(" --yes answer 'yes' to all questions") print() print("The file given to the -f option must be valid Python code" " defining a") @@ -1288,10 +1290,15 @@ @return flag indicating a successful installation @rtype bool """ + global yes2All + ok = False - print("{0}\n\nShall '{1}' be installed using pip? (Y/n)" - .format(message, packageName), end=" ") - answer = input() + if yes2All: + answer = "y" + else: + print("{0}\n\nShall '{1}' be installed using pip? (Y/n)" + .format(message, packageName), end=" ") + answer = input() if answer in ("", "Y", "y"): exitCode = subprocess.call( [sys.executable, "-m", "pip", "install", packageName]) @@ -1723,7 +1730,7 @@ global progName, modDir, doCleanup, doCompile, distDir, cfg, apisDir global sourceDir, eric6SourceDir, configName global macAppBundlePath, macAppBundleName, macPythonExe - global installApis, doCleanDesktopLinks + global installApis, doCleanDesktopLinks, yes2All if sys.version_info < (3, 5, 0) or sys.version_info > (3, 99, 99): print('Sorry, eric6 requires at least Python 3.5 for running.') @@ -1740,15 +1747,15 @@ if sys.platform.startswith(("win", "cygwin")): optlist, args = getopt.getopt( argv[1:], "chxza:b:d:f:", - ["help", "no-apis"]) + ["help", "no-apis", "yes"]) elif sys.platform == "darwin": optlist, args = getopt.getopt( argv[1:], "chxza:b:d:f:i:m:n:p:", - ["help", "no-apis"]) + ["help", "no-apis", "yes"]) else: optlist, args = getopt.getopt( argv[1:], "chxza:b:d:f:i:", - ["help", "no-apis"]) + ["help", "no-apis", "yes"]) except getopt.GetoptError as err: print(err) usage() @@ -1793,6 +1800,8 @@ installApis = False elif opt == "--clean-desktop": doCleanDesktopLinks = True + elif opt == "--yes": + yes2All = True infoName = "" installFromSource = not os.path.isdir(sourceDir)