Gentoo Archives: gentoo-commits

From: "Zac Medico (zmedico)" <zmedico@g.o>
To: gentoo-commits@l.g.o
Subject: [gentoo-commits] portage r15410 - main/trunk/pym/portage
Date: Sat, 20 Feb 2010 09:28:06
Message-Id: E1Nild5-0007Pm-N6@stork.gentoo.org
1 Author: zmedico
2 Date: 2010-02-20 09:28:03 +0000 (Sat, 20 Feb 2010)
3 New Revision: 15410
4
5 Modified:
6 main/trunk/pym/portage/__init__.py
7 main/trunk/pym/portage/versions.py
8 Log:
9 Move portage.cpv_getkey() to the portage.versions module.
10
11
12 Modified: main/trunk/pym/portage/__init__.py
13 ===================================================================
14 --- main/trunk/pym/portage/__init__.py 2010-02-20 07:24:44 UTC (rev 15409)
15 +++ main/trunk/pym/portage/__init__.py 2010-02-20 09:28:03 UTC (rev 15410)
16 @@ -110,7 +110,8 @@
17 'stack_lists,unique_array,varexpand,writedict,writemsg,' + \
18 'writemsg_stdout,write_atomic',
19 'portage.versions',
20 - 'portage.versions:best,catpkgsplit,catsplit,endversion_keys,' + \
21 + 'portage.versions:best,catpkgsplit,catsplit,cpv_getkey,' + \
22 + 'cpv_getkey@getCPFromCPV,endversion_keys,' + \
23 'suffix_value@endversion,pkgcmp,pkgsplit,vercmp,ververify',
24 'portage.xpak',
25 )
26 @@ -8454,27 +8455,6 @@
27 return None
28 return deplist
29
30 -def cpv_getkey(mycpv):
31 - """Calls pkgsplit on a cpv and returns only the cp."""
32 - mysplit = versions.catpkgsplit(mycpv)
33 - if mysplit is not None:
34 - return mysplit[0] + '/' + mysplit[1]
35 -
36 - warnings.warn("portage.cpv_getkey() called with invalid cpv: '%s'" \
37 - % (mycpv,), DeprecationWarning, stacklevel=2)
38 -
39 - myslash = mycpv.split("/", 1)
40 - mysplit = versions._pkgsplit(myslash[-1])
41 - if mysplit is None:
42 - return None
43 - mylen=len(myslash)
44 - if mylen==2:
45 - return myslash[0]+"/"+mysplit[0]
46 - else:
47 - return mysplit[0]
48 -
49 -getCPFromCPV = cpv_getkey
50 -
51 def cpv_expand(mycpv, mydb=None, use_cache=1, settings=None):
52 """Given a string (packagename or virtual) expand it into a valid
53 cat/package string. Virtuals use the mydb to determine which provided
54
55 Modified: main/trunk/pym/portage/versions.py
56 ===================================================================
57 --- main/trunk/pym/portage/versions.py 2010-02-20 07:24:44 UTC (rev 15409)
58 +++ main/trunk/pym/portage/versions.py 2010-02-20 09:28:03 UTC (rev 15410)
59 @@ -3,7 +3,14 @@
60 # Distributed under the terms of the GNU General Public License v2
61 # $Id$
62
63 +__all__ = [
64 + 'best', 'catpkgsplit', 'catsplit',
65 + 'cpv_getkey', 'pkgcmp', 'pkgsplit',
66 + 'ververify', 'vercmp'
67 +]
68 +
69 import re
70 +import warnings
71
72
73 # \w is [a-zA-Z0-9_]
74 @@ -309,6 +316,26 @@
75 else:
76 return (cat + '/' + pn, ver, rev)
77
78 +def cpv_getkey(mycpv):
79 + """Calls catpkgsplit on a cpv and returns only the cp."""
80 + mysplit = catpkgsplit(mycpv)
81 + if mysplit is not None:
82 + return mysplit[0] + '/' + mysplit[1]
83 +
84 + warnings.warn("portage.versions.cpv_getkey() " + \
85 + "called with invalid cpv: '%s'" % (mycpv,),
86 + DeprecationWarning, stacklevel=2)
87 +
88 + myslash = mycpv.split("/", 1)
89 + mysplit = _pkgsplit(myslash[-1])
90 + if mysplit is None:
91 + return None
92 + mylen = len(myslash)
93 + if mylen == 2:
94 + return myslash[0] + "/" + mysplit[0]
95 + else:
96 + return mysplit[0]
97 +
98 def catsplit(mydep):
99 return mydep.split("/", 1)