From: "Michał Górny" <mgorny@gentoo.org>
To: gentoo-commits@lists.gentoo.org
Subject: [gentoo-commits] proj/gentoopm:master commit in: gentoopm/portagepm/
Date: Thu, 28 Jul 2011 16:24:00 +0000 (UTC) [thread overview]
Message-ID: <61f625081294e1948bfa23da71ace43f332cd4ce.mgorny@gentoo> (raw)
commit: 61f625081294e1948bfa23da71ace43f332cd4ce
Author: Michał Górny <mgorny <AT> gentoo <DOT> org>
AuthorDate: Thu Jul 28 14:53:28 2011 +0000
Commit: Michał Górny <mgorny <AT> gentoo <DOT> org>
CommitDate: Thu Jul 28 14:53:28 2011 +0000
URL: http://git.overlays.gentoo.org/gitweb/?p=proj/gentoopm.git;a=commit;h=61f62508
Portage: support '^^' in depstrings (using a hack).
---
gentoopm/portagepm/depend.py | 22 ++++++++++++++++++----
gentoopm/portagepm/pkg.py | 5 +++++
2 files changed, 23 insertions(+), 4 deletions(-)
diff --git a/gentoopm/portagepm/depend.py b/gentoopm/portagepm/depend.py
index d4f3c33..f33fd5c 100644
--- a/gentoopm/portagepm/depend.py
+++ b/gentoopm/portagepm/depend.py
@@ -6,7 +6,7 @@
from portage.dep import paren_reduce, use_reduce
from gentoopm.basepm.depend import PMPackageDepSet, PMConditionalDep, \
- PMAnyOfDep, PMAllOfDep, PMBaseDep
+ PMAnyOfDep, PMAllOfDep, PMExactlyOneOfDep, PMBaseDep
from gentoopm.portagepm.atom import PortageAtom
class PortageBaseDep(PMBaseDep):
@@ -21,6 +21,8 @@ class PortageBaseDep(PMBaseDep):
yield PortageAnyOfDep(next(it), self._puse)
elif d == '&&':
yield PortageAllOfDep(next(it), self._puse)
+ elif d == '__xor__?':
+ yield PortageExactlyOneOfDep(next(it), self._puse)
elif d.endswith('?'):
yield PortageConditionalUseDep(next(it),
self._puse, d.rstrip('?'))
@@ -33,6 +35,9 @@ class PortageAnyOfDep(PMAnyOfDep, PortageBaseDep):
class PortageAllOfDep(PMAllOfDep, PortageBaseDep):
pass
+class PortageExactlyOneOfDep(PMExactlyOneOfDep, PortageBaseDep):
+ pass
+
class PortageConditionalUseDep(PMConditionalDep, PortageBaseDep):
def __init__(self, deps, puse, flag):
PortageBaseDep.__init__(self, deps, puse)
@@ -44,7 +49,11 @@ class PortageConditionalUseDep(PMConditionalDep, PortageBaseDep):
class PortagePackageDepSet(PMPackageDepSet, PortageBaseDep):
def __init__(self, s, puse):
- self._depstr = s
+ self._use_reducable = not '^^' in s
+ if not self._use_reducable:
+ # ARGV, paren_reduce() doesn't handle ^^
+ # so we hack it to a __xor__?, UGLY!
+ self._depstr = s.replace('^^', '__xor__?')
PortageBaseDep.__init__(self, None, puse)
def __iter__(self):
@@ -54,8 +63,10 @@ class PortagePackageDepSet(PMPackageDepSet, PortageBaseDep):
@property
def without_conditionals(self):
- return PortageUncondAllOfDep(
- use_reduce(self._depstr, self._puse))
+ if self._use_reducable:
+ return PortageUncondAllOfDep(
+ use_reduce(self._depstr, self._puse))
+ return PMPackageDepSet.without_conditionals.fget(self)
class PortageUncondDep(PortageBaseDep):
def __init__(self, deps):
@@ -80,3 +91,6 @@ class PortageUncondAnyOfDep(PMAnyOfDep, PortageUncondDep):
class PortageUncondAllOfDep(PMAllOfDep, PortageUncondDep):
pass
+
+class PortageUncondExactlyOneOfDep(PMExactlyOneOfDep, PortageUncondDep):
+ pass
diff --git a/gentoopm/portagepm/pkg.py b/gentoopm/portagepm/pkg.py
index ed4c80c..221e728 100644
--- a/gentoopm/portagepm/pkg.py
+++ b/gentoopm/portagepm/pkg.py
@@ -183,6 +183,11 @@ class PortageDBCPV(PMPackage, CompletePortageAtom):
return PortagePackageDepSet(self._aux_get('PDEPEND'),
self._applied_use)
+ @property
+ def required_use(self):
+ return PortagePackageDepSet(self._aux_get('REQUIRED_USE'),
+ self._applied_use)
+
def __str__(self):
return '=%s' % self._cpv
next reply other threads:[~2011-07-28 16:24 UTC|newest]
Thread overview: 32+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-07-28 16:24 Michał Górny [this message]
-- strict thread matches above, loose matches on Subject: below --
2013-02-16 10:13 [gentoo-commits] proj/gentoopm:master commit in: gentoopm/portagepm/ Michał Górny
2013-02-03 19:40 Michał Górny
2012-12-10 17:52 Michał Górny
2011-08-15 7:57 Michał Górny
2011-08-14 14:22 Michał Górny
2011-08-12 7:28 Michał Górny
2011-07-28 16:24 Michał Górny
2011-07-27 16:04 Michał Górny
2011-07-27 8:26 Michał Górny
2011-07-26 17:30 Michał Górny
2011-07-26 17:18 Michał Górny
2011-07-25 17:06 Michał Górny
2011-07-21 8:47 Michał Górny
2011-07-21 8:47 Michał Górny
2011-07-20 9:41 Michał Górny
2011-07-19 20:53 Michał Górny
2011-07-19 20:53 Michał Górny
2011-07-19 20:53 Michał Górny
2011-07-19 20:53 Michał Górny
2011-07-15 13:32 Michał Górny
2011-07-15 12:34 Michał Górny
2011-07-15 8:39 Michał Górny
2011-07-14 14:05 Michał Górny
2011-07-14 13:31 Michał Górny
2011-07-10 22:17 Michał Górny
2011-07-10 22:17 Michał Górny
2011-07-10 22:17 Michał Górny
2011-07-08 7:18 Michał Górny
2011-07-07 9:51 Michał Górny
2011-07-06 20:54 Michał Górny
2011-07-06 16:03 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=61f625081294e1948bfa23da71ace43f332cd4ce.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