scripts/install.py

changeset 8258
82b608e352ec
parent 8254
259484b0fc75
child 8260
2161475d9639
equal deleted inserted replaced
8257:28146736bbfc 8258:82b608e352ec
1015 # check, if pywin32 is available 1015 # check, if pywin32 is available
1016 from win32com.client import Dispatch # __IGNORE_WARNING__ 1016 from win32com.client import Dispatch # __IGNORE_WARNING__
1017 except ImportError: 1017 except ImportError:
1018 installed = pipInstall( 1018 installed = pipInstall(
1019 "pywin32", 1019 "pywin32",
1020 "\nThe Python package 'pywin32' could not be imported." 1020 "\nThe Python package 'pywin32' could not be imported.",
1021 force=False
1021 ) 1022 )
1022 if installed: 1023 if installed:
1023 # create the links via an external script to get around some 1024 # create the links via an external script to get around some
1024 # startup magic done by pywin32.pth 1025 # startup magic done by pywin32.pth
1025 args = [ 1026 args = [
1332 installInfo["exe_edited"] = False 1333 installInfo["exe_edited"] = False
1333 installInfo["argv_edited"] = False 1334 installInfo["argv_edited"] = False
1334 installInfo["eric_edited"] = False 1335 installInfo["eric_edited"] = False
1335 1336
1336 1337
1337 def pipInstall(packageName, message): 1338 def pipInstall(packageName, message, force=True):
1338 """ 1339 """
1339 Install the given package via pip. 1340 Install the given package via pip.
1340 1341
1341 @param packageName name of the package to be installed 1342 @param packageName name of the package to be installed
1342 @type str 1343 @type str
1343 @param message message to be shown to the user 1344 @param message message to be shown to the user
1344 @type str 1345 @type str
1346 @param force flag indicating to perform the installation
1347 without asking the user
1348 @type bool
1345 @return flag indicating a successful installation 1349 @return flag indicating a successful installation
1346 @rtype bool 1350 @rtype bool
1347 """ 1351 """
1348 global yes2All 1352 global yes2All
1349 1353
1350 ok = False 1354 ok = False
1351 if yes2All: 1355 if yes2All or force:
1352 answer = "y" 1356 answer = "y"
1353 else: 1357 else:
1354 print("{0}\n\nShall '{1}' be installed using pip? (Y/n)" 1358 print("{0}\n\nShall '{1}' be installed using pip? (Y/n)"
1355 .format(message, packageName), end=" ") 1359 .format(message, packageName), end=" ")
1356 answer = input() # secok 1360 answer = input() # secok
1526 (("PyQt5.QtWebEngineWidgets", ), sys.maxsize <= 2**32), 1530 (("PyQt5.QtWebEngineWidgets", ), sys.maxsize <= 2**32),
1527 ] 1531 ]
1528 optionalModulesList = { 1532 optionalModulesList = {
1529 # key is pip project name 1533 # key is pip project name
1530 # value is tuple of package name, pip install constraint 1534 # value is tuple of package name, pip install constraint
1531 "PyYAML": ("yaml", ""), 1535 "docutils": ("docutils", ""),
1536 "Markdown": ("markdown", ""),
1537 "pyyaml": ("yaml", ""),
1532 "toml": ("toml", ""), 1538 "toml": ("toml", ""),
1539 "chardet": ("chardet", ""),
1540 "asttokens": ("asttokens", ""),
1541 "EditorConfig": ("editorconfig", ""),
1542 "Send2Trash": ("send2trash", ""),
1543 "Pygments": ("pygments", ""),
1533 } 1544 }
1534 # dict with tuples of package name and install constraint 1545 # dict with tuples of package name and install constraint
1535 if sys.platform != "darwin" and not ignorePyqt5Tools: 1546 if sys.platform != "darwin" and not ignorePyqt5Tools:
1536 optionalModulesList["qt5-applications"] = ("qt5_applications", 1547 optionalModulesList["qt5-applications"] = ("qt5_applications",
1537 "<5.15.2") 1548 "<5.15.2")

eric ide

mercurial