public inbox for gentoo-commits@lists.gentoo.org
 help / color / mirror / Atom feed
* [gentoo-commits] proj/gentoopm:master commit in: gentoopm/
@ 2011-09-09 21:13 Michał Górny
  0 siblings, 0 replies; 39+ messages in thread
From: Michał Górny @ 2011-09-09 21:13 UTC (permalink / raw
  To: gentoo-commits

commit:     d0c3996bc480f75c3b6c337f6739db2775a382f4
Author:     Michał Górny <mgorny <AT> gentoo <DOT> org>
AuthorDate: Fri Sep  9 21:04:30 2011 +0000
Commit:     Michał Górny <mgorny <AT> gentoo <DOT> org>
CommitDate: Fri Sep  9 21:04:30 2011 +0000
URL:        http://git.overlays.gentoo.org/gitweb/?p=proj/gentoopm.git;a=commit;h=d0c3996b

Make StringCompat subclass unicode whenever necessary.

---
 gentoopm/util.py |   26 ++++++++++++++++++--------
 1 files changed, 18 insertions(+), 8 deletions(-)

diff --git a/gentoopm/util.py b/gentoopm/util.py
index 7779a82..0da2ff7 100644
--- a/gentoopm/util.py
+++ b/gentoopm/util.py
@@ -68,14 +68,24 @@ class BoolCompat(object):
 	def __nonzero__(self):
 		return self.__bool__()
 
-class StringCompat(str):
-	"""
-	A helper class to create objects inheriting from string. It is basically
-	like subclassing str directly but with a nice C{repr()}.
-	"""
-
-	def __repr__(self):
-		return '%s(%s)' % (self.__class__.__name__, repr(str(self)))
+try:
+	class StringCompat(unicode):
+		"""
+		A helper class to create objects inheriting from string. It is basically
+		like subclassing str directly but with a nice C{repr()}.
+		"""
+
+		def __repr__(self):
+			return '%s(%s)' % (self.__class__.__name__, repr(unicode(self)))
+except NameError:
+	class StringCompat(str):
+		"""
+		A helper class to create objects inheriting from string. It is basically
+		like subclassing str directly but with a nice C{repr()}.
+		"""
+
+		def __repr__(self):
+			return '%s(%s)' % (self.__class__.__name__, repr(str(self)))
 
 class _SpaceSepIter(object):
 	def __getitem__(self, k):



^ permalink raw reply related	[flat|nested] 39+ messages in thread
* [gentoo-commits] proj/gentoopm:master commit in: gentoopm/
@ 2013-08-08 23:02 Michał Górny
  0 siblings, 0 replies; 39+ messages in thread
From: Michał Górny @ 2013-08-08 23:02 UTC (permalink / raw
  To: gentoo-commits

commit:     cefb3ac63209fa1104ef66cbb0740eb2f2d65b60
Author:     Michał Górny <mgorny <AT> gentoo <DOT> org>
AuthorDate: Thu Aug  8 22:49:50 2013 +0000
Commit:     Michał Górny <mgorny <AT> gentoo <DOT> org>
CommitDate: Thu Aug  8 22:49:50 2013 +0000
URL:        http://git.overlays.gentoo.org/gitweb/?p=proj/gentoopm.git;a=commit;h=cefb3ac6

Bump PV to 0.2.9.

---
 gentoopm/__init__.py | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/gentoopm/__init__.py b/gentoopm/__init__.py
index a9529dc..b1a6471 100644
--- a/gentoopm/__init__.py
+++ b/gentoopm/__init__.py
@@ -3,7 +3,7 @@
 # (c) 2011 Michał Górny <mgorny@gentoo.org>
 # Released under the terms of the 2-clause BSD license.
 
-PV = '0.2.8'
+PV = '0.2.9'
 
 """
 The package version.


^ permalink raw reply related	[flat|nested] 39+ messages in thread
* [gentoo-commits] proj/gentoopm:master commit in: gentoopm/
@ 2013-02-16 11:42 Michał Górny
  0 siblings, 0 replies; 39+ messages in thread
From: Michał Górny @ 2013-02-16 11:42 UTC (permalink / raw
  To: gentoo-commits

commit:     b5e6b7a846cf1785b1ceb97dbfa091fe420d23d3
Author:     Michał Górny <mgorny <AT> gentoo <DOT> org>
AuthorDate: Sat Feb 16 11:41:19 2013 +0000
Commit:     Michał Górny <mgorny <AT> gentoo <DOT> org>
CommitDate: Sat Feb 16 11:41:19 2013 +0000
URL:        http://git.overlays.gentoo.org/gitweb/?p=proj/gentoopm.git;a=commit;h=b5e6b7a8

Bump to 0.2.8.

---
 gentoopm/__init__.py |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/gentoopm/__init__.py b/gentoopm/__init__.py
index a09ada8..a9529dc 100644
--- a/gentoopm/__init__.py
+++ b/gentoopm/__init__.py
@@ -3,7 +3,7 @@
 # (c) 2011 Michał Górny <mgorny@gentoo.org>
 # Released under the terms of the 2-clause BSD license.
 
-PV = '0.2.7'
+PV = '0.2.8'
 
 """
 The package version.


^ permalink raw reply related	[flat|nested] 39+ messages in thread
* [gentoo-commits] proj/gentoopm:master commit in: gentoopm/
@ 2012-12-10 21:04 Michał Górny
  0 siblings, 0 replies; 39+ messages in thread
From: Michał Górny @ 2012-12-10 21:04 UTC (permalink / raw
  To: gentoo-commits

commit:     e869e869221dea54ba77381a8441b1dd90a82b25
Author:     Michał Górny <mgorny <AT> gentoo <DOT> org>
AuthorDate: Mon Dec 10 21:03:39 2012 +0000
Commit:     Michał Górny <mgorny <AT> gentoo <DOT> org>
CommitDate: Mon Dec 10 21:03:39 2012 +0000
URL:        http://git.overlays.gentoo.org/gitweb/?p=proj/gentoopm.git;a=commit;h=e869e869

Bump version to 0.2.7.

---
 gentoopm/__init__.py |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/gentoopm/__init__.py b/gentoopm/__init__.py
index 6fef2b6..a09ada8 100644
--- a/gentoopm/__init__.py
+++ b/gentoopm/__init__.py
@@ -3,7 +3,7 @@
 # (c) 2011 Michał Górny <mgorny@gentoo.org>
 # Released under the terms of the 2-clause BSD license.
 
-PV = '0.2.6'
+PV = '0.2.7'
 
 """
 The package version.


^ permalink raw reply related	[flat|nested] 39+ messages in thread
* [gentoo-commits] proj/gentoopm:master commit in: gentoopm/
@ 2012-10-14 21:35 Michał Górny
  0 siblings, 0 replies; 39+ messages in thread
From: Michał Górny @ 2012-10-14 21:35 UTC (permalink / raw
  To: gentoo-commits

commit:     3eae6b2ec7a096a3bad6f497b8bb11704280b03a
Author:     Michał Górny <mgorny <AT> gentoo <DOT> org>
AuthorDate: Sun Oct 14 21:34:55 2012 +0000
Commit:     Michał Górny <mgorny <AT> gentoo <DOT> org>
CommitDate: Sun Oct 14 21:34:55 2012 +0000
URL:        http://git.overlays.gentoo.org/gitweb/?p=proj/gentoopm.git;a=commit;h=3eae6b2e

Bump PV to 0.2.6.

---
 gentoopm/__init__.py |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/gentoopm/__init__.py b/gentoopm/__init__.py
index 30b7dd9..6fef2b6 100644
--- a/gentoopm/__init__.py
+++ b/gentoopm/__init__.py
@@ -3,7 +3,7 @@
 # (c) 2011 Michał Górny <mgorny@gentoo.org>
 # Released under the terms of the 2-clause BSD license.
 
-PV = '0.2.5'
+PV = '0.2.6'
 
 """
 The package version.


^ permalink raw reply related	[flat|nested] 39+ messages in thread
* [gentoo-commits] proj/gentoopm:master commit in: gentoopm/
@ 2012-01-09 16:09 Michał Górny
  0 siblings, 0 replies; 39+ messages in thread
From: Michał Górny @ 2012-01-09 16:09 UTC (permalink / raw
  To: gentoo-commits

commit:     f35c751f4d287be840697c39ccdf72c636d6c023
Author:     Michał Górny <mgorny <AT> gentoo <DOT> org>
AuthorDate: Mon Jan  9 16:09:37 2012 +0000
Commit:     Michał Górny <mgorny <AT> gentoo <DOT> org>
CommitDate: Mon Jan  9 16:09:37 2012 +0000
URL:        http://git.overlays.gentoo.org/gitweb/?p=proj/gentoopm.git;a=commit;h=f35c751f

Bump PV to 0.2.5.

---
 gentoopm/__init__.py |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/gentoopm/__init__.py b/gentoopm/__init__.py
index a67ec65..30b7dd9 100644
--- a/gentoopm/__init__.py
+++ b/gentoopm/__init__.py
@@ -3,7 +3,7 @@
 # (c) 2011 Michał Górny <mgorny@gentoo.org>
 # Released under the terms of the 2-clause BSD license.
 
-PV = '0.2.4'
+PV = '0.2.5'
 
 """
 The package version.



^ permalink raw reply related	[flat|nested] 39+ messages in thread
* [gentoo-commits] proj/gentoopm:master commit in: gentoopm/
@ 2011-12-24 10:36 Michał Górny
  0 siblings, 0 replies; 39+ messages in thread
From: Michał Górny @ 2011-12-24 10:36 UTC (permalink / raw
  To: gentoo-commits

commit:     a6bb6da05efcecc914cab2172f2d5c2adfb086de
Author:     Michał Górny <mgorny <AT> gentoo <DOT> org>
AuthorDate: Sat Dec 24 10:33:33 2011 +0000
Commit:     Michał Górny <mgorny <AT> gentoo <DOT> org>
CommitDate: Sat Dec 24 10:33:33 2011 +0000
URL:        http://git.overlays.gentoo.org/gitweb/?p=proj/gentoopm.git;a=commit;h=a6bb6da0

Bump PV to 0.2.4.

---
 gentoopm/__init__.py |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/gentoopm/__init__.py b/gentoopm/__init__.py
index a5a1ff9..a67ec65 100644
--- a/gentoopm/__init__.py
+++ b/gentoopm/__init__.py
@@ -3,7 +3,7 @@
 # (c) 2011 Michał Górny <mgorny@gentoo.org>
 # Released under the terms of the 2-clause BSD license.
 
-PV = '0.2.3'
+PV = '0.2.4'
 
 """
 The package version.



^ permalink raw reply related	[flat|nested] 39+ messages in thread
* [gentoo-commits] proj/gentoopm:master commit in: gentoopm/
@ 2011-11-15 18:58 Michał Górny
  0 siblings, 0 replies; 39+ messages in thread
From: Michał Górny @ 2011-11-15 18:58 UTC (permalink / raw
  To: gentoo-commits

commit:     07b58f0eff2e8db6e0b3ed50cc62f4f102910bac
Author:     Michał Górny <mgorny <AT> gentoo <DOT> org>
AuthorDate: Tue Nov 15 18:57:24 2011 +0000
Commit:     Michał Górny <mgorny <AT> gentoo <DOT> org>
CommitDate: Tue Nov 15 18:57:24 2011 +0000
URL:        http://git.overlays.gentoo.org/gitweb/?p=proj/gentoopm.git;a=commit;h=07b58f0e

Bump PV to 0.2.3.

---
 gentoopm/__init__.py |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/gentoopm/__init__.py b/gentoopm/__init__.py
index 66662bc..a5a1ff9 100644
--- a/gentoopm/__init__.py
+++ b/gentoopm/__init__.py
@@ -3,7 +3,7 @@
 # (c) 2011 Michał Górny <mgorny@gentoo.org>
 # Released under the terms of the 2-clause BSD license.
 
-PV = '0.2.2'
+PV = '0.2.3'
 
 """
 The package version.



^ permalink raw reply related	[flat|nested] 39+ messages in thread
* [gentoo-commits] proj/gentoopm:master commit in: gentoopm/
@ 2011-11-14 21:44 Michał Górny
  0 siblings, 0 replies; 39+ messages in thread
From: Michał Górny @ 2011-11-14 21:44 UTC (permalink / raw
  To: gentoo-commits

commit:     c507fdcb5435ac1e126835c07fc5f2f2e1c60d9d
Author:     Michał Górny <mgorny <AT> gentoo <DOT> org>
AuthorDate: Mon Nov 14 21:41:47 2011 +0000
Commit:     Michał Górny <mgorny <AT> gentoo <DOT> org>
CommitDate: Mon Nov 14 21:41:47 2011 +0000
URL:        http://git.overlays.gentoo.org/gitweb/?p=proj/gentoopm.git;a=commit;h=c507fdcb

Bump PV to 0.2.2.

---
 gentoopm/__init__.py |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/gentoopm/__init__.py b/gentoopm/__init__.py
index f9047ac..66662bc 100644
--- a/gentoopm/__init__.py
+++ b/gentoopm/__init__.py
@@ -3,7 +3,7 @@
 # (c) 2011 Michał Górny <mgorny@gentoo.org>
 # Released under the terms of the 2-clause BSD license.
 
-PV = '0.2.1'
+PV = '0.2.2'
 
 """
 The package version.



^ permalink raw reply related	[flat|nested] 39+ messages in thread
* [gentoo-commits] proj/gentoopm:master commit in: gentoopm/
@ 2011-08-23 20:39 Michał Górny
  0 siblings, 0 replies; 39+ messages in thread
From: Michał Górny @ 2011-08-23 20:39 UTC (permalink / raw
  To: gentoo-commits

commit:     270c368605f44c4777ac6cb66a6a616e12914708
Author:     Michał Górny <mgorny <AT> gentoo <DOT> org>
AuthorDate: Tue Aug 23 20:40:28 2011 +0000
Commit:     Michał Górny <mgorny <AT> gentoo <DOT> org>
CommitDate: Tue Aug 23 20:40:28 2011 +0000
URL:        http://git.overlays.gentoo.org/gitweb/?p=proj/gentoopm.git;a=commit;h=270c3686

Fix 'repositories' command to output to stdout.

---
 gentoopm/querycli.py |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/gentoopm/querycli.py b/gentoopm/querycli.py
index e5813f4..86f21b4 100644
--- a/gentoopm/querycli.py
+++ b/gentoopm/querycli.py
@@ -88,7 +88,7 @@ class PMQueryCommands(object):
 		Print the list of ebuild repositories.
 		"""
 		def __call__(self, pm, args):
-			return ' '.join([r.name for r in pm.repositories])
+			print(' '.join([r.name for r in pm.repositories]))
 
 	class repo_path(PMQueryCommand):
 		"""



^ permalink raw reply related	[flat|nested] 39+ messages in thread
* [gentoo-commits] proj/gentoopm:master commit in: gentoopm/
@ 2011-08-15 16:00 Michał Górny
  0 siblings, 0 replies; 39+ messages in thread
From: Michał Górny @ 2011-08-15 16:00 UTC (permalink / raw
  To: gentoo-commits

commit:     209f6b07d02c76967d73b6156a4de1c62935fd53
Author:     Michał Górny <mgorny <AT> gentoo <DOT> org>
AuthorDate: Mon Aug 15 15:57:46 2011 +0000
Commit:     Michał Górny <mgorny <AT> gentoo <DOT> org>
CommitDate: Mon Aug 15 15:57:46 2011 +0000
URL:        http://git.overlays.gentoo.org/gitweb/?p=proj/gentoopm.git;a=commit;h=209f6b07

Bump PV to 0.2.1.

---
 gentoopm/__init__.py |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/gentoopm/__init__.py b/gentoopm/__init__.py
index 5034923..f9047ac 100644
--- a/gentoopm/__init__.py
+++ b/gentoopm/__init__.py
@@ -3,7 +3,7 @@
 # (c) 2011 Michał Górny <mgorny@gentoo.org>
 # Released under the terms of the 2-clause BSD license.
 
-PV = '0.2'
+PV = '0.2.1'
 
 """
 The package version.



^ permalink raw reply related	[flat|nested] 39+ messages in thread
* [gentoo-commits] proj/gentoopm:master commit in: gentoopm/
@ 2011-08-15  8:48 Michał Górny
  0 siblings, 0 replies; 39+ messages in thread
From: Michał Górny @ 2011-08-15  8:48 UTC (permalink / raw
  To: gentoo-commits

commit:     7a1fafa956d90fd27a89fb295408548008e442a5
Author:     Michał Górny <mgorny <AT> gentoo <DOT> org>
AuthorDate: Mon Aug 15 08:49:34 2011 +0000
Commit:     Michał Górny <mgorny <AT> gentoo <DOT> org>
CommitDate: Mon Aug 15 08:49:34 2011 +0000
URL:        http://git.overlays.gentoo.org/gitweb/?p=proj/gentoopm.git;a=commit;h=7a1fafa9

Drop StringCompat2.

---
 gentoopm/util.py |   44 --------------------------------------------
 1 files changed, 0 insertions(+), 44 deletions(-)

diff --git a/gentoopm/util.py b/gentoopm/util.py
index ddd9cc1..7779a82 100644
--- a/gentoopm/util.py
+++ b/gentoopm/util.py
@@ -77,50 +77,6 @@ class StringCompat(str):
 	def __repr__(self):
 		return '%s(%s)' % (self.__class__.__name__, repr(str(self)))
 
-class StringCompat2(StringifiedComparisons):
-	"""
-	A helper class providing objects with compatibility string functions,
-	working on stringified form of objects. In other words, it lets you use
-	objects like strings.
-	"""
-
-	def __hasattr__(self, k):
-		return hasattr(str, k)
-
-	def __getattr__(self, k):
-		if not self.__hasattr__(k):
-			raise AttributeError(k)
-		return getattr(str(self), k)
-
-	# other useful special methods
-	def __add__(self, other):
-		return str(self) + other
-
-	def __contains__(self, h):
-		# XXX: might be useful to override this
-		return h in str(self)
-
-	def __format__(self, spec):
-		return format(str(self), spec)
-
-	def __getitem__(self, k):
-		return str(self)[k]
-
-	def __len__(self):
-		return len(str(self))
-
-	def __mul__(self, other):
-		return str(self) * other
-
-	def __rmod__(self, other):
-		return other % str(self)
-
-	def __rmul__(self, other):
-		return other * str(self)
-
-	def __repr__(self):
-		return '%s(%s)' % (self.__class__.__name__, repr(str(self)))
-
 class _SpaceSepIter(object):
 	def __getitem__(self, k):
 		if isinstance(k, str):



^ permalink raw reply related	[flat|nested] 39+ messages in thread
* [gentoo-commits] proj/gentoopm:master commit in: gentoopm/
@ 2011-08-13 18:49 Michał Górny
  0 siblings, 0 replies; 39+ messages in thread
From: Michał Górny @ 2011-08-13 18:49 UTC (permalink / raw
  To: gentoo-commits

commit:     f19e496ff27b9591d4591fa9ace8645a1b91d9e8
Author:     Michał Górny <mgorny <AT> gentoo <DOT> org>
AuthorDate: Sat Aug 13 18:29:56 2011 +0000
Commit:     Michał Górny <mgorny <AT> gentoo <DOT> org>
CommitDate: Sat Aug 13 18:29:56 2011 +0000
URL:        http://git.overlays.gentoo.org/gitweb/?p=proj/gentoopm.git;a=commit;h=f19e496f

StringCompat: raise AttributeError when accessing invalid str attrs.

StringCompat's __getattr__() may be called because of a random
AttributeError. Thus, we should raise AttributeError when user tries to
access an invalid attr. Otherwise, we may end up with an infinite
stringification loop.

---
 gentoopm/util.py |    2 ++
 1 files changed, 2 insertions(+), 0 deletions(-)

diff --git a/gentoopm/util.py b/gentoopm/util.py
index 32cf156..7f2376b 100644
--- a/gentoopm/util.py
+++ b/gentoopm/util.py
@@ -79,6 +79,8 @@ class StringCompat(StringifiedComparisons):
 		return hasattr(str, k)
 
 	def __getattr__(self, k):
+		if not self.__hasattr__(k):
+			raise AttributeError(k)
 		return getattr(str(self), k)
 
 	# other useful special methods



^ permalink raw reply related	[flat|nested] 39+ messages in thread
* [gentoo-commits] proj/gentoopm:master commit in: gentoopm/
@ 2011-08-13 18:49 Michał Górny
  0 siblings, 0 replies; 39+ messages in thread
From: Michał Górny @ 2011-08-13 18:49 UTC (permalink / raw
  To: gentoo-commits

commit:     190d6a524180b0e0a6350b816f5f47fa3142f2b8
Author:     Michał Górny <mgorny <AT> gentoo <DOT> org>
AuthorDate: Sat Aug 13 18:49:42 2011 +0000
Commit:     Michał Górny <mgorny <AT> gentoo <DOT> org>
CommitDate: Sat Aug 13 18:49:42 2011 +0000
URL:        http://git.overlays.gentoo.org/gitweb/?p=proj/gentoopm.git;a=commit;h=190d6a52

gentoopmq shell: import filters and matchers as well.

---
 gentoopm/querycli.py |   12 +++++++++++-
 1 files changed, 11 insertions(+), 1 deletions(-)

diff --git a/gentoopm/querycli.py b/gentoopm/querycli.py
index 9c773cf..e5813f4 100644
--- a/gentoopm/querycli.py
+++ b/gentoopm/querycli.py
@@ -112,7 +112,17 @@ class PMQueryCommands(object):
 		Run a Python shell with current PM selected.
 		"""
 		def __call__(self, pm, args):
-			welc = "The %s PM is now available as 'pm' object." % pm.name
+			import gentoopm.filters as f
+			import gentoopm.matchers as m
+
+			our_imports = (
+					('pm', pm),
+					('f', f),
+					('m', m))
+
+			welc = '''The following objects have been imported for you:\n'''
+			welc += '\n'.join(['\t%s: %s' % (key, repr(var))
+					for key, var in our_imports])
 			kwargs = {}
 
 			try:



^ permalink raw reply related	[flat|nested] 39+ messages in thread
* [gentoo-commits] proj/gentoopm:master commit in: gentoopm/
@ 2011-08-13 18:49 Michał Górny
  0 siblings, 0 replies; 39+ messages in thread
From: Michał Górny @ 2011-08-13 18:49 UTC (permalink / raw
  To: gentoo-commits

commit:     f1c01cc80d50428705f09bb238ceb6c006a889dc
Author:     Michał Górny <mgorny <AT> gentoo <DOT> org>
AuthorDate: Sat Aug 13 18:44:46 2011 +0000
Commit:     Michał Górny <mgorny <AT> gentoo <DOT> org>
CommitDate: Sat Aug 13 18:45:00 2011 +0000
URL:        http://git.overlays.gentoo.org/gitweb/?p=proj/gentoopm.git;a=commit;h=f1c01cc8

Support passing multiple values to Contains().

---
 gentoopm/matchers.py |   31 ++++++++++++++++++++++++-------
 1 files changed, 24 insertions(+), 7 deletions(-)

diff --git a/gentoopm/matchers.py b/gentoopm/matchers.py
index 52a005f..c0efe71 100644
--- a/gentoopm/matchers.py
+++ b/gentoopm/matchers.py
@@ -31,14 +31,31 @@ class Contains(PMKeywordMatcher):
 	A keyword attribute matcher checking for list membership.
 	"""
 
-	def __init__(self, elem):
-		self._elem = elem
+	def __init__(self, *elems):
+		"""
+		Instantiate the matcher for arguments. If multiple arguments are passed
+		in, at least one of them must be contained in the value.
+
+		@param elems: elements to match against the value contents
+		@type elems: any
+		"""
+
+		self._simple_matchers = set()
+		self._complex_matchers = []
+		for e in elems:
+			if isinstance(e, str):
+				self._simple_matchers.add(e)
+			else:
+				self._complex_matchers.append(e)
 
 	def __eq__(self, val):
-		if isinstance(self._elem, str):
-			return self._elem in val
-		else:
+		for n in self._simple_matchers:
+			if n in val:
+				return True
+
+		for n in self._complex_matchers:
 			for e in val:
-				if self._elem == e:
+				if n == e:
 					return True
-			return False
+
+		return False



^ permalink raw reply related	[flat|nested] 39+ messages in thread
* [gentoo-commits] proj/gentoopm:master commit in: gentoopm/
@ 2011-08-13 10:31 Michał Górny
  0 siblings, 0 replies; 39+ messages in thread
From: Michał Górny @ 2011-08-13 10:31 UTC (permalink / raw
  To: gentoo-commits

commit:     7555d27342062177d83b4445083b7bf1e95876da
Author:     Michał Górny <mgorny <AT> gentoo <DOT> org>
AuthorDate: Sat Aug 13 10:30:39 2011 +0000
Commit:     Michał Górny <mgorny <AT> gentoo <DOT> org>
CommitDate: Sat Aug 13 10:30:39 2011 +0000
URL:        http://git.overlays.gentoo.org/gitweb/?p=proj/gentoopm.git;a=commit;h=7555d273

Bump PV to 0.1.6.

---
 gentoopm/__init__.py |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/gentoopm/__init__.py b/gentoopm/__init__.py
index d8aa0ed..3935e07 100644
--- a/gentoopm/__init__.py
+++ b/gentoopm/__init__.py
@@ -3,7 +3,7 @@
 # (c) 2011 Michał Górny <mgorny@gentoo.org>
 # Released under the terms of the 2-clause BSD license.
 
-PV = '0.1.5'
+PV = '0.1.6'
 
 """
 The package version.



^ permalink raw reply related	[flat|nested] 39+ messages in thread
* [gentoo-commits] proj/gentoopm:master commit in: gentoopm/
@ 2011-08-13 10:31 Michał Górny
  0 siblings, 0 replies; 39+ messages in thread
From: Michał Górny @ 2011-08-13 10:31 UTC (permalink / raw
  To: gentoo-commits

commit:     dcbd4501a78d6c4daa64ea037926e092ca65e6fd
Author:     Michał Górny <mgorny <AT> gentoo <DOT> org>
AuthorDate: Sat Aug 13 10:30:23 2011 +0000
Commit:     Michał Górny <mgorny <AT> gentoo <DOT> org>
CommitDate: Sat Aug 13 10:30:23 2011 +0000
URL:        http://git.overlays.gentoo.org/gitweb/?p=proj/gentoopm.git;a=commit;h=dcbd4501

gentoopmq: support --version.

---
 gentoopm/querycli.py |    5 ++++-
 1 files changed, 4 insertions(+), 1 deletions(-)

diff --git a/gentoopm/querycli.py b/gentoopm/querycli.py
index af4f6c0..9c773cf 100644
--- a/gentoopm/querycli.py
+++ b/gentoopm/querycli.py
@@ -6,7 +6,7 @@
 import argparse, os.path
 from abc import abstractmethod
 
-from . import get_package_manager
+from . import PV, get_package_manager
 from .util import ABCObject
 
 def _reponame(val):
@@ -145,6 +145,9 @@ class PMQueryCLI(object):
 	def __init__(self):
 		self.argparser = arg = argparse.ArgumentParser()
 
+		arg.add_argument('-V', '--version',
+			action='version', version='%s %s' % (arg.prog, PV))
+
 		subp = arg.add_subparsers(title = 'Sub-commands')
 		for cmd_name, cmd_help, cmd_class in PMQueryCommands():
 			p = subp.add_parser(cmd_name, help=cmd_help)



^ permalink raw reply related	[flat|nested] 39+ messages in thread
* [gentoo-commits] proj/gentoopm:master commit in: gentoopm/
@ 2011-08-13 10:31 Michał Górny
  0 siblings, 0 replies; 39+ messages in thread
From: Michał Górny @ 2011-08-13 10:31 UTC (permalink / raw
  To: gentoo-commits

commit:     b9ea056a18ecb79f15d8accb9c7baedac4ed1235
Author:     Michał Górny <mgorny <AT> gentoo <DOT> org>
AuthorDate: Sat Aug 13 10:26:57 2011 +0000
Commit:     Michał Górny <mgorny <AT> gentoo <DOT> org>
CommitDate: Sat Aug 13 10:26:57 2011 +0000
URL:        http://git.overlays.gentoo.org/gitweb/?p=proj/gentoopm.git;a=commit;h=b9ea056a

gentoopmq: support pritning PM version.

---
 gentoopm/querycli.py |   11 ++++++++++-
 1 files changed, 10 insertions(+), 1 deletions(-)

diff --git a/gentoopm/querycli.py b/gentoopm/querycli.py
index 2aa3460..af4f6c0 100644
--- a/gentoopm/querycli.py
+++ b/gentoopm/querycli.py
@@ -71,8 +71,17 @@ class PMQueryCommands(object):
 		"""
 		Get the name of a working, preferred PM.
 		"""
+		def __init__(self, argparser):
+			PMQueryCommand.__init__(self, argparser)
+			argparser.add_argument('-v', '--with-version',
+				action='store_true', dest='version',
+				help='Print the version as well')
+
 		def __call__(self, pm, args):
-			print(pm.name)
+			if args.version:
+				print('%s %s' % (pm.name, pm.version))
+			else:
+				print(pm.name)
 
 	class repositories(PMQueryCommand):
 		"""



^ permalink raw reply related	[flat|nested] 39+ messages in thread
* [gentoo-commits] proj/gentoopm:master commit in: gentoopm/
@ 2011-08-12 21:10 Michał Górny
  0 siblings, 0 replies; 39+ messages in thread
From: Michał Górny @ 2011-08-12 21:10 UTC (permalink / raw
  To: gentoo-commits

commit:     2a1903df166026e0c72d88e5e1dde6d0d19a66da
Author:     Michał Górny <mgorny <AT> gentoo <DOT> org>
AuthorDate: Fri Aug 12 21:09:30 2011 +0000
Commit:     Michał Górny <mgorny <AT> gentoo <DOT> org>
CommitDate: Fri Aug 12 21:09:30 2011 +0000
URL:        http://git.overlays.gentoo.org/gitweb/?p=proj/gentoopm.git;a=commit;h=2a1903df

Bump PV to 0.1.5.

---
 gentoopm/__init__.py |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/gentoopm/__init__.py b/gentoopm/__init__.py
index 5211ecb..d8aa0ed 100644
--- a/gentoopm/__init__.py
+++ b/gentoopm/__init__.py
@@ -3,7 +3,7 @@
 # (c) 2011 Michał Górny <mgorny@gentoo.org>
 # Released under the terms of the 2-clause BSD license.
 
-PV = '0.1.4'
+PV = '0.1.5'
 
 """
 The package version.



^ permalink raw reply related	[flat|nested] 39+ messages in thread
* [gentoo-commits] proj/gentoopm:master commit in: gentoopm/
@ 2011-08-12 20:07 Michał Górny
  0 siblings, 0 replies; 39+ messages in thread
From: Michał Górny @ 2011-08-12 20:07 UTC (permalink / raw
  To: gentoo-commits

commit:     40bbcf283f9d968b815c1f539e546c1cdfa98a40
Author:     Michał Górny <mgorny <AT> gentoo <DOT> org>
AuthorDate: Fri Aug 12 19:56:59 2011 +0000
Commit:     Michał Górny <mgorny <AT> gentoo <DOT> org>
CommitDate: Fri Aug 12 20:03:25 2011 +0000
URL:        http://git.overlays.gentoo.org/gitweb/?p=proj/gentoopm.git;a=commit;h=40bbcf28

Add two keyword matchers for kwargs.

---
 gentoopm/matchers.py |   44 ++++++++++++++++++++++++++++++++++++++++++++
 1 files changed, 44 insertions(+), 0 deletions(-)

diff --git a/gentoopm/matchers.py b/gentoopm/matchers.py
new file mode 100644
index 0000000..c3401b1
--- /dev/null
+++ b/gentoopm/matchers.py
@@ -0,0 +1,44 @@
+#!/usr/bin/python
+#	vim:fileencoding=utf-8
+# (c) 2011 Michał Górny <mgorny@gentoo.org>
+# Released under the terms of the 2-clause BSD license.
+
+from .basepm.filter import PMKeywordMatcher
+
+import re
+
+class RegExp(PMKeywordMatcher):
+	"""
+	A keyword attribute matcher using a regular expression.
+	"""
+
+	def __init__(self, regexp):
+		"""
+		Instantiate the regexp matcher.
+
+		@param re: a regular expression to match values against
+		@type re: string/compiled regexp
+		"""
+		if not hasattr(regexp, 'match'):
+			regexp = re.compile(regexp)
+		self._re = regexp
+
+	def __eq__(self, val):
+		return bool(self._re.match(str(val)))
+
+class Contains(PMKeywordMatcher):
+	"""
+	A keyword attribute matcher checking for list membership.
+	"""
+
+	def __init__(self, elem):
+		self._elem = elem
+
+	def __eq__(self, val):
+		if isinstance(self._elem, str):
+			return self._elem in val
+		else:
+			for e in val:
+				if self._elem == e:
+					return True
+			return False



^ permalink raw reply related	[flat|nested] 39+ messages in thread
* [gentoo-commits] proj/gentoopm:master commit in: gentoopm/
@ 2011-08-12  9:28 Michał Górny
  0 siblings, 0 replies; 39+ messages in thread
From: Michał Górny @ 2011-08-12  9:28 UTC (permalink / raw
  To: gentoo-commits

commit:     880f8708f79223d87de97bed983eb25f69b44610
Author:     Michał Górny <mgorny <AT> gentoo <DOT> org>
AuthorDate: Fri Aug 12 09:10:29 2011 +0000
Commit:     Michał Górny <mgorny <AT> gentoo <DOT> org>
CommitDate: Fri Aug 12 09:10:29 2011 +0000
URL:        http://git.overlays.gentoo.org/gitweb/?p=proj/gentoopm.git;a=commit;h=880f8708

Oops, remove debug.

---
 gentoopm/querycli.py |    2 --
 1 files changed, 0 insertions(+), 2 deletions(-)

diff --git a/gentoopm/querycli.py b/gentoopm/querycli.py
index 16909e0..ceeb771 100644
--- a/gentoopm/querycli.py
+++ b/gentoopm/querycli.py
@@ -108,11 +108,9 @@ class PMQueryCommands(object):
 
 			try:
 				from IPython import embed
-				raise ImportError
 			except ImportError:
 				try:
 					from IPython.Shell import IPShellEmbed
-					raise ImportError
 				except ImportError:
 					print('For better user experience, install IPython.')
 					from code import InteractiveConsole



^ permalink raw reply related	[flat|nested] 39+ messages in thread
* [gentoo-commits] proj/gentoopm:master commit in: gentoopm/
@ 2011-08-12  8:53 Michał Górny
  0 siblings, 0 replies; 39+ messages in thread
From: Michał Górny @ 2011-08-12  8:53 UTC (permalink / raw
  To: gentoo-commits

commit:     48089976d08152f09bcb49c90b02d80ec66d7616
Author:     Michał Górny <mgorny <AT> gentoo <DOT> org>
AuthorDate: Fri Aug 12 08:54:47 2011 +0000
Commit:     Michał Górny <mgorny <AT> gentoo <DOT> org>
CommitDate: Fri Aug 12 08:54:47 2011 +0000
URL:        http://git.overlays.gentoo.org/gitweb/?p=proj/gentoopm.git;a=commit;h=48089976

Support fallback to standard Python console.

---
 gentoopm/querycli.py |    8 ++++++--
 1 files changed, 6 insertions(+), 2 deletions(-)

diff --git a/gentoopm/querycli.py b/gentoopm/querycli.py
index c2ab2f0..16909e0 100644
--- a/gentoopm/querycli.py
+++ b/gentoopm/querycli.py
@@ -108,12 +108,16 @@ class PMQueryCommands(object):
 
 			try:
 				from IPython import embed
+				raise ImportError
 			except ImportError:
 				try:
 					from IPython.Shell import IPShellEmbed
+					raise ImportError
 				except ImportError:
-					self._arg.error('IPython required for shell')
-					return 1
+					print('For better user experience, install IPython.')
+					from code import InteractiveConsole
+					embed = InteractiveConsole({'pm': pm}).interact
+					kwargs['banner'] = welc
 				else:
 					embed = IPShellEmbed()
 					embed.set_banner(embed.IP.BANNER + '\n\n' + welc)



^ permalink raw reply related	[flat|nested] 39+ messages in thread
* [gentoo-commits] proj/gentoopm:master commit in: gentoopm/
@ 2011-08-12  8:24 Michał Górny
  0 siblings, 0 replies; 39+ messages in thread
From: Michał Górny @ 2011-08-12  8:24 UTC (permalink / raw
  To: gentoo-commits

commit:     3d7f366544288fdcad55a81256c2dad2819cdeb1
Author:     Michał Górny <mgorny <AT> gentoo <DOT> org>
AuthorDate: Fri Aug 12 08:24:48 2011 +0000
Commit:     Michał Górny <mgorny <AT> gentoo <DOT> org>
CommitDate: Fri Aug 12 08:24:48 2011 +0000
URL:        http://git.overlays.gentoo.org/gitweb/?p=proj/gentoopm.git;a=commit;h=3d7f3665

Support old IPython API as well.

---
 gentoopm/querycli.py |   20 +++++++++++++++-----
 1 files changed, 15 insertions(+), 5 deletions(-)

diff --git a/gentoopm/querycli.py b/gentoopm/querycli.py
index be58106..c2ab2f0 100644
--- a/gentoopm/querycli.py
+++ b/gentoopm/querycli.py
@@ -103,14 +103,24 @@ class PMQueryCommands(object):
 		Run a Python shell with current PM selected.
 		"""
 		def __call__(self, pm, args):
+			welc = "The %s PM is now available as 'pm' object." % pm.name
+			kwargs = {}
+
 			try:
 				from IPython import embed
 			except ImportError:
-				self._arg.error('IPython >= 0.11 required for shell')
-				return 1
-
-			welc = "The %s PM is now available as 'pm' object." % pm.name
-			embed(banner2 = welc)
+				try:
+					from IPython.Shell import IPShellEmbed
+				except ImportError:
+					self._arg.error('IPython required for shell')
+					return 1
+				else:
+					embed = IPShellEmbed()
+					embed.set_banner(embed.IP.BANNER + '\n\n' + welc)
+			else:
+				kwargs['banner2'] = welc
+
+			embed(**kwargs)
 
 	def __iter__(self):
 		for k in dir(self):



^ permalink raw reply related	[flat|nested] 39+ messages in thread
* [gentoo-commits] proj/gentoopm:master commit in: gentoopm/
@ 2011-08-12  8:24 Michał Górny
  0 siblings, 0 replies; 39+ messages in thread
From: Michał Górny @ 2011-08-12  8:24 UTC (permalink / raw
  To: gentoo-commits

commit:     09de4ec5e718cb87ee40915898613fb4bfdd21d2
Author:     Michał Górny <mgorny <AT> gentoo <DOT> org>
AuthorDate: Fri Aug 12 07:59:31 2011 +0000
Commit:     Michał Górny <mgorny <AT> gentoo <DOT> org>
CommitDate: Fri Aug 12 07:59:31 2011 +0000
URL:        http://git.overlays.gentoo.org/gitweb/?p=proj/gentoopm.git;a=commit;h=09de4ec5

Support running an IPython shell.

---
 gentoopm/querycli.py |   14 ++++++++++++++
 1 files changed, 14 insertions(+), 0 deletions(-)

diff --git a/gentoopm/querycli.py b/gentoopm/querycli.py
index b69d231..be58106 100644
--- a/gentoopm/querycli.py
+++ b/gentoopm/querycli.py
@@ -98,6 +98,20 @@ class PMQueryCommands(object):
 				return 1
 			print(r.path)
 
+	class shell(PMQueryCommand):
+		"""
+		Run a Python shell with current PM selected.
+		"""
+		def __call__(self, pm, args):
+			try:
+				from IPython import embed
+			except ImportError:
+				self._arg.error('IPython >= 0.11 required for shell')
+				return 1
+
+			welc = "The %s PM is now available as 'pm' object." % pm.name
+			embed(banner2 = welc)
+
 	def __iter__(self):
 		for k in dir(self):
 			if k.startswith('_'):



^ permalink raw reply related	[flat|nested] 39+ messages in thread
* [gentoo-commits] proj/gentoopm:master commit in: gentoopm/
@ 2011-08-12  7:28 Michał Górny
  0 siblings, 0 replies; 39+ messages in thread
From: Michał Górny @ 2011-08-12  7:28 UTC (permalink / raw
  To: gentoo-commits

commit:     c1d4ba47ad9907795f23837fce34ef68e9cb1034
Author:     Michał Górny <mgorny <AT> gentoo <DOT> org>
AuthorDate: Tue Aug  2 16:31:12 2011 +0000
Commit:     Michał Górny <mgorny <AT> gentoo <DOT> org>
CommitDate: Tue Aug  2 16:31:12 2011 +0000
URL:        http://git.overlays.gentoo.org/gitweb/?p=proj/gentoopm.git;a=commit;h=c1d4ba47

Bump PV to 0.1.4.

---
 gentoopm/__init__.py |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/gentoopm/__init__.py b/gentoopm/__init__.py
index d77d47a..8ac40a0 100644
--- a/gentoopm/__init__.py
+++ b/gentoopm/__init__.py
@@ -3,7 +3,7 @@
 # (c) 2011 Michał Górny <mgorny@gentoo.org>
 # Released under the terms of the 2-clause BSD license.
 
-PV = '0.1.3'
+PV = '0.1.4'
 
 """
 The package version.



^ permalink raw reply related	[flat|nested] 39+ messages in thread
* [gentoo-commits] proj/gentoopm:master commit in: gentoopm/
@ 2011-07-29  6:18 Michał Górny
  0 siblings, 0 replies; 39+ messages in thread
From: Michał Górny @ 2011-07-29  6:18 UTC (permalink / raw
  To: gentoo-commits

commit:     3777bae98ef47c8416426dfc5a3c60b013fceaa9
Author:     Michał Górny <mgorny <AT> gentoo <DOT> org>
AuthorDate: Fri Jul 29 06:18:45 2011 +0000
Commit:     Michał Górny <mgorny <AT> gentoo <DOT> org>
CommitDate: Fri Jul 29 06:18:45 2011 +0000
URL:        http://git.overlays.gentoo.org/gitweb/?p=proj/gentoopm.git;a=commit;h=3777bae9

Fix SpaceSepFrozenSet[].

---
 gentoopm/util.py |    6 +++++-
 1 files changed, 5 insertions(+), 1 deletions(-)

diff --git a/gentoopm/util.py b/gentoopm/util.py
index 168c7ac..32cf156 100644
--- a/gentoopm/util.py
+++ b/gentoopm/util.py
@@ -113,7 +113,11 @@ class StringCompat(StringifiedComparisons):
 class _SpaceSepIter(object):
 	def __getitem__(self, k):
 		if isinstance(k, str):
-			return self[self.index(k)]
+			for i in self:
+				if i == k:
+					return i
+			else:
+				raise KeyError('No item matches %s' % repr(k))
 		return tuple.__getitem__(self, k)
 
 	def __str__(self):



^ permalink raw reply related	[flat|nested] 39+ messages in thread
* [gentoo-commits] proj/gentoopm:master commit in: gentoopm/
@ 2011-07-27  8:26 Michał Górny
  0 siblings, 0 replies; 39+ messages in thread
From: Michał Górny @ 2011-07-27  8:26 UTC (permalink / raw
  To: gentoo-commits

commit:     f6fc5c0432450ae6d30c347b3da4d34d2f88c9f0
Author:     Michał Górny <mgorny <AT> gentoo <DOT> org>
AuthorDate: Wed Jul 27 07:44:19 2011 +0000
Commit:     Michał Górny <mgorny <AT> gentoo <DOT> org>
CommitDate: Wed Jul 27 07:44:19 2011 +0000
URL:        http://git.overlays.gentoo.org/gitweb/?p=proj/gentoopm.git;a=commit;h=f6fc5c04

SpaceSepTuple: support getting items by text.

---
 gentoopm/util.py |    5 +++++
 1 files changed, 5 insertions(+), 0 deletions(-)

diff --git a/gentoopm/util.py b/gentoopm/util.py
index f80d4a5..961c7d9 100644
--- a/gentoopm/util.py
+++ b/gentoopm/util.py
@@ -120,6 +120,11 @@ class SpaceSepTuple(tuple):
 			s = s.split()
 		return tuple.__new__(self, s)
 
+	def __getitem__(self, k):
+		if isinstance(k, str):
+			return self[self.index(k)]
+		return tuple.__getitem__(self, k)
+
 	def __str__(self):
 		return ' '.join(self)
 



^ permalink raw reply related	[flat|nested] 39+ messages in thread
* [gentoo-commits] proj/gentoopm:master commit in: gentoopm/
@ 2011-07-23  9:27 Michał Górny
  0 siblings, 0 replies; 39+ messages in thread
From: Michał Górny @ 2011-07-23  9:27 UTC (permalink / raw
  To: gentoo-commits

commit:     0c98a495f9b0f7ba5bf4abe0814e4c31ff5d9ad4
Author:     Michał Górny <mgorny <AT> gentoo <DOT> org>
AuthorDate: Sat Jul 23 08:59:22 2011 +0000
Commit:     Michał Górny <mgorny <AT> gentoo <DOT> org>
CommitDate: Sat Jul 23 08:59:22 2011 +0000
URL:        http://git.overlays.gentoo.org/gitweb/?p=proj/gentoopm.git;a=commit;h=0c98a495

StringCompat: support repr() by default.

---
 gentoopm/util.py |    3 +++
 1 files changed, 3 insertions(+), 0 deletions(-)

diff --git a/gentoopm/util.py b/gentoopm/util.py
index 3005d36..f80d4a5 100644
--- a/gentoopm/util.py
+++ b/gentoopm/util.py
@@ -107,6 +107,9 @@ class StringCompat(StringifiedComparisons):
 	def __rmul__(self, other):
 		return other * str(self)
 
+	def __repr__(self):
+		return '%s(%s)' % (self.__class__.__name__, repr(str(self)))
+
 class SpaceSepTuple(tuple):
 	"""
 	A tuple subclass representing a space-separated list.



^ permalink raw reply related	[flat|nested] 39+ messages in thread
* [gentoo-commits] proj/gentoopm:master commit in: gentoopm/
@ 2011-07-22 13:16 Michał Górny
  0 siblings, 0 replies; 39+ messages in thread
From: Michał Górny @ 2011-07-22 13:16 UTC (permalink / raw
  To: gentoo-commits

commit:     f24d64e65d11b8e974c372c863a29344d0cce885
Author:     Michał Górny <mgorny <AT> gentoo <DOT> org>
AuthorDate: Fri Jul 22 13:15:53 2011 +0000
Commit:     Michał Górny <mgorny <AT> gentoo <DOT> org>
CommitDate: Fri Jul 22 13:15:53 2011 +0000
URL:        http://git.overlays.gentoo.org/gitweb/?p=proj/gentoopm.git;a=commit;h=f24d64e6

Bump PV to 0.1.3.

---
 gentoopm/__init__.py |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/gentoopm/__init__.py b/gentoopm/__init__.py
index 4d47ae8..d77d47a 100644
--- a/gentoopm/__init__.py
+++ b/gentoopm/__init__.py
@@ -3,7 +3,7 @@
 # (c) 2011 Michał Górny <mgorny@gentoo.org>
 # Released under the terms of the 2-clause BSD license.
 
-PV = '0.1.2'
+PV = '0.1.3'
 
 """
 The package version.



^ permalink raw reply related	[flat|nested] 39+ messages in thread
* [gentoo-commits] proj/gentoopm:master commit in: gentoopm/
@ 2011-07-21 23:00 Michał Górny
  0 siblings, 0 replies; 39+ messages in thread
From: Michał Górny @ 2011-07-21 23:00 UTC (permalink / raw
  To: gentoo-commits

commit:     00f6b6888a61cee94ac7b30baa9a93f106c29585
Author:     Michał Górny <mgorny <AT> gentoo <DOT> org>
AuthorDate: Thu Jul 21 21:54:40 2011 +0000
Commit:     Michał Górny <mgorny <AT> gentoo <DOT> org>
CommitDate: Thu Jul 21 21:54:40 2011 +0000
URL:        http://git.overlays.gentoo.org/gitweb/?p=proj/gentoopm.git;a=commit;h=00f6b688

Don't use special __ne__ in StringifiedComparisons.

---
 gentoopm/util.py |   21 +++++++++------------
 1 files changed, 9 insertions(+), 12 deletions(-)

diff --git a/gentoopm/util.py b/gentoopm/util.py
index 0475812..17a8d81 100644
--- a/gentoopm/util.py
+++ b/gentoopm/util.py
@@ -22,7 +22,15 @@ class ABCObject(object):
 	__metaclass__ = ABCMeta
 ''')
 
-class StringifiedComparisons(object):
+class FillMissingNotEqual(object):
+	"""
+	A base class filling '!=' using '=='.
+	"""
+
+	def __ne__(self, other):
+		return not self == other
+
+class StringifiedComparisons(FillMissingNotEqual):
 	"""
 	A base class with '==', '!=' and hashing methods set to use the object
 	stringification.
@@ -34,17 +42,6 @@ class StringifiedComparisons(object):
 	def __eq__(self, other):
 		return str(self) == str(other)
 
-	def __ne__(self, other):
-		return str(self) != str(other)
-
-class FillMissingNotEqual(object):
-	"""
-	A base class filling '!=' using '=='.
-	"""
-
-	def __ne__(self, other):
-		return not self == other
-
 class FillMissingComparisons(FillMissingNotEqual):
 	"""
 	A base class filling '!=', '>', '<=' and '>=' comparators with '<' and



^ permalink raw reply related	[flat|nested] 39+ messages in thread
* [gentoo-commits] proj/gentoopm:master commit in: gentoopm/
@ 2011-07-21 23:00 Michał Górny
  0 siblings, 0 replies; 39+ messages in thread
From: Michał Górny @ 2011-07-21 23:00 UTC (permalink / raw
  To: gentoo-commits

commit:     f0f2e6f93fe8951cb788147cffefd303b9f65a0f
Author:     Michał Górny <mgorny <AT> gentoo <DOT> org>
AuthorDate: Thu Jul 21 21:18:44 2011 +0000
Commit:     Michał Górny <mgorny <AT> gentoo <DOT> org>
CommitDate: Thu Jul 21 21:18:44 2011 +0000
URL:        http://git.overlays.gentoo.org/gitweb/?p=proj/gentoopm.git;a=commit;h=f0f2e6f9

Drop deprecated __getslice__ from StringCompat.

---
 gentoopm/util.py |    3 ---
 1 files changed, 0 insertions(+), 3 deletions(-)

diff --git a/gentoopm/util.py b/gentoopm/util.py
index 4212764..0475812 100644
--- a/gentoopm/util.py
+++ b/gentoopm/util.py
@@ -97,9 +97,6 @@ class StringCompat(StringifiedComparisons):
 	def __getitem__(self, k):
 		return str(self)[k]
 
-	def __getslice__(self, a, b):
-		return str(self)[a:b]
-
 	def __len__(self):
 		return len(str(self))
 



^ permalink raw reply related	[flat|nested] 39+ messages in thread
* [gentoo-commits] proj/gentoopm:master commit in: gentoopm/
@ 2011-07-21 23:00 Michał Górny
  0 siblings, 0 replies; 39+ messages in thread
From: Michał Górny @ 2011-07-21 23:00 UTC (permalink / raw
  To: gentoo-commits

commit:     337953535fecf3ea86579537415bb598e6df2388
Author:     Michał Górny <mgorny <AT> gentoo <DOT> org>
AuthorDate: Thu Jul 21 22:24:41 2011 +0000
Commit:     Michał Górny <mgorny <AT> gentoo <DOT> org>
CommitDate: Thu Jul 21 22:24:41 2011 +0000
URL:        http://git.overlays.gentoo.org/gitweb/?p=proj/gentoopm.git;a=commit;h=33795353

Add an EnumTuple type.

---
 gentoopm/util.py |   35 +++++++++++++++++++++++++++++++++++
 1 files changed, 35 insertions(+), 0 deletions(-)

diff --git a/gentoopm/util.py b/gentoopm/util.py
index 17a8d81..3005d36 100644
--- a/gentoopm/util.py
+++ b/gentoopm/util.py
@@ -7,6 +7,7 @@
 Utility functions for gentoopm.
 """
 
+import collections
 from abc import ABCMeta
 
 try:
@@ -118,3 +119,37 @@ class SpaceSepTuple(tuple):
 
 	def __str__(self):
 		return ' '.join(self)
+
+def EnumTuple(name, *keys):
+	"""
+	Create a namedtuple factory for an enumerated type. The resulting factory
+	function shall be called with keyword argument with names resembling
+	enumerated value names and values evaluating to True or False.
+
+	>>> MyTestEnum = EnumTuple('MyTestEnum', 'bad', 'good')
+	>>> i = 4
+	>>> MyTestEnum(bad = i <= 3, good = i > 3)
+	MyTestEnum(bad=False, good=True)
+
+	@param name: name of the resulting namedtuple
+	@type name: string
+	@param keys: list of enumerated values
+	@type keys: strings
+	@return: Factory function creating namedtuples.
+	@rtype: func(**kwargs)
+	"""
+
+	def _check_args(kwargs):
+		res = False
+		for a in kwargs.values():
+			if not isinstance(a, bool):
+				raise ValueError('Non-bool passed to EnumTuple')
+			if a and res:
+				raise ValueError('More than a single True passed to EnumTuple')
+			res |= a
+		if not res:
+			raise ValueError('All values passed to EnumTuple are False')
+		return kwargs
+
+	nt = collections.namedtuple(name, keys)
+	return lambda **kwargs: nt(**_check_args(kwargs))



^ permalink raw reply related	[flat|nested] 39+ messages in thread
* [gentoo-commits] proj/gentoopm:master commit in: gentoopm/
@ 2011-07-20 18:30 Michał Górny
  0 siblings, 0 replies; 39+ messages in thread
From: Michał Górny @ 2011-07-20 18:30 UTC (permalink / raw
  To: gentoo-commits

commit:     15155786054b54e96d8c571ad28d2a696a503b68
Author:     Michał Górny <mgorny <AT> gentoo <DOT> org>
AuthorDate: Wed Jul 20 18:31:01 2011 +0000
Commit:     Michał Górny <mgorny <AT> gentoo <DOT> org>
CommitDate: Wed Jul 20 18:31:01 2011 +0000
URL:        http://git.overlays.gentoo.org/gitweb/?p=proj/gentoopm.git;a=commit;h=15155786

Drop unnecessary import.

---
 gentoopm/util.py |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/gentoopm/util.py b/gentoopm/util.py
index 9522a0b..4212764 100644
--- a/gentoopm/util.py
+++ b/gentoopm/util.py
@@ -7,7 +7,7 @@
 Utility functions for gentoopm.
 """
 
-from abc import ABCMeta, abstractmethod
+from abc import ABCMeta
 
 try:
 	exec('''



^ permalink raw reply related	[flat|nested] 39+ messages in thread
* [gentoo-commits] proj/gentoopm:master commit in: gentoopm/
@ 2011-07-19 12:07 Michał Górny
  0 siblings, 0 replies; 39+ messages in thread
From: Michał Górny @ 2011-07-19 12:07 UTC (permalink / raw
  To: gentoo-commits

commit:     19300f0c5f60565ef89f17106c06236bddd380f0
Author:     Michał Górny <mgorny <AT> gentoo <DOT> org>
AuthorDate: Tue Jul 19 12:08:03 2011 +0000
Commit:     Michał Górny <mgorny <AT> gentoo <DOT> org>
CommitDate: Tue Jul 19 12:08:03 2011 +0000
URL:        http://git.overlays.gentoo.org/gitweb/?p=proj/gentoopm.git;a=commit;h=19300f0c

Add __bool__() to StringWrapper.

---
 gentoopm/util.py |    6 ++++++
 1 files changed, 6 insertions(+), 0 deletions(-)

diff --git a/gentoopm/util.py b/gentoopm/util.py
index 76938d8..0329606 100644
--- a/gentoopm/util.py
+++ b/gentoopm/util.py
@@ -49,6 +49,12 @@ class StringWrapper(object):
 	def __str__(self):
 		return str(self._s)
 
+	def __bool__(self):
+		return bool(str(self))
+
+	def __nonzero__(self):
+		return self.__bool__(self)
+
 	def __repr__(self):
 		return '(%s)' % repr(str(self))
 



^ permalink raw reply related	[flat|nested] 39+ messages in thread
* [gentoo-commits] proj/gentoopm:master commit in: gentoopm/
@ 2011-07-17 22:19 Michał Górny
  0 siblings, 0 replies; 39+ messages in thread
From: Michał Górny @ 2011-07-17 22:19 UTC (permalink / raw
  To: gentoo-commits

commit:     db2944499752316174cba18338fa7f9fa363505d
Author:     Michał Górny <mgorny <AT> gentoo <DOT> org>
AuthorDate: Sun Jul 17 22:12:06 2011 +0000
Commit:     Michał Górny <mgorny <AT> gentoo <DOT> org>
CommitDate: Sun Jul 17 22:20:08 2011 +0000
URL:        http://git.overlays.gentoo.org/gitweb/?p=proj/gentoopm.git;a=commit;h=db294449

Bump PV to 0.1.2 bugfix.

---
 gentoopm/__init__.py |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/gentoopm/__init__.py b/gentoopm/__init__.py
index 5cb96d2..4d47ae8 100644
--- a/gentoopm/__init__.py
+++ b/gentoopm/__init__.py
@@ -3,7 +3,7 @@
 # (c) 2011 Michał Górny <mgorny@gentoo.org>
 # Released under the terms of the 2-clause BSD license.
 
-PV = '0.1.1'
+PV = '0.1.2'
 
 """
 The package version.



^ permalink raw reply related	[flat|nested] 39+ messages in thread
* [gentoo-commits] proj/gentoopm:master commit in: gentoopm/
@ 2011-07-17 13:58 Michał Górny
  0 siblings, 0 replies; 39+ messages in thread
From: Michał Górny @ 2011-07-17 13:58 UTC (permalink / raw
  To: gentoo-commits

commit:     42e7151af2a24c4aab5a57d3dc41d64fbf26814f
Author:     Michał Górny <mgorny <AT> gentoo <DOT> org>
AuthorDate: Sun Jul 17 13:57:21 2011 +0000
Commit:     Michał Górny <mgorny <AT> gentoo <DOT> org>
CommitDate: Sun Jul 17 13:57:21 2011 +0000
URL:        http://git.overlays.gentoo.org/gitweb/?p=proj/gentoopm.git;a=commit;h=42e7151a

Bump PV to 0.1.1.

---
 gentoopm/__init__.py |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/gentoopm/__init__.py b/gentoopm/__init__.py
index 103a28e..5cb96d2 100644
--- a/gentoopm/__init__.py
+++ b/gentoopm/__init__.py
@@ -3,7 +3,7 @@
 # (c) 2011 Michał Górny <mgorny@gentoo.org>
 # Released under the terms of the 2-clause BSD license.
 
-PV = '0.1'
+PV = '0.1.1'
 
 """
 The package version.



^ permalink raw reply related	[flat|nested] 39+ messages in thread
* [gentoo-commits] proj/gentoopm:master commit in: gentoopm/
@ 2011-07-10 12:34 Michał Górny
  0 siblings, 0 replies; 39+ messages in thread
From: Michał Górny @ 2011-07-10 12:34 UTC (permalink / raw
  To: gentoo-commits

commit:     74f67a9208c9e28ea8cbe1d4531f6f9019d9d140
Author:     Michał Górny <mgorny <AT> gentoo <DOT> org>
AuthorDate: Sun Jul 10 11:23:06 2011 +0000
Commit:     Michał Górny <mgorny <AT> gentoo <DOT> org>
CommitDate: Sun Jul 10 11:23:06 2011 +0000
URL:        http://git.overlays.gentoo.org/gitweb/?p=proj/gentoopm.git;a=commit;h=74f67a92

Drop IterDictWrapper.

No longer used.

---
 gentoopm/util.py |   17 -----------------
 1 files changed, 0 insertions(+), 17 deletions(-)

diff --git a/gentoopm/util.py b/gentoopm/util.py
index 052c78b..70cd287 100644
--- a/gentoopm/util.py
+++ b/gentoopm/util.py
@@ -21,20 +21,3 @@ class ABCObject(object):
 	""" A portably-defined object with ABCMeta metaclass. """
 	__metaclass__ = ABCMeta
 ''')
-
-class IterDictWrapper(object):
-	"""
-	A wrapper to a class providing an iterator & dict interface.
-	"""
-
-	def __init__(self, subobj):
-		"""
-		Instantiate the IterDictWrapper with subobj instance.
-		"""
-		self._subobj = subobj
-
-	def __iter__(self):
-		return iter(self._subobj)
-
-	def __getitem__(self, k):
-		return self._subobj[k]



^ permalink raw reply related	[flat|nested] 39+ messages in thread
* [gentoo-commits] proj/gentoopm:master commit in: gentoopm/
@ 2011-07-10 12:34 Michał Górny
  0 siblings, 0 replies; 39+ messages in thread
From: Michał Górny @ 2011-07-10 12:34 UTC (permalink / raw
  To: gentoo-commits

commit:     23dd108ddb00cdbe228118b32e195294f7e79d96
Author:     Michał Górny <mgorny <AT> gentoo <DOT> org>
AuthorDate: Sun Jul 10 11:23:52 2011 +0000
Commit:     Michał Górny <mgorny <AT> gentoo <DOT> org>
CommitDate: Sun Jul 10 11:23:52 2011 +0000
URL:        http://git.overlays.gentoo.org/gitweb/?p=proj/gentoopm.git;a=commit;h=23dd108d

Make some of core vars private.

---
 gentoopm/querycli.py   |    4 ++--
 gentoopm/submodules.py |    4 ++--
 2 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/gentoopm/querycli.py b/gentoopm/querycli.py
index e1ea091..acf1214 100644
--- a/gentoopm/querycli.py
+++ b/gentoopm/querycli.py
@@ -9,7 +9,7 @@ from abc import abstractmethod
 from gentoopm import get_package_manager
 from gentoopm.util import ABCObject
 
-def reponame(val):
+def _reponame(val):
 	"""
 	Check the value for correctness as repository name. In fact, it only ensures
 	it isn't a path so that it won't confuse pm.repositories[val].
@@ -87,7 +87,7 @@ class PMQueryCommands(object):
 		"""
 		def __init__(self, argparser):
 			PMQueryCommand.__init__(self, argparser)
-			argparser.add_argument('repo_name', type=reponame,
+			argparser.add_argument('repo_name', type=_reponame,
 				help='The repository name to look up')
 
 		def __call__(self, pm, args):

diff --git a/gentoopm/submodules.py b/gentoopm/submodules.py
index 82945bf..95840e4 100644
--- a/gentoopm/submodules.py
+++ b/gentoopm/submodules.py
@@ -3,7 +3,7 @@
 # (c) 2011 Michał Górny <mgorny@gentoo.org>
 # Released under the terms of the 2-clause BSD license.
 
-supported_pms = {
+_supported_pms = {
 	'paludis': ('gentoopm.paludispm', 'PaludisPM'),
 	'pkgcore': ('gentoopm.pkgcorepm', 'PkgCorePM'),
 	'portage': ('gentoopm.portagepm', 'PortagePM')
@@ -22,7 +22,7 @@ def get_pm(pm_name):
 	@raise NameError: PM class is not available
 	"""
 
-	modname, clsname = supported_pms[pm_name]
+	modname, clsname = _supported_pms[pm_name]
 	mod = __import__(modname, fromlist=[clsname], level=-1)
 	return getattr(mod, clsname)()
 



^ permalink raw reply related	[flat|nested] 39+ messages in thread
* [gentoo-commits] proj/gentoopm:master commit in: gentoopm/
@ 2011-07-10 12:34 Michał Górny
  0 siblings, 0 replies; 39+ messages in thread
From: Michał Górny @ 2011-07-10 12:34 UTC (permalink / raw
  To: gentoo-commits

commit:     53efdd7a7b7317b8baa1d86cdbad55f1a303d488
Author:     Michał Górny <mgorny <AT> gentoo <DOT> org>
AuthorDate: Sun Jul 10 11:22:44 2011 +0000
Commit:     Michał Górny <mgorny <AT> gentoo <DOT> org>
CommitDate: Sun Jul 10 11:22:44 2011 +0000
URL:        http://git.overlays.gentoo.org/gitweb/?p=proj/gentoopm.git;a=commit;h=53efdd7a

Re-doc core code.

---
 gentoopm/__init__.py    |   13 +++++++++++--
 gentoopm/preferences.py |    3 +++
 gentoopm/querycli.py    |   18 ++++++++++++++++++
 gentoopm/submodules.py  |   26 ++++++++++++++++----------
 4 files changed, 48 insertions(+), 12 deletions(-)

diff --git a/gentoopm/__init__.py b/gentoopm/__init__.py
index f05d6ec..8fc5b3f 100644
--- a/gentoopm/__init__.py
+++ b/gentoopm/__init__.py
@@ -5,11 +5,20 @@
 
 PV = '0'
 
+"""
+The package version.
+
+@type: string
+"""
+
 def get_package_manager():
 	"""
 	Get the PackageManager instance for the best package manager available.
-	Takes user preferences into consideration. Raises an exception if no PM
-	could be found.
+	Takes user preferences into consideration.
+
+	@return: Best package manager instance available
+	@rtype: L{PackageManager}
+	@raise Exception: No package manager could be imported.
 	"""
 
 	from gentoopm.preferences import get_preferred_pms

diff --git a/gentoopm/preferences.py b/gentoopm/preferences.py
index c33f744..7141c6d 100644
--- a/gentoopm/preferences.py
+++ b/gentoopm/preferences.py
@@ -13,6 +13,9 @@ def get_preferred_pms():
 	"""
 	Find out what are the user's PM preferences and return the preferred PM
 	names as an iterable, with the most preferred one coming first.
+
+	@return: Preferred PMs, in order
+	@rtype: iterable(string)
 	"""
 
 	ret = []

diff --git a/gentoopm/querycli.py b/gentoopm/querycli.py
index 9267c4e..e1ea091 100644
--- a/gentoopm/querycli.py
+++ b/gentoopm/querycli.py
@@ -13,6 +13,11 @@ def reponame(val):
 	"""
 	Check the value for correctness as repository name. In fact, it only ensures
 	it isn't a path so that it won't confuse pm.repositories[val].
+
+	@param val: the config option value
+	@type val: string
+	@return: whether the value is a correct repo name
+	@rtype: bool
 	"""
 	if os.path.isabs(val):
 		raise ValueError('Invalid repository name: %s' % val)
@@ -25,6 +30,9 @@ class PMQueryCommand(ABCObject):
 	def help(self):
 		"""
 		Return the help string for a sub-command.
+
+		@return: the help string
+		@rtype: string
 		"""
 		descdoc = ' '.join(self.__doc__.split())
 		descdoc = descdoc[0].lower() + descdoc[1:]
@@ -33,6 +41,9 @@ class PMQueryCommand(ABCObject):
 	def __init__(self, argparser):
 		"""
 		Instantiate the subcommand, setting argument parser as necessary.
+
+		@param argparser: sub-command argument parser
+		@type argparser: C{argparse.ArgumentParser}
 		"""
 		argparser.set_defaults(instance = self)
 		self._arg = argparser
@@ -43,6 +54,13 @@ class PMQueryCommand(ABCObject):
 		Call the sub-command, passing pm (a working PackageManager instance)
 		and args (the result of argument parsing). Can return exit code
 		for the process if relevant. If it doesn't, 0 will be used.
+
+		@param pm: package manager instance
+		@type pm: L{PackageManager}
+		@param args: command arguments
+		@type args: C{argparse.Namespace}
+		@return: Process exit code or None if irrelevant
+		@rtype: bool/None
 		"""
 		pass
 

diff --git a/gentoopm/submodules.py b/gentoopm/submodules.py
index 7659361..82945bf 100644
--- a/gentoopm/submodules.py
+++ b/gentoopm/submodules.py
@@ -11,14 +11,15 @@ supported_pms = {
 
 def get_pm(pm_name):
 	"""
-	Get the PackageManager instance for a particularly named PM. Either returns
-	a PackageManager subclass instance or raises one of the following
-	exceptions:
-
-	- KeyError if pm_name doesn't refer to a supported PM,
-	- ImportError if modules required for a particular PM are not available,
-	- NameError if for some reason required class isn't provided by the module
-		(consider this an internal error).
+	Get the PackageManager instance for a particularly named PM.
+
+	@param pm_name: name of package manager to use
+	@type pm_name: string
+	@return: A package manager instance
+	@rtype: L{PackageManager}
+	@raise KeyError: pm_name doesn't refer to a supported PM
+	@raise ImportError: modules required for the PM are not available
+	@raise NameError: PM class is not available
 	"""
 
 	modname, clsname = supported_pms[pm_name]
@@ -28,8 +29,13 @@ def get_pm(pm_name):
 def get_any_pm(pm_list):
 	"""
 	Get the first working PackageManager from the pm_list. This function will
-	try to import them in order and either return the first succeeding or raise
-	an exception if all of them fail.
+	try to import them in order and return the first succeeding.
+
+	@param pm_list: list of preferred package manager names, in order
+	@type pm_list: iterable(string)
+	@return: Best available package manager instance
+	@rtype: L{PackageManager}
+	@raise Exception: if none of the PMs are available
 	"""
 
 	for pm_name in pm_list:



^ permalink raw reply related	[flat|nested] 39+ messages in thread

end of thread, other threads:[~2013-08-08 23:02 UTC | newest]

Thread overview: 39+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-09-09 21:13 [gentoo-commits] proj/gentoopm:master commit in: gentoopm/ Michał Górny
  -- strict thread matches above, loose matches on Subject: below --
2013-08-08 23:02 Michał Górny
2013-02-16 11:42 Michał Górny
2012-12-10 21:04 Michał Górny
2012-10-14 21:35 Michał Górny
2012-01-09 16:09 Michał Górny
2011-12-24 10:36 Michał Górny
2011-11-15 18:58 Michał Górny
2011-11-14 21:44 Michał Górny
2011-08-23 20:39 Michał Górny
2011-08-15 16:00 Michał Górny
2011-08-15  8:48 Michał Górny
2011-08-13 18:49 Michał Górny
2011-08-13 18:49 Michał Górny
2011-08-13 18:49 Michał Górny
2011-08-13 10:31 Michał Górny
2011-08-13 10:31 Michał Górny
2011-08-13 10:31 Michał Górny
2011-08-12 21:10 Michał Górny
2011-08-12 20:07 Michał Górny
2011-08-12  9:28 Michał Górny
2011-08-12  8:53 Michał Górny
2011-08-12  8:24 Michał Górny
2011-08-12  8:24 Michał Górny
2011-08-12  7:28 Michał Górny
2011-07-29  6:18 Michał Górny
2011-07-27  8:26 Michał Górny
2011-07-23  9:27 Michał Górny
2011-07-22 13:16 Michał Górny
2011-07-21 23:00 Michał Górny
2011-07-21 23:00 Michał Górny
2011-07-21 23:00 Michał Górny
2011-07-20 18:30 Michał Górny
2011-07-19 12:07 Michał Górny
2011-07-17 22:19 Michał Górny
2011-07-17 13:58 Michał Górny
2011-07-10 12:34 Michał Górny
2011-07-10 12:34 Michał Górny
2011-07-10 12:34 Michał Górny

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox