From e4a903fe8235b14977dfc451492eb70407b94f0b Mon Sep 17 00:00:00 2001 From: Zac Medico Date: Sun, 13 Dec 2009 03:49:09 +0000 Subject: 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. (trunk r15028) svn path=/main/branches/2.1.7/; revision=15062 --- pym/portage/__init__.py | 10 +++++++++- pym/portage/dbapi/porttree.py | 2 +- 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/pym/portage/__init__.py b/pym/portage/__init__.py index 87f5ec108..0a6731bb2 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 -- cgit v1.2.3-1-g7c22