def main(args): binstar = get_binstar(args) spec = args.spec if spec._basename: dist = binstar.distribution(spec.user, spec.package, spec.version, spec.basename) log.info(dist.pop('basename')) log.info(dist.pop('description') or 'no description') log.info('') metadata = dist.pop('attrs', {}) for key_value in dist.items(): log.info('%-25s: %r' % key_value) log.info('Metadata:') for key_value in metadata.items(): log.info(' + %-25s: %r' % key_value) elif args.spec._version: log.info('version %s' % spec.version) release = binstar.release(spec.user, spec.package, spec.version) for dist in release['distributions']: log.info(' + %(basename)s' % dist) log.info('%s' % release.get('public_attrs', {}).get('description')) elif args.spec._package: package = binstar.package(spec.user, spec.package) package['access'] = 'published' if package.get( 'published') else 'public' if package['public'] else 'private' log.info('Name: %(name)s' % package) log.info('Summary: %(summary)s' % package) log.info('Access: %(access)s' % package) log.info('Package Types: %s' % ', '.join(package.get('package_types'))) log.info('Versions:' % package) for release in package['releases']: log.info(' + %(version)s' % release) log.info('') for package_type in package.get('package_types'): install_info(package, package_type) if not package['public']: log.info('To generate a $TOKEN run:') log.info(' TOKEN=$(binstar auth --create --name <TOKEN-NAME>)') elif args.spec._user: user_info = binstar.user(spec.user) pprint_user(user_info) pprint_packages(binstar.user_packages(spec.user)) if user_info['user_type'] == 'user': pprint_orgs(binstar.user_orgs(spec.user)) else: pprint_collections(binstar.collections(spec.user)) else: log.info(args.spec)
def main(args): binstar = get_binstar(args) spec = args.spec if spec._basename: dist = binstar.distribution(spec.user, spec.package, spec.version, spec.basename) log.info(dist.pop('basename')) log.info(dist.pop('description') or 'no description') log.info('') metadata = dist.pop('attrs', {}) for key_value in dist.items(): log.info('%-25s: %r' % key_value) log.info('Metadata:') for key_value in metadata.items(): log.info(' + %-25s: %r' % key_value) elif args.spec._version: log.info('version %s' % spec.version) release = binstar.release(spec.user, spec.package, spec.version) for dist in release['distributions']: log.info(' + %(basename)s' % dist) log.info('%s' % release.get('public_attrs', {}).get('description')) elif args.spec._package: package = binstar.package(spec.user, spec.package) package['access'] = 'published' if package.get('published') else 'public' if package['public'] else 'private' log.info('Name: %(name)s' % package) log.info('Summary: %(summary)s' % package) log.info('Access: %(access)s' % package) log.info('Package Types: %s' % ', '.join(package.get('package_types'))) log.info('Versions:' % package) for release in package['releases']: log.info(' + %(version)s' % release) log.info('') for package_type in package.get('package_types'): install_info(package, package_type) if not package['public']: log.info('To generate a $TOKEN run:') log.info(' TOKEN=$(binstar auth --create --name <TOKEN-NAME>)') elif args.spec._user: user_info = binstar.user(spec.user) pprint_user(user_info) pprint_packages(binstar.user_packages(spec.user)) if user_info['user_type'] == 'user': pprint_orgs(binstar.user_orgs(spec.user)) else: pprint_collections(binstar.collections(spec.user)) else: log.info(args.spec)
def main(args): binstar = get_binstar(args) spec = args.spec if spec._basename: dist = binstar.distribution(spec.user, spec.package, spec.version, spec.basename) log.info(dist.pop('basename')) log.info(dist.pop('description') or 'no description') log.info() metadata = dist.pop('attrs', {}) for key_value in dist.items(): log.info('%-25s: %r' % key_value) log.info('Metadata:') for key_value in metadata.items(): log.info(' + %-25s: %r' % key_value) elif args.spec._version: log.info('version %s' % spec.version) release = binstar.release(spec.user, spec.package, spec.version) for dist in release['distributions']: log.info(' + %(basename)s' % dist) log.info() log.info('%(description)s' % release['public_attrs']) elif args.spec._package: package = binstar.package(spec.user, spec.package) package['permission'] = 'public' if package['public'] else 'private' log.info('- %(name)s: [%(permission)s] %(summary)s' % package) for release in package['releases']: log.info(' + %(version)s' % release) elif args.spec._user: user_info = binstar.user(spec.user) pprint_user(user_info) pprint_packages(binstar.user_packages(spec.user)) if user_info['user_type'] == 'user': pprint_orgs(binstar.user_orgs(spec.user)) else: pprint_collections(binstar.collections(spec.user)) else: log.info(args.spec)