Ejemplo n.º 1
0
    def check(dirname):
        with fake_server(monkeypatch, expected_basename='foo.zip'):
            project = project_ops.create(dirname)
            archivefile = os.path.join(dirname, "tmp.zip")
            project_ops.archive(project, archivefile)

            status = _upload(project, archivefile, "foo.zip", site='unit_test')
            assert status
Ejemplo n.º 2
0
    def check(dirname):
        with fake_server(monkeypatch, expected_basename='foo.zip', fail_these=('stage', )):
            project = project_ops.create(dirname)
            archivefile = os.path.join(dirname, "tmp.zip")
            project_ops.archive(project, archivefile)

            status = _upload(project, archivefile, "foo.zip", site='unit_test')
            assert not status
            assert '501' in status.errors[0]
Ejemplo n.º 3
0
    def archive(self, project, filename):
        """Make an archive of the non-ignored files in the project.

        Args:
            project (``Project``): the project
            filename (str): name of a zip, tar.gz, or tar.bz2 archive file

        Returns:
            a ``Status``, if failed has ``errors``
        """
        return project_ops.archive(project=project, filename=filename)
Ejemplo n.º 4
0
def archive_command(project_dir, archive_filename):
    """Make an archive of the project.

    Returns:
        exit code
    """
    project = load_project(project_dir)
    status = project_ops.archive(project, archive_filename)
    if status:
        print(status.status_description)
        return 0
    else:
        console_utils.print_status_errors(status)
        return 1
Ejemplo n.º 5
0
    def archive(self, project, filename, pack_envs=False):
        """Make an archive of the non-ignored files in the project.

        Args:
            project (``Project``): the project
            filename (str): name of a zip, tar.gz, or tar.bz2 archive file
            pack_envs (bool): Flag to include conda-packs of each env_spec in the archive

        Returns:
            a ``Status``, if failed has ``errors``
        """
        return project_ops.archive(project=project,
                                   filename=filename,
                                   pack_envs=pack_envs)
Ejemplo n.º 6
0
def archive_command(project_dir, archive_filename, pack_envs):
    """Make an archive of the project.

    Returns:
        exit code
    """
    if pack_envs:
        prepare_status = prepare_command(project_dir,
                                         ui_mode='production_defaults',
                                         conda_environment=None,
                                         command_name=None,
                                         all=True)
        if not prepare_status:
            return 1

    project = load_project(project_dir)

    status = project_ops.archive(project, archive_filename, pack_envs)
    if status:
        print(status.status_description)
        return 0
    else:
        console_utils.print_status_errors(status)
        return 1