public inbox for gentoo-commits@lists.gentoo.org
 help / color / mirror / Atom feed
From: "Michał Górny" <mgorny@gentoo.org>
To: gentoo-commits@lists.gentoo.org
Subject: [gentoo-commits] proj/gentoopm:master commit in: gentoopm/portagepm/, gentoopm/paludispm/
Date: Sat, 23 Jul 2011 09:27:44 +0000 (UTC)	[thread overview]
Message-ID: <749f517175ff0da8325c8b3d7b8eeab78a1f91ca.mgorny@gentoo> (raw)

commit:     749f517175ff0da8325c8b3d7b8eeab78a1f91ca
Author:     Michał Górny <mgorny <AT> gentoo <DOT> org>
AuthorDate: Sat Jul 23 09:28:36 2011 +0000
Commit:     Michał Górny <mgorny <AT> gentoo <DOT> org>
CommitDate: Sat Jul 23 09:28:36 2011 +0000
URL:        http://git.overlays.gentoo.org/gitweb/?p=proj/gentoopm.git;a=commit;h=749f5171

Reuse key/version comparisons.

---
 gentoopm/paludispm/pkg.py |    4 ++--
 gentoopm/portagepm/pkg.py |    6 ++----
 2 files changed, 4 insertions(+), 6 deletions(-)

diff --git a/gentoopm/paludispm/pkg.py b/gentoopm/paludispm/pkg.py
index 4af56c8..1c3fb6e 100644
--- a/gentoopm/paludispm/pkg.py
+++ b/gentoopm/paludispm/pkg.py
@@ -104,8 +104,8 @@ class PaludisID(PMPackage, PaludisAtom):
 		if not isinstance(other, PaludisID):
 			raise TypeError('Unable to compare %s against %s' % \
 					self, other)
-		return str(self.key) < str(other.key) \
-				or self._pkg.version < other._pkg.version \
+		return self.key < other.key \
+				or self.version < other.version \
 				or self._env.more_important_than( \
 						other.repository, self.repository)
 

diff --git a/gentoopm/portagepm/pkg.py b/gentoopm/portagepm/pkg.py
index 49e4b8e..a26bb45 100644
--- a/gentoopm/portagepm/pkg.py
+++ b/gentoopm/portagepm/pkg.py
@@ -124,8 +124,7 @@ class PortageDBCPV(PMPackage, CompletePortageAtom):
 		if not isinstance(other, PortageDBCPV):
 			raise TypeError('Unable to compare %s against %s' % \
 					(self, other))
-		return cpv_getkey(self._cpv) < cpv_getkey(other._cpv) \
-				or vercmp(cpv_getversion(self._cpv), cpv_getversion(other._cpv)) < 0
+		return self.key < other.key or self.version < other.version
 
 class PortageCPV(PortageDBCPV, PMInstallablePackage):
 	def __init__(self, cpv, dbapi, tree, repo_prio):
@@ -156,8 +155,7 @@ class PortageCPV(PortageDBCPV, PMInstallablePackage):
 		if not isinstance(other, PortageCPV):
 			raise TypeError('Unable to compare %s against %s' % \
 					(self, other))
-		return cpv_getkey(self._cpv) < cpv_getkey(other._cpv) \
-				or vercmp(cpv_getversion(self._cpv), cpv_getversion(other._cpv)) < 0 \
+		return self.key < other.key or self.version < other.version \
 				or self._repo_prio < other._repo_prio
 
 class PortageVDBCPV(PortageDBCPV, PMInstalledPackage):



             reply	other threads:[~2011-07-23  9:28 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-07-23  9:27 Michał Górny [this message]
  -- strict thread matches above, loose matches on Subject: below --
2011-08-13 10:54 [gentoo-commits] proj/gentoopm:master commit in: gentoopm/portagepm/, gentoopm/paludispm/ Michał Górny
2011-08-13  9:17 Michał Górny
2011-07-16 22:55 Michał Górny
2011-07-07 15:55 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=749f517175ff0da8325c8b3d7b8eeab78a1f91ca.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