From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from pigeon.gentoo.org ([208.92.234.80] helo=lists.gentoo.org) by finch.gentoo.org with esmtp (Exim 4.60) (envelope-from ) id 1M2Axp-0005zr-Q0 for garchives@archives.gentoo.org; Thu, 07 May 2009 21:17:10 +0000 Received: from pigeon.gentoo.org (localhost [127.0.0.1]) by pigeon.gentoo.org (Postfix) with SMTP id 2C848E029E; Thu, 7 May 2009 21:17:09 +0000 (UTC) Received: from smtp.gentoo.org (smtp.gentoo.org [140.211.166.183]) by pigeon.gentoo.org (Postfix) with ESMTP id D919EE029E for ; Thu, 7 May 2009 21:17:08 +0000 (UTC) Received: from stork.gentoo.org (stork.gentoo.org [64.127.104.133]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by smtp.gentoo.org (Postfix) with ESMTP id 9CB0165CA6 for ; Thu, 7 May 2009 21:17:08 +0000 (UTC) Received: from fuzzyray by stork.gentoo.org with local (Exim 4.69) (envelope-from ) id 1M2Axo-00067t-5e for gentoo-commits@lists.gentoo.org; Thu, 07 May 2009 21:17:08 +0000 To: gentoo-commits@lists.gentoo.org From: "Paul Varner (fuzzyray)" Subject: [gentoo-commits] gentoolkit r619 - in trunk/gentoolkit: . pym/gentoolkit/equery X-VCS-Repository: gentoolkit X-VCS-Revision: 619 X-VCS-Files: trunk/gentoolkit/ChangeLog trunk/gentoolkit/pym/gentoolkit/equery/meta.py X-VCS-Directories: . pym/gentoolkit/equery X-VCS-Committer: fuzzyray X-VCS-Committer-Name: Paul Varner Content-Type: text/plain; charset=UTF-8 Message-Id: Sender: Paul Varner Date: Thu, 07 May 2009 21:17:08 +0000 Precedence: bulk List-Post: List-Help: List-Unsubscribe: List-Subscribe: List-Id: Gentoo Linux mail X-BeenThere: gentoo-commits@lists.gentoo.org Content-Transfer-Encoding: quoted-printable X-Archives-Salt: a9ba8514-dace-4869-9aab-f91e4dcd117b X-Archives-Hash: b1eb34d2eb30ece30033650d38968597 Author: fuzzyray Date: 2009-05-07 21:17:07 +0000 (Thu, 07 May 2009) New Revision: 619 Modified: trunk/gentoolkit/ChangeLog trunk/gentoolkit/pym/gentoolkit/equery/meta.py Log: Add patch from djanderson to make meta get and check package dirs in a ma= nner similar to other gentoolkit scripts and fix some docstrings. (Bug 26= 8895) Modified: trunk/gentoolkit/ChangeLog =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D --- trunk/gentoolkit/ChangeLog 2009-05-07 13:46:32 UTC (rev 618) +++ trunk/gentoolkit/ChangeLog 2009-05-07 21:17:07 UTC (rev 619) @@ -1,4 +1,9 @@ -2009-05-09: Paul Varner +2009-05-07: Paul Varner + * equery: Add patch from djanderson to make meta get and check package + dirs in a manner similar to other gentoolkit scripts and fix + some docstrings. (Bug 268895) + +2009-05-05: Paul Varner * equery: Added modular rewrite from djanderson * gentoolkit: Added modular rewrite from djanderson * All: converted to setup.py build system Modified: trunk/gentoolkit/pym/gentoolkit/equery/meta.py =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D --- trunk/gentoolkit/pym/gentoolkit/equery/meta.py 2009-05-07 13:46:32 UT= C (rev 618) +++ trunk/gentoolkit/pym/gentoolkit/equery/meta.py 2009-05-07 21:17:07 UT= C (rev 619) @@ -88,9 +88,26 @@ )) =20 =20 -def call_get_functions(xml_tree, meta, got_opts): - """Call information gathering funtions and display the results.""" +def call_get_functions(metadata_path, package_dir, QUERY_OPTS): + """Call information gathering functions and display the results.""" +=09 + if VERBOSE: + print get_overlay_name(package_dir) =20 + try: + xml_tree =3D ET.parse(metadata_path) + except IOError: + pp.print_error("No metadata available") + first_run =3D False + return + + got_opts =3D False + if (QUERY_OPTS["herd"] or QUERY_OPTS["description"] or + QUERY_OPTS["useflags"] or QUERY_OPTS["maintainer"] or + QUERY_OPTS["upstream"] or QUERY_OPTS["xml"]): + # Specific information requested, less formatting + got_opts =3D True + if QUERY_OPTS["herd"] or not got_opts: herd =3D get_herd(xml_tree) if QUERY_OPTS["herd"]: @@ -275,32 +292,19 @@ return ' '.join(result) =20 =20 -def get_package_directory(queries): +def get_package_directory(query): """Find a package's portage directory.""" =20 - # Find queries' Portage directory and throw error if invalid - if not QUERY_OPTS["current"]: - # We need at least one program name to run - if not queries: - print_help() - sys.exit(2) - else: - package_dir =3D [] - for query in queries: - matches =3D find_packages(query, include_masked=3DTrue) - # Prefer a package that's in the Portage tree over one in an - # overlay. Start with oldest first. - pkg =3D None - while reversed(matches): - pkg =3D matches.pop() - if not pkg.is_overlay(): - break - if pkg: - package_dir.append(pkg.get_package_path()) - else: - package_dir =3D [os.getcwd()] + matches =3D find_packages(query, include_masked=3DTrue) + # Prefer a package that's in the Portage tree over one in an + # overlay. Start with oldest first. + pkg =3D None + while list(reversed(matches)): + pkg =3D matches.pop() + if not pkg.is_overlay(): + break =09 - return package_dir + return pkg.get_package_path() if pkg else None =09 =20 def get_useflags(xml_tree): @@ -334,7 +338,7 @@ =20 =20 def _get_upstream_bugtracker(node): - """WRITE IT""" + """Extract and format upstream bugtracker information.""" =20 bt_loc =3D [e.text for e in node.findall("bugs-to")] =20 @@ -342,7 +346,7 @@ =20 =20 def _get_upstream_changelog(node): - """WRITE IT""" + """Extract and format upstream changelog information.""" =20 cl_paths =3D [e.text for e in node.findall("changelog")] =20 @@ -350,7 +354,7 @@ =20 =20 def _get_upstream_documentation(node): - """WRITE IT""" + """Extract and format upstream documentation information.""" =20 doc =3D [] for elem in node.findall("doc"): @@ -365,7 +369,7 @@ =20 =20 def _get_upstream_maintainer(node): - """WRITE IT""" + """Extract and format upstream maintainer information.""" =20 maintainer =3D node.findall("maintainer") maint =3D [] @@ -386,7 +390,7 @@ =20 =20 def _get_upstream_remoteid(node): - """WRITE IT""" + """Extract and format upstream remote ID.""" =20 r_id =3D [e.get("type") + ": " + e.text for e in node.findall("remote-i= d")] =20 @@ -496,38 +500,30 @@ =20 parse_module_options(module_opts) =09 - package_dir =3D get_package_directory(queries) - if not package_dir: - raise errors.GentoolkitNoMatches(queries) - - metadata_path =3D [os.path.join(d, "metadata.xml") for d in package_dir= ] - - # -------------------------------- - # Check options and call functions - # -------------------------------- - - first_run =3D True - for p_dir, meta in zip(package_dir, metadata_path): - if not first_run: - print - - if VERBOSE: - print get_overlay_name(p_dir) - - try: - xml_tree =3D ET.parse(meta) - except IOError: - pp.print_error("No metadata available") - first_run =3D False - continue - - got_opts =3D False - if (QUERY_OPTS["herd"] or QUERY_OPTS["description"] or - QUERY_OPTS["useflags"] or QUERY_OPTS["maintainer"] or - QUERY_OPTS["upstream"] or QUERY_OPTS["xml"]): - # Specific information requested, less formatting - got_opts =3D True - =09 - call_get_functions(xml_tree, meta, got_opts) - - first_run =3D False + # Find queries' Portage directory and throw error if invalid + if not queries and not QUERY_OPTS["current"]: + print_help() + sys.exit(2) +=09 + if QUERY_OPTS["current"]: + package_dir =3D os.getcwd() + metadata_path =3D os.path.join(package_dir, "metadata.xml") + call_get_functions(metadata_path, package_dir, QUERY_OPTS) + else: + first_run =3D True + for query in queries: + package_dir =3D get_package_directory(query) + if not package_dir: + raise errors.GentoolkitNoMatches(query) + metadata_path =3D os.path.join(package_dir, "metadata.xml") +=09 + # -------------------------------- + # Check options and call functions + # -------------------------------- + =09 + if not first_run: + print + =09 + call_get_functions(metadata_path, package_dir, QUERY_OPTS) +=09 + first_run =3D False \ No newline at end of file