Пример #1
0
def choose_plugins_to_enable() -> list:
    """
    Seeks all findable plugins and asks which ones to enable

    :return list of plugins to enable
    """
    plugins_to_enable = list()

    for package in os.listdir(constants.PLUGINS_PATH):
        package_full_path = os.path.join(constants.PLUGINS_PATH, package)
        if not os.path.isdir(package_full_path):
            continue

        for _file_ in os.listdir(package_full_path):
            if _file_.endswith(".py") and _file_ != "__init__.py":
                plugin = "{}.{}".format(package, os.path.splitext(_file_)[0])
                plugin_is_enabled = True if plugin in get_global_conf().get(
                    "plugins", "enabled_plugins") else False
                answer = ask_question(
                    "Would you like to enable the {} plugin ? {}".format(
                        plugin, format_closed_question(plugin_is_enabled)),
                    validate_answers=validate_closed_question,
                    default="y" if plugin_is_enabled else "n")
                if answer:
                    plugins_to_enable.append(plugin)

    return plugins_to_enable
Пример #2
0
def choose_module_handling() -> str:
    """
    Choose whether or not to install required python modules automatically or not
    :return whether to handle python modules or not
    """
    return str(
        ask_question(
            "Do you want the script to automatically install required python modules ? {}"
            .format(
                format_closed_question(get_global_conf().getboolean(
                    "install", "module_handling"))),
            validate_answers=validate_closed_question,
            default=get_global_conf().get("install", "module_handling")))
Пример #3
0
def choose_wllvm() -> str:
    """
    Allows the user to choose whether to produce llvm bitcode or not
    :return whether to return wllvm or not
    """
    return str(
        ask_question(
            "Do you want to produce llvm bitcode from the binaries ? {}".
            format(
                format_closed_question(get_global_conf().getboolean(
                    "install", "llvm_bitcode"))),
            validate_answers=validate_closed_question,
            default=get_global_conf().get("install", "llvm_bitcode")))
Пример #4
0
def show_progress() -> str:
    """
    Asks user whether to show progress on long time running tasks or not

    :return: the answer
    """
    return str(
        ask_question(
            "Do you want to show progress on long time running tasks ? {}".
            format(
                format_closed_question(
                    get_global_conf()["DEFAULT"]["show_progress"])),
            validate_answers=validate_closed_question,
            default=get_global_conf()["DEFAULT"]["show_progress"]))