Пример #1
0
def remove_download(project_dir, filename_variable):
    """Remove a download requirement from project and from file system."""
    project = load_project(project_dir)
    result = prepare_without_interaction(project, mode=PROVIDE_MODE_CHECK)
    status = project_ops.remove_download(project, result, env_var=filename_variable)
    if status:
        print(status.status_description)
        print("Removed {} from the project file.".format(filename_variable))
        return 0
    else:
        console_utils.print_status_errors(status)
        return 1
Пример #2
0
    def remove_download(self, project, prepare_result, env_var):
        """Remove file or directory referenced by ``env_var`` from file system and the project.

        The returned ``Status`` will be an instance of ``SimpleStatus``. A False
        status will have an ``errors`` property with a list of error
        strings.

        Args:
            project (Project): the project
            prepare_result (PrepareResult): result of a previous prepare
            env_var (str): env var to store the local filename

        Returns:
            ``Status`` instance
        """
        return project_ops.remove_download(project=project, prepare_result=prepare_result, env_var=env_var)
Пример #3
0
def remove_download(project_dir, env_spec_name, filename_variable):
    """Remove a download requirement from project and from file system."""
    project = load_project(project_dir)
    # we can remove a download even if prepare fails, so disable
    # printing errors in the frontend.
    with project.null_frontend():
        result = prepare_without_interaction(project, env_spec_name=env_spec_name, mode=PROVIDE_MODE_CHECK)
    status = project_ops.remove_download(project,
                                         env_spec_name=env_spec_name,
                                         env_var=filename_variable,
                                         prepare_result=result)
    if status:
        print(status.status_description)
        print("Removed {} from the project file.".format(filename_variable))
        return 0
    else:
        console_utils.print_status_errors(status)
        return 1