summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorZac Medico <zmedico@gentoo.org>2009-12-11 03:04:49 +0000
committerZac Medico <zmedico@gentoo.org>2009-12-11 03:04:49 +0000
commite2fb4da17aaf2d1c2ee3587374136e63e43daa8f (patch)
tree68bfb5c71751d991924c7312a0db8fd39f13eca6
parent75ea9fecaee81c0e37211272a19a857724294ad8 (diff)
downloadportage-e2fb4da17aaf2d1c2ee3587374136e63e43daa8f.tar.gz
portage-e2fb4da17aaf2d1c2ee3587374136e63e43daa8f.tar.bz2
portage-e2fb4da17aaf2d1c2ee3587374136e63e43daa8f.zip
Use collections.OrderedDict when available (python-2.7) and fall back to
portage.cache.mappings.OrderedDict for older python. Also, use OrderedDict inside fetch() so that files are fetched in the order that they appear in SRC_URI. svn path=/main/trunk/; revision=15028
-rw-r--r--pym/portage/__init__.py10
-rw-r--r--pym/portage/dbapi/porttree.py2
2 files changed, 10 insertions, 2 deletions
diff --git a/pym/portage/__init__.py b/pym/portage/__init__.py
index d44422cb7..3819bfd32 100644
--- a/pym/portage/__init__.py
+++ b/pym/portage/__init__.py
@@ -71,6 +71,7 @@ try:
import portage.proxy.lazyimport
import portage.proxy as proxy
proxy.lazyimport.lazyimport(globals(),
+ 'portage.cache.mappings:OrderedDict',
'portage.checksum',
'portage.checksum:perform_checksum,perform_md5,prelink_capable',
'portage.cvstree',
@@ -132,6 +133,13 @@ except ImportError as e:
sys.stderr.write(" "+str(e)+"\n\n")
raise
+try:
+ from collections import OrderedDict
+except ImportError:
+ # lazy import is above
+ # from portage.cache.mappings import OrderedDict
+ pass
+
if sys.hexversion >= 0x3000000:
basestring = str
long = int
@@ -4531,7 +4539,7 @@ def fetch(myuris, mysettings, listonly=0, fetchonly=0, locks_in_subdir=".locks",
for myuri in myuris:
file_uri_tuples.append((os.path.basename(myuri), myuri))
- filedict={}
+ filedict = OrderedDict()
primaryuri_indexes={}
primaryuri_dict = {}
thirdpartymirror_uris = {}
diff --git a/pym/portage/dbapi/porttree.py b/pym/portage/dbapi/porttree.py
index df2c65640..825ca821c 100644
--- a/pym/portage/dbapi/porttree.py
+++ b/pym/portage/dbapi/porttree.py
@@ -16,7 +16,6 @@ portage.proxy.lazyimport.lazyimport(globals(),
)
from portage.cache.cache_errors import CacheError
-from portage.cache.mappings import OrderedDict
from portage.const import REPO_NAME_LOC
from portage.data import portage_gid, secpass
from portage.dbapi import dbapi
@@ -32,6 +31,7 @@ from portage import os
from portage import _encodings
from portage import _unicode_decode
from portage import _unicode_encode
+from portage import OrderedDict
import os as _os
import codecs