MCPcopy Create free account
hub / github.com/ehForwarderBot/ehForwarderBot / prerequisite_check

Function prerequisite_check

ehforwarderbot/wizard.py:385–437  ·  view source on GitHub ↗

Check prerequisites of the framework, including Python version, installation of modules, etc. Returns: Optional[str]: If the check is not passed, return error message regarding failed test case. None is returned otherwise.

()

Source from the content-addressed store, hash-verified

383
384
385def prerequisite_check():
386 """
387 Check prerequisites of the framework, including Python version, installation of
388 modules, etc.
389
390 Returns:
391 Optional[str]: If the check is not passed, return error message regarding
392 failed test case. None is returned otherwise.
393 """
394
395 # Check Python version
396 print(_("Checking Python version... "), end="")
397 if sys.version_info < (3, 6):
398 version_str = "%s.%s.%s" % sys.version_info[:3]
399 # TRANSLATORS: This word is used as a part of search query suggested to users,
400 # it may appears in context like "Ubuntu 16.04 install Python 3.7"
401 search_url = build_search_query(_("install") + " Python 3.7")
402 print()
403 print(_("EH Forwarder Bot requires a minimum of Python 3.6 to run. You "
404 "are currently using Python {version}. \n"
405 "\n"
406 "You may want to try:\n"
407 "{url}").format(version=version_str, url=search_url))
408 exit(1)
409 else:
410 print(_("OK"))
411
412 # Check installations of modules
413 modules_err = _("You may want to visit the modules repository to find a list of "
414 "available modules to install.\n"
415 "https://efb-modules.1a23.studio")
416 # 1. At least 1 master channel must be installed
417 print(_("Checking master channels... "), end="")
418 try:
419 next(pkg_resources.iter_entry_points("ehforwarderbot.master"))
420 except StopIteration:
421 print()
422 print(_("No master channel detected. EH Forwarder Bot requires at least one "
423 "master channel installed to run.") + "\n\n" + modules_err)
424 exit(1)
425 print(_("OK"))
426
427 # 2. At least 1 slave channel must be installed
428 print(_("Checking slave channels... "), end="")
429 try:
430 next(pkg_resources.iter_entry_points("ehforwarderbot.slave"))
431 except StopIteration:
432 print()
433 print(_("No slave channel detected. EH Forwarder Bot requires at least one "
434 "slave channel installed to run.") + "\n\n" + modules_err)
435 exit(1)
436 print(_("OK"))
437 print()
438
439
440def choose_master_channel(data: DataModel):

Callers 1

mainFunction · 0.85

Calls 1

build_search_queryFunction · 0.85

Tested by

no test coverage detected