From 1626259059a7b2da817fe6a32126c2eddd14406c Mon Sep 17 00:00:00 2001 From: Alexander Bersenev Date: Sun, 21 Aug 2011 15:59:46 +0000 Subject: documentation changes and args parsing fixed --- src/autodep/autodep | 20 +++++++++++++++----- 1 file changed, 15 insertions(+), 5 deletions(-) (limited to 'src') diff --git a/src/autodep/autodep b/src/autodep/autodep index 034c47a..d607ed6 100755 --- a/src/autodep/autodep +++ b/src/autodep/autodep @@ -28,7 +28,7 @@ def parse_args(): args_parser.add_option("-v","--verbose", action="store_true", dest="verbose", default=False, help="Show non-important packages, " "unknown package and unknown stage") - args_parser.add_option("-n","--numfiles",action="store", type="string", + args_parser.add_option("-n","--numfiles",action="store", type="int", dest="numfiles", default=10, help="Maximum number of files from each package to show (default is 10)") @@ -160,7 +160,7 @@ def get_filter_function(options,args,system_packages,portage_api): depslist=list(portage_api.get_deps_for_package_building(pkg)) allowedpkgs+=depslist # manually add all python interpreters to this list - allowedpkgs+=["python"] + allowedpkgs+=["dev-lang/python"] else: program_path=runtime_vars["full_path"] file_to_package=portage_utils.getpackagesbyfiles([program_path]) @@ -172,7 +172,7 @@ def get_filter_function(options,args,system_packages,portage_api): portage_api.get_deps(file_to_package[program_path],["RDEPEND"])) allowedpkgs+=depslist - print allowedpkgs + #print allowedpkgs # remember the allowedpkgs in deps_all. It is bad to do it here. runtime_vars["deps_all"]=allowedpkgs @@ -217,7 +217,17 @@ if runtime_vars["is_emerge"]: portage_api.get_dep(pkg,["DEPEND"])) runtime_vars["deps_portage"]=portage_api.get_dep('portage',["RDEPEND"]) - +else: + if runtime_vars["deps_all"]==[]: + # we mostly repeating block logic here + program_path=runtime_vars["full_path"] + file_to_package=portage_utils.getpackagesbyfiles([program_path]) + if program_path not in file_to_package: + print "Failed to find a package for %s" % program_path + else: + depslist=[file_to_package[program_path]]+list( + portage_api.get_deps(file_to_package[program_path],["RDEPEND"])) + runtime_vars["deps_all"]=depslist #pkgs=portage_log_parser.get_list_of_merged_packages( # runtime_vars["starttime"],runtime_vars["endtime"] @@ -379,7 +389,7 @@ for package in sorted(packagesinfo): if options.show_files: continue elif filescounter>options.numfiles: - print " ... and %d more ...\n" % (len(filenames)-10) + print " ... and %d more ...\n" % (len(filenames)-options.numfiles) break # print not founded files with stages -- cgit v1.2.3-65-gdbad