From: "Michał Górny" <mgorny@gentoo.org>
To: gentoo-commits@lists.gentoo.org
Subject: [gentoo-commits] proj/gentoopm:master commit in: gentoopm/portagepm/
Date: Sun, 10 Jul 2011 22:17:27 +0000 (UTC) [thread overview]
Message-ID: <3e8b0067791e55c4a28c6a0a275e55f0eb7d21a9.mgorny@gentoo> (raw)
commit: 3e8b0067791e55c4a28c6a0a275e55f0eb7d21a9
Author: Michał Górny <mgorny <AT> gentoo <DOT> org>
AuthorDate: Sun Jul 10 21:53:44 2011 +0000
Commit: Michał Górny <mgorny <AT> gentoo <DOT> org>
CommitDate: Sun Jul 10 22:16:51 2011 +0000
URL: http://git.overlays.gentoo.org/gitweb/?p=proj/gentoopm.git;a=commit;h=3e8b0067
Portage: Pass FakeSettings to instantiate atoms without dbapi.
---
gentoopm/portagepm/__init__.py | 2 +-
gentoopm/portagepm/atom.py | 14 ++++++++++++--
2 files changed, 13 insertions(+), 3 deletions(-)
diff --git a/gentoopm/portagepm/__init__.py b/gentoopm/portagepm/__init__.py
index 4b1887a..6bade14 100644
--- a/gentoopm/portagepm/__init__.py
+++ b/gentoopm/portagepm/__init__.py
@@ -32,4 +32,4 @@ class PortagePM(PackageManager):
@property
def Atom(self):
- return functools.partial(PortageAtom, pm = self)
+ return PortageAtom
diff --git a/gentoopm/portagepm/atom.py b/gentoopm/portagepm/atom.py
index 121e3b1..7614298 100644
--- a/gentoopm/portagepm/atom.py
+++ b/gentoopm/portagepm/atom.py
@@ -3,6 +3,8 @@
# (c) 2011 Michał Górny <mgorny@gentoo.org>
# Released under the terms of the 2-clause BSD license.
+import collections
+
import portage.exception as pe
from portage.dbapi.dep_expand import dep_expand
from portage.dep import match_from_list
@@ -11,10 +13,18 @@ from portage.versions import catsplit
from gentoopm.basepm.atom import PMAtom
from gentoopm.exceptions import InvalidAtomStringError
+class FakeSettings(object):
+ """
+ Fake settings object, to satisfy cpv_expand().
+ """
+
+ def __getattr__(self, key):
+ return lambda: collections.defaultdict(lambda: '')
+
class PortageAtom(object):
- def __new__(self, s, pm):
+ def __new__(self, s):
try:
- a = dep_expand(s, settings = pm._portdb.settings)
+ a = dep_expand(s, settings = FakeSettings())
except pe.InvalidAtom:
raise InvalidAtomStringError('Incorrect atom: %s' % s)
next reply other threads:[~2011-07-10 22:17 UTC|newest]
Thread overview: 32+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-07-10 22:17 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-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-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=3e8b0067791e55c4a28c6a0a275e55f0eb7d21a9.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