From: "Zac Medico" <zmedico@gentoo.org>
To: gentoo-commits@lists.gentoo.org
Subject: [gentoo-commits] proj/portage:master commit in: pym/portage/dep/, pym/portage/tests/dep/
Date: Sun, 13 May 2012 20:11:03 +0000 (UTC) [thread overview]
Message-ID: <1336939852.e8b6b0c64b081d919398a1afcb3cb97852c77a29.zmedico@gentoo> (raw)
commit: e8b6b0c64b081d919398a1afcb3cb97852c77a29
Author: Zac Medico <zmedico <AT> gentoo <DOT> org>
AuthorDate: Sun May 13 20:10:52 2012 +0000
Commit: Zac Medico <zmedico <AT> gentoo <DOT> org>
CommitDate: Sun May 13 20:10:52 2012 +0000
URL: http://git.overlays.gentoo.org/gitweb/?p=proj/portage.git;a=commit;h=e8b6b0c6
cpvequal: use _pkg_str
---
pym/portage/dep/__init__.py | 27 +++++++++++++++++++--------
pym/portage/tests/dep/testStandalone.py | 5 +++--
2 files changed, 22 insertions(+), 10 deletions(-)
diff --git a/pym/portage/dep/__init__.py b/pym/portage/dep/__init__.py
index 31ec75c..0c92857 100644
--- a/pym/portage/dep/__init__.py
+++ b/pym/portage/dep/__init__.py
@@ -76,16 +76,27 @@ def cpvequal(cpv1, cpv2):
"""
- split1 = catpkgsplit(cpv1)
- split2 = catpkgsplit(cpv2)
-
- if not split1 or not split2:
+ try:
+ try:
+ split1 = cpv1.cpv_split
+ except AttributeError:
+ cpv1 = _pkg_str(cpv1)
+ split1 = cpv1.cpv_split
+
+ try:
+ split2 = cpv2.cpv_split
+ except AttributeError:
+ cpv2 = _pkg_str(cpv2)
+ split2 = cpv2.cpv_split
+
+ except InvalidData:
raise portage.exception.PortageException(_("Invalid data '%s, %s', parameter was not a CPV") % (cpv1, cpv2))
-
- if split1[0] != split2[0]:
+
+ if split1[0] != split2[0] or \
+ split1[1] != split2[1]:
return False
-
- return (pkgcmp(split1[1:], split2[1:]) == 0)
+
+ return vercmp(cpv1.version, cpv2.version) == 0
def strip_empty(myarr):
"""
diff --git a/pym/portage/tests/dep/testStandalone.py b/pym/portage/tests/dep/testStandalone.py
index e9f01df..f03f2d5 100644
--- a/pym/portage/tests/dep/testStandalone.py
+++ b/pym/portage/tests/dep/testStandalone.py
@@ -1,4 +1,4 @@
-# Copyright 2010 Gentoo Foundation
+# Copyright 2010-2012 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
from portage.tests import TestCase
@@ -29,7 +29,8 @@ class TestStandalone(TestCase):
)
for cpv1, cpv2, expected_result in test_cases:
- self.assertEqual(cpvequal(cpv1, cpv2), expected_result)
+ self.assertEqual(cpvequal(cpv1, cpv2), expected_result,
+ "cpvequal('%s', '%s') != %s" % (cpv1, cpv2, expected_result))
for cpv1, cpv2 in test_cases_xfail:
self.assertRaisesMsg("cpvequal("+cpv1+", "+cpv2+")", \
next reply other threads:[~2012-05-13 20:11 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-05-13 20:11 Zac Medico [this message]
-- strict thread matches above, loose matches on Subject: below --
2015-09-21 20:15 [gentoo-commits] proj/portage:master commit in: pym/portage/dep/, pym/portage/tests/dep/ Zac Medico
2013-06-09 0:23 Zac Medico
2013-05-24 18:02 Zac Medico
2013-01-04 4:35 Zac Medico
2012-09-18 20:17 Zac Medico
2012-07-18 21:07 Zac Medico
2011-10-04 4:45 Zac Medico
2011-06-09 18:48 Zac Medico
2011-06-09 14:24 Zac Medico
2011-02-07 22:00 Zac Medico
2011-02-05 0:16 Zac Medico
2011-02-04 22:32 Zac Medico
2011-02-04 21:07 zmedico
2011-02-04 5:42 zmedico
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=1336939852.e8b6b0c64b081d919398a1afcb3cb97852c77a29.zmedico@gentoo \
--to=zmedico@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