Ejemplo n.º 1
0
def export_package(py_pkg):
    export_msg = "Exporting package: {}".format(py_pkg.full_name)
    log_info(export_msg)

    pip = Configuration.pip_executable
    import_opts = "download -d \"{}\" {}".format(Configuration.export_to,
                                                 py_pkg.full_name)
    extra_pip_args = Configuration.extra_pip_args
    cmnd = "{} {} {}".format(pip, import_opts, extra_pip_args)
    return MyGlobals.execute_command(cmnd)
Ejemplo n.º 2
0
def import_package(py_pkg):
    import_msg = "Importing package: {}".format(py_pkg.full_name)
    log_info(import_msg)

    pip = Configuration.pip_executable
    # import_opts = "install --no-index --find-links=\"{}\" {}".format(Configuration.import_from, py_pkg.full_name)
    index_url = Configuration.index_url
    if os.name == 'nt':
        index_url = "file:///{}".format(index_url)
    import_opts = "install --index-url=\"{}\" {}".format(
        index_url, py_pkg.full_name)
    extra_pip_args = Configuration.extra_pip_args
    cmnd = "{} {} {}".format(pip, import_opts, extra_pip_args)
    return MyGlobals.execute_command(cmnd)
Ejemplo n.º 3
0
def add_all_pip_freeze_packages_to_packages_to_export_dict():
    pip = Configuration.pip_executable
    opts = "freeze"
    cmnd = "{} {}".format(pip, opts)
    action_dict = MyGlobals.execute_command(cmnd)
    if not action_dict["Result"]:
        log_error(
            "Failed to retrieve all installed pip packages using 'pip freeze' command"
        )
        MyGlobals.terminate_program(1)
    pip_freeze_output = action_dict["MoreInfo"].decode(
        Configuration.decode_commands_output_fmt).split("\n")
    for pkg_str in pip_freeze_output:
        if pkg_str and "==" not in pkg_str:
            log_warning(
                "pip freeze command invalid output: {}. Not in format of: pkg_name==pkg_version. Skipping this line"
                .format(pkg_str))
            continue
        add_package_to_packages_to_export_dict(pkg_str)