def run(self, context): o, a = context.get_parsed_arguments() if len(a) < 1: context.options_context.parser.print_usage() # FIXME raise NotImplementedError("expected file argument") else: filename = a[0] if o.repository and (o.username or o.password or o.repository_url): raise bento.errors.UsageException( "Cannot specify repository and username/password/url at the same time") if not (o.repository or (o.username or o.password or o.repository_url)): # FIXME: why does distutils use DEFAULT_REPOSITORY (i.e. an url) # here ? config = _read_pypirc(DEFAULT_REPOSITORY) elif o.repository: config = _read_pypirc(o.repository) else: config = PyPIConfig(o.username, o.password, o.repository_url) if o.distribution_type is None: # FIXME raise NotImplementedError("automatic distribution type not yet implemented") if not o.distribution_type in _SUPPORTED_DISTRIBUTIONS: raise bento.errors.BentoError( "Unsupported distribution type %r (supported types: %s)" % \ (o.distribution_type, ", ".join(repr(i) for i in _SUPPORTED_DISTRIBUTIONS))) upload_type = _SUPPORTED_DISTRIBUTIONS[o.distribution_type] upload(filename, upload_type, context.pkg, config=config)
def run(self, context): o, a = context.get_parsed_arguments() if len(a) < 1: context.options_context.parser.print_usage() # FIXME raise NotImplementedError("expected file argument") else: filename = a[0] if o.repository and (o.username or o.password or o.repository_url): raise bento.errors.UsageException( "Cannot specify repository and username/password/url at the same time" ) if not (o.repository or (o.username or o.password or o.repository_url)): # FIXME: why does distutils use DEFAULT_REPOSITORY (i.e. an url) # here ? config = _read_pypirc(DEFAULT_REPOSITORY) elif o.repository: config = _read_pypirc(o.repository) else: config = PyPIConfig(o.username, o.password, o.repository_url) if o.distribution_type is None: # FIXME raise NotImplementedError( "automatic distribution type not yet implemented") if not o.distribution_type in _SUPPORTED_DISTRIBUTIONS: # FIXME raise NotImplementedError() upload_type = _SUPPORTED_DISTRIBUTIONS[o.distribution_type] upload(filename, upload_type, context.pkg, config=config)
def test_upload(self): config = PyPIConfig("john", "password", repository="http://localhost") upload("foo.bin", "bdist_dumb", self.package, config)