From: "Michał Górny" <mgorny@gentoo.org>
To: gentoo-commits@lists.gentoo.org
Subject: [gentoo-commits] proj/gentoopm:master commit in: gentoopm/paludispm/
Date: Thu, 28 Jul 2011 19:54:46 +0000 (UTC) [thread overview]
Message-ID: <aba8a872b2e4c22ff726409ce6ca01162185cd1c.mgorny@gentoo> (raw)
commit: aba8a872b2e4c22ff726409ce6ca01162185cd1c
Author: Michał Górny <mgorny <AT> gentoo <DOT> org>
AuthorDate: Thu Jul 28 19:55:21 2011 +0000
Commit: Michał Górny <mgorny <AT> gentoo <DOT> org>
CommitDate: Thu Jul 28 19:55:21 2011 +0000
URL: http://git.overlays.gentoo.org/gitweb/?p=proj/gentoopm.git;a=commit;h=aba8a872
Paludis: use helper function for metadata gets.
This should fix issues with empty *DEPEND as well.
---
gentoopm/paludispm/pkg.py | 45 ++++++++++++++++++++++++---------------------
1 files changed, 24 insertions(+), 21 deletions(-)
diff --git a/gentoopm/paludispm/pkg.py b/gentoopm/paludispm/pkg.py
index 151cd92..368344c 100644
--- a/gentoopm/paludispm/pkg.py
+++ b/gentoopm/paludispm/pkg.py
@@ -74,10 +74,16 @@ class PaludisID(PMPackage, PaludisAtom):
def version(self):
return PaludisPackageVersion(self._pkg.version)
+ def _get_meta(self, key):
+ if isinstance(key, str):
+ key = self._pkg.find_metadata(key)
+ if key is None:
+ return ()
+ return key.parse_value()
+
@property
def eapi(self):
- k = self._pkg.find_metadata('EAPI')
- return str(k.parse_value())
+ return str(self._get_meta('EAPI'))
@property
def description(self):
@@ -85,35 +91,30 @@ class PaludisID(PMPackage, PaludisAtom):
@property
def inherits(self):
- k = self._pkg.find_metadata('INHERITED')
- if k is None:
- return SpaceSepFrozenSet(())
- return SpaceSepFrozenSet(k.parse_value())
+ return SpaceSepFrozenSet(self._get_meta('INHERITED'))
@property
def defined_phases(self):
- k = self._pkg.find_metadata('DEFINED_PHASES')
- if k is None:
+ ret = SpaceSepFrozenSet(self._get_meta('DEFINED_PHASES'))
+ if not ret:
return None
- ret = SpaceSepFrozenSet(k.parse_value())
- if ret == ('-',):
+ elif ret == ('-',):
return SpaceSepFrozenSet(())
return ret
@property
def homepages(self):
- spec = self._pkg.homepage_key().parse_value()
+ spec = self._get_meta(self._pkg.homepage_key())
return SpaceSepTuple([str(x) for x in spec])
@property
def keywords(self):
- kws = self._pkg.keywords_key().parse_value()
+ kws = self._get_meta(self._pkg.keywords_key())
return SpaceSepFrozenSet([str(x) for x in kws])
@property
def slot(self):
- k = self._pkg.slot_key()
- return str(k.parse_value())
+ return str(self._get_meta(self._pkg.slot_key()))
@property
def repository(self):
@@ -122,19 +123,19 @@ class PaludisID(PMPackage, PaludisAtom):
@property
def build_dependencies(self):
return PaludisPackageDepSet(
- self._pkg.build_dependencies_key().parse_value(),
+ self._get_meta(self._pkg.build_dependencies_key()),
self)
@property
def run_dependencies(self):
return PaludisPackageDepSet(
- self._pkg.run_dependencies_key().parse_value(),
+ self._get_meta(self._pkg.run_dependencies_key()),
self)
@property
def post_dependencies(self):
return PaludisPackageDepSet(
- self._pkg.post_dependencies_key().parse_value(),
+ self._get_meta(self._pkg.post_dependencies_key()),
self)
@property
@@ -142,12 +143,13 @@ class PaludisID(PMPackage, PaludisAtom):
k = self._pkg.find_metadata('REQUIRED_USE')
if k is None:
return None
- return PaludisPackageDepSet(k.parse_value(), self,
- PMRequiredUseAtom)
+ return PaludisPackageDepSet(
+ self._get_meta('REQUIRED_USE'),
+ self, PMRequiredUseAtom)
@property
def use(self):
- iuse = self._pkg.find_metadata('IUSE').parse_value()
+ iuse = self._get_meta('IUSE')
return SpaceSepFrozenSet([PaludisUseFlag(x) for x in iuse])
@property
@@ -172,7 +174,8 @@ class PaludisInstallableID(PaludisID, PMInstallablePackage):
class PaludisInstalledID(PaludisID, PMInstalledPackage):
@property
def contents(self):
- return PaludisPackageContents(self._pkg.contents_key().parse_value())
+ return PaludisPackageContents(
+ self._get_meta(self._pkg.contents_key()))
class PaludisMetadata(PMPackageMetadata):
def __init__(self, pkg):
next reply other threads:[~2011-07-28 19:54 UTC|newest]
Thread overview: 43+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-07-28 19:54 Michał Górny [this message]
-- strict thread matches above, loose matches on Subject: below --
2013-10-10 13:35 [gentoo-commits] proj/gentoopm:master commit in: gentoopm/paludispm/ Michał Górny
2012-01-03 18:18 Michał Górny
2011-12-09 15:09 Michał Górny
2011-07-29 6:38 Michał Górny
2011-07-28 19:54 Michał Górny
2011-07-28 16:24 Michał Górny
2011-07-25 17:06 Michał Górny
2011-07-23 20:14 Michał Górny
2011-07-23 20:14 Michał Górny
2011-07-23 20:14 Michał Górny
2011-07-23 9:27 Michał Górny
2011-07-22 6:18 Michał Górny
2011-07-21 8:47 Michał Górny
2011-07-21 8:47 Michał Górny
2011-07-21 8:47 Michał Górny
2011-07-21 8:47 Michał Górny
2011-07-21 8:47 Michał Górny
2011-07-21 8:47 Michał Górny
2011-07-16 22:55 Michał Górny
2011-07-16 22:55 Michał Górny
2011-07-16 9:40 Michał Górny
2011-07-16 9:08 Michał Górny
2011-07-16 8:34 Michał Górny
2011-07-15 13:32 Michał Górny
2011-07-15 12:34 Michał Górny
2011-07-15 9:52 Michał Górny
2011-07-15 9:52 Michał Górny
2011-07-15 9:52 Michał Górny
2011-07-14 22:51 Michał Górny
2011-07-14 17:10 Michał Górny
2011-07-14 17:10 Michał Górny
2011-07-14 14:05 Michał Górny
2011-07-14 14:05 Michał Górny
2011-07-10 22:17 Michał Górny
2011-07-10 22:17 Michał Górny
2011-07-09 7:20 Michał Górny
2011-07-08 21:05 Michał Górny
2011-07-08 21:05 Michał Górny
2011-07-08 16:37 Michał Górny
2011-07-08 16:37 Michał Górny
2011-07-08 7:18 Michał Górny
2011-07-06 20:54 Michał Górny
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=aba8a872b2e4c22ff726409ce6ca01162185cd1c.mgorny@gentoo \
--to=mgorny@gentoo.org \
--cc=gentoo-commits@lists.gentoo.org \
--cc=gentoo-dev@lists.gentoo.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox