Ejemplo n.º 1
0
def add_all_pip_available_packages_to_packages_to_import_dict():
    simple_index_dir = Configuration.simple_index_dir
    if MyGlobals.dir_exists(simple_index_dir):
        dir_flat_files_list = os.listdir(simple_index_dir)
    else:
        dir_flat_files_list = os.listdir(Configuration.import_from)
        dir_flat_files_list = convert_flat_files_names_list_to_packages_names(
            dir_flat_files_list)

    for pkg_name in dir_flat_files_list:
        if pkg_name.lower() == "index.html":
            continue
        add_package_to_packages_to_import_dict(pkg_name)
Ejemplo n.º 2
0
def init():
    global pip_executable
    global extra_pip_args
    global pip_2_tgz_executable
    global dir_2_pi_executable
    global export_packages
    global export_to
    global import_packages
    global import_from
    global exported_files_json_file
    global log_file

    global simple_index_dir
    global index_url

    # Expand env variables if any
    pip_executable = MyGlobals.remove_surrounding_quotes(
        MyGlobals.expand_variable(
            pip_executable)).strip() if pip_executable else pip_executable
    extra_pip_args = MyGlobals.remove_surrounding_quotes(
        MyGlobals.expand_variable(
            extra_pip_args)).strip() if extra_pip_args else extra_pip_args
    export_packages = MyGlobals.remove_surrounding_quotes(
        MyGlobals.expand_variable(
            export_packages)).strip() if export_packages else export_packages
    export_to = MyGlobals.remove_surrounding_quotes(
        MyGlobals.expand_variable(
            export_to)).strip() if export_to else export_to
    import_packages = MyGlobals.remove_surrounding_quotes(
        MyGlobals.expand_variable(
            import_packages)).strip() if import_packages else import_packages
    import_from = MyGlobals.remove_surrounding_quotes(
        MyGlobals.expand_variable(
            import_from)).strip() if import_from else import_from
    exported_files_json_file = MyGlobals.remove_surrounding_quotes(
        MyGlobals.expand_variable(exported_files_json_file)).strip(
        ) if exported_files_json_file else exported_files_json_file
    log_file = MyGlobals.remove_surrounding_quotes(
        MyGlobals.expand_variable(log_file)).strip() if log_file else log_file

    simple_index_dir = os.path.join(import_from, "simple")
    if MyGlobals.dir_exists(simple_index_dir):
        simple_index_dir = MyGlobals.convert_windows_path_to_linux(
            simple_index_dir)
    index_url = simple_index_dir

    if is_verbose:
        logging.getLogger().setLevel(logging.NOTSET)
        for log_hdnlr in logging.getLogger().handlers:
            log_hdnlr.setLevel(logging.NOTSET)