Example #1
0
    def upload(self,
               project,
               private=None,
               site=None,
               username=None,
               token=None,
               suffix='.tar.bz2',
               log_level=None):
        """Upload the project to the Anaconda server.

        Args:
            project (``Project``): the project
            private (bool): make project private
            site (str): site alias from Anaconda config
            username (str): Anaconda username
            token (str): Anaconda auth token
            log_level (str): Anaconda log level

        Returns:
            a ``Status``, if failed has ``errors``
        """
        return project_ops.upload(project=project,
                                  private=private,
                                  site=site,
                                  username=username,
                                  token=token,
                                  suffix=suffix,
                                  log_level=log_level)
Example #2
0
def upload_command(project_dir, site, username, token):
    """Upload project to Anaconda.

    Returns:
        exit code
    """
    project = load_project(project_dir)
    status = project_ops.upload(project, site=site, username=username, token=token)
    if status:
        for line in status.logs:
            print(line)
        print(status.status_description)
        return 0
    else:
        console_utils.print_status_errors(status)
        return 1
def _real_upload_project(project, args, username):
    from anaconda_project import project_ops

    print("Uploading project: {}".format(project.name))

    status = project_ops.upload(project, site=args.site, username=username,
                                token=args.token, log_level=args.log_level)

    for log in status.logs:
        print(log)
    if not status:
        for error in status.errors:
            print(error, file=sys.stderr)
        print(status.status_description, file=sys.stderr)
        raise errors.BinstarError(status.status_description)
    else:
        print(status.status_description)
        return [project.name, status.url]
Example #4
0
def _real_upload_project(project, args, username):
    from anaconda_project import project_ops

    print("Uploading project: {}".format(project.name))

    status = project_ops.upload(project, site=args.site, username=username,
                                token=args.token, log_level=args.log_level)

    for log in status.logs:
        print(log)
    if not status:
        for error in status.errors:
            print(error, file=sys.stderr)
        print(status.status_description, file=sys.stderr)
        raise errors.BinstarError(status.status_description)
    else:
        print(status.status_description)
        return [project.name, status.url]
Example #5
0
def upload_command(project_dir, private, site, username, token, suffix):
    """Upload project to Anaconda.

    Returns:
        exit code
    """
    project = load_project(project_dir)
    status = project_ops.upload(project,
                                private=private,
                                site=site,
                                username=username,
                                token=token,
                                suffix=suffix)
    if status:
        print(status.status_description)
        return 0
    else:
        console_utils.print_status_errors(status)
        return 1