args = parser.parse_args() # main jar_files = jdeps.get_files_in_dir(args.jar_dir) index = defaultdict(set) # print args.search_package # perform search for jar in jar_files: jar_path = os.path.join(args.jar_dir, jar) jdeps_imports = jdeps.run_jdeps(jar_path, args.class_level) manifest_imports = jdeps.manifest_imports( jar_path) if args.filter_import else set() if args.verbose: print 'jar: ' + jar print 'jdeps_imports: %s' % jdeps_imports print 'manifest_imports: %s' % manifest_imports print for package_name in jdeps_imports: if not args.filter_import or package_name in manifest_imports: if args.use_as_subpackage: for subpackage in jdeps.get_all_subpackages(package_name): for search_package in args.search_package: if subpackage.startswith(search_package): index[subpackage].add(jar) else:
import sys sys.path.insert(0, sys.path[0] + '/lib') #add lib folder to import paths import argparse import os import jdeps parser = argparse.ArgumentParser(description='Print Import-Package Dependencies') parser.add_argument('jar_dir', type=jdeps.readable_dir, help='directory containing jar files') args = parser.parse_args() jar_files = jdeps.get_files_in_dir(args.jar_dir) for jar in jar_files: jar_path = os.path.join(args.jar_dir, jar) manifest_imports = jdeps.manifest_imports(jar_path) print jar for imp in manifest_imports: print " ", imp
parser.add_argument('search_package', help='package to find (must be in the format a.b.c)') args = parser.parse_args() # main jar_files = jdeps.get_files_in_dir(args.jar_dir) index = defaultdict(set) # perform search for jar in jar_files: jar_path = os.path.join(args.jar_dir, jar) jdeps_imports = jdeps.run_jdeps(jar_path, args.class_level) manifest_imports = jdeps.manifest_imports(jar_path) if args.filter_import else set() if args.verbose: print 'jar: ' + jar print 'jdeps_imports: %s' % jdeps_imports print 'manifest_imports: %s' % manifest_imports print for package_name in jdeps_imports: if not args.filter_import or package_name in manifest_imports: if args.use_as_subpackage: for subpackage in jdeps.get_all_subpackages(package_name): if subpackage.startswith(args.search_package): index[subpackage].add(jar) else: if package_name == args.search_package:
import sys sys.path.insert(0, sys.path[0] + '/lib') #add lib folder to import paths import argparse import os import jdeps parser = argparse.ArgumentParser( description='Print Import-Package Dependencies') parser.add_argument('jar_dir', type=jdeps.readable_dir, help='directory containing jar files') args = parser.parse_args() jar_files = jdeps.get_files_in_dir(args.jar_dir) for jar in jar_files: jar_path = os.path.join(args.jar_dir, jar) manifest_imports = jdeps.manifest_imports(jar_path) print jar for imp in manifest_imports: print " ", imp