def print_view(args): npm2deb_instance = get_npm2deb_instance(args) if args.json: from json import dumps # print a clean version of json module json = npm2deb_instance.json for key in [ 'time', 'versions', 'dist-tags', 'component', 'users', 'time', 'maintainers', 'readmeFilename', 'contributors', 'keywords' ]: if key in json: del json[key] print(dumps(json, indent=4, sort_keys=True)) else: formatted = "{0:40}{1}" for key in ['name', 'version', 'description', 'homepage', 'license']: attr_key = key if key == 'license' or key == 'version': attr_key = 'upstream_%s' % key print( formatted.format("%s:" % key.capitalize(), getattr(npm2deb_instance, attr_key, None))) mapper = _Mapper.get_instance() pkg_info = mapper.get_debian_package(npm2deb_instance.name) print( formatted.format("Debian:", "%s (%s)" % (pkg_info['repr'], pkg_info['suite']))) if mapper.has_warnings(): print("") _show_mapper_warnings()
def print_view(args): npm2deb_instance = get_npm2deb_instance(args) if args.json: from json import dumps # print a clean version of json module json = npm2deb_instance.json for key in [ 'time', 'versions', 'dist-tags', 'component', 'users', 'time', 'maintainers', 'readmeFilename', 'contributors', 'keywords' ]: if key in json: del json[key] print(dumps(json, indent=4, sort_keys=True)) else: formatted = "{0:40}{1}" for key in ['name', 'version', 'description', 'homepage', 'license']: attr_key = key if key == 'license' or key == 'version': attr_key = 'upstream_%s' % key print( formatted.format("%s:" % key.capitalize(), getattr(npm2deb_instance, attr_key, None))) mapper = _Mapper.get_instance() pkg_info = mapper.get_debian_package(npm2deb_instance.name) print( formatted.format( "Debian:", "%s (%s)" % (pkg_info['repr'], pkg_info['suite']))) if mapper.has_warnings(): print("") _show_mapper_warnings()
def search_for_module(args): _helper.DO_PRINT = True # enable all by default if not args.bug and not args.debian and not args.repository and not args.new: args.bug = True args.debian = True args.repository = True args.new = True node_module = get_npm2deb_instance(args).name if args.debian: print("\nLooking for similiar package:") mapper = _Mapper.get_instance() print(" %s" % mapper.get_debian_package(node_module)['repr']) if args.repository: print("") _helper.search_for_repository(node_module) if args.bug: print("") _helper.search_for_bug(node_module) if args.new: print("") _helper.search_in_new(node_module) print("") _show_mapper_warnings()
def search_for_module(args): _helper.DO_PRINT = True # enable all by default if not args.bug and not args.debian and not args.repository: args.bug = True args.debian = True args.repository = True node_module = get_npm2deb_instance(args).name if args.debian: print("\nLooking for similiar package:") mapper = _Mapper.get_instance() print(" %s" % mapper.get_debian_package(node_module)['repr']) if args.repository: print("") _helper.search_for_repository(node_module) if args.bug: print("") _helper.search_for_bug(node_module) print("") _show_mapper_warnings()
def search_for_module(args): _helper.DO_PRINT = True # enable all by default if not (args.bug or args.debian or args.repository): args.bug = True args.debian = True args.repository = True node_module = get_npm2deb_instance(args).name if args.debian: print("\nLooking for similar package:") mapper = _Mapper.get_instance() pkg_info = mapper.get_debian_package(node_module) print(" %s (%s)" % (pkg_info['repr'], pkg_info['suite'])) if args.repository: print("") _helper.search_for_repository(node_module) if args.bug: print("") _helper.search_for_bug(node_module) print("") _show_mapper_warnings()
def search_for_module(args): _helper.DO_PRINT = True # enable all by default if not (args.bug or args.debian or args.repository): args.bug = True args.debian = True args.repository = True node_module = get_npm2deb_instance(args).name if args.debian: print("\nLooking for similiar package:") mapper = _Mapper.get_instance() pkg_info = mapper.get_debian_package(node_module) print(" %s (%s)" % (pkg_info['repr'], pkg_info['suite'])) if args.repository: print("") _helper.search_for_repository(node_module) if args.bug: print("") _helper.search_for_bug(node_module) print("") _show_mapper_warnings()
def show_dependencies(args): _helper.DO_PRINT = True # enable all by default if not args.binary and not args.builddeb: args.binary = True args.builddeb = True npm2deb_instance = get_npm2deb_instance(args) module_name = npm2deb_instance.name json = npm2deb_instance.json if args.binary: if 'dependencies' in json and json['dependencies']: print("Dependencies:") _helper.print_formatted_dependency("NPM", "Debian") module_ver = npm2deb_instance.upstream_version module_deb = _Mapper.get_instance()\ .get_debian_package(module_name)["repr"] _helper.print_formatted_dependency("%s (%s)" % (module_name, module_ver), module_deb) _helper.search_for_dependencies(npm2deb_instance, args.recursive, args.force) print("") else: print("Module %s has no dependencies." % module_name) if args.builddeb: if 'devDependencies' in json and json['devDependencies']: print("Build dependencies:") _helper.print_formatted_dependency("NPM", "Debian") _helper.search_for_builddep(npm2deb_instance) print("") else: print("Module %s has no build dependencies." % module_name) _show_mapper_warnings()
def show_dependencies(args): _helper.DO_PRINT = True # enable all by default if not args.binary and not args.builddeb: args.binary = True args.builddeb = True npm2deb_instance = get_npm2deb_instance(args) module_name = npm2deb_instance.name json = npm2deb_instance.json if args.binary: if 'dependencies' in json and json['dependencies']: print("Dependencies:") _helper.print_formatted_dependency("NPM", "Debian") module_ver = npm2deb_instance.upstream_version module_deb = _Mapper.get_instance()\ .get_debian_package(module_name)["repr"] _helper.print_formatted_dependency( "%s (%s)" % (module_name, module_ver), module_deb) _helper.search_for_dependencies(npm2deb_instance, args.recursive, args.force) print("") else: print("Module %s has no dependencies." % module_name) if args.builddeb: if 'devDependencies' in json and json['devDependencies']: print("Build dependencies:") _helper.print_formatted_dependency("NPM", "Debian") _helper.search_for_builddep(npm2deb_instance) print("") else: print("Module %s has no build dependencies." % module_name) _show_mapper_warnings()
def _show_mapper_warnings(): mapper = _Mapper.get_instance() if mapper.has_warnings(): print("Warnings occurred:") mapper.show_warnings() print("")
def _show_mapper_warnings(): mapper = _Mapper.get_instance() if mapper.has_warnings(): print("Warnings occured:") mapper.show_warnings() print("")