Move portage.cpv_getkey() to the portage.versions module. (trunk r15410)
authorZac Medico <zmedico@gentoo.org>
Tue, 2 Mar 2010 20:47:57 +0000 (20:47 -0000)
committerZac Medico <zmedico@gentoo.org>
Tue, 2 Mar 2010 20:47:57 +0000 (20:47 -0000)
svn path=/main/branches/2.1.7/; revision=15631

pym/portage/__init__.py
pym/portage/versions.py

index 1853aff5fc2a9482f0207988975023c36538d8c4..e9adceba97e4936b02f67fdb7c410a5e6c33203e 100644 (file)
@@ -110,7 +110,8 @@ try:
                        'stack_lists,unique_array,varexpand,writedict,writemsg,' + \
                        'writemsg_stdout,write_atomic',
                'portage.versions',
-               'portage.versions:best,catpkgsplit,catsplit,endversion_keys,' + \
+               'portage.versions:best,catpkgsplit,catsplit,cpv_getkey,' + \
+                       'cpv_getkey@getCPFromCPV,endversion_keys,' + \
                        'suffix_value@endversion,pkgcmp,pkgsplit,vercmp,ververify',
                'portage.xpak',
        )
@@ -8451,27 +8452,6 @@ def dep_wordreduce(mydeplist,mysettings,mydbapi,mode,use_cache=1):
                                        return None
        return deplist
 
-def cpv_getkey(mycpv):
-       """Calls pkgsplit on a cpv and returns only the cp."""
-       mysplit = versions.catpkgsplit(mycpv)
-       if mysplit is not None:
-               return mysplit[0] + '/' + mysplit[1]
-
-       warnings.warn("portage.cpv_getkey() called with invalid cpv: '%s'" \
-               % (mycpv,), DeprecationWarning, stacklevel=2)
-
-       myslash = mycpv.split("/", 1)
-       mysplit = versions._pkgsplit(myslash[-1])
-       if mysplit is None:
-               return None
-       mylen=len(myslash)
-       if mylen==2:
-               return myslash[0]+"/"+mysplit[0]
-       else:
-               return mysplit[0]
-
-getCPFromCPV = cpv_getkey
-
 def cpv_expand(mycpv, mydb=None, use_cache=1, settings=None):
        """Given a string (packagename or virtual) expand it into a valid
        cat/package string. Virtuals use the mydb to determine which provided
index 5ab3aaeb5a1e7446ecf718acee3eb4d744c6a86f..c8159741b778c6d49e04045fb0df65ffb0fd227e 100644 (file)
@@ -3,7 +3,14 @@
 # Distributed under the terms of the GNU General Public License v2
 # $Id$
 
+__all__ = [
+       'best', 'catpkgsplit', 'catsplit',
+       'cpv_getkey', 'pkgcmp',  'pkgsplit',
+       'ververify', 'vercmp'
+]
+
 import re
+import warnings
 
 
 # \w is [a-zA-Z0-9_]
@@ -309,6 +316,26 @@ def pkgsplit(mypkg, silent=1):
        else:
                return (cat + '/' + pn, ver, rev)
 
+def cpv_getkey(mycpv):
+       """Calls catpkgsplit on a cpv and returns only the cp."""
+       mysplit = catpkgsplit(mycpv)
+       if mysplit is not None:
+               return mysplit[0] + '/' + mysplit[1]
+
+       warnings.warn("portage.versions.cpv_getkey() " + \
+               "called with invalid cpv: '%s'" % (mycpv,),
+               DeprecationWarning, stacklevel=2)
+
+       myslash = mycpv.split("/", 1)
+       mysplit = _pkgsplit(myslash[-1])
+       if mysplit is None:
+               return None
+       mylen = len(myslash)
+       if mylen == 2:
+               return myslash[0] + "/" + mysplit[0]
+       else:
+               return mysplit[0]
+
 def catsplit(mydep):
         return mydep.split("/", 1)