diff options
author | Jason R. Coombs <jaraco@jaraco.com> | 2014-06-14 12:27:18 -0400 |
---|---|---|
committer | Jason R. Coombs <jaraco@jaraco.com> | 2014-06-14 12:27:18 -0400 |
commit | 2c729473ff7838c9206b792b50bdea123fef2e4c (patch) | |
tree | 70cb787f237df8c028f16571d6d39514791e487e | |
parent | 7b7c55a2353dc5af925174e585bfa3d2200343f0 (diff) | |
download | external_python_setuptools-2c729473ff7838c9206b792b50bdea123fef2e4c.tar.gz external_python_setuptools-2c729473ff7838c9206b792b50bdea123fef2e4c.tar.bz2 external_python_setuptools-2c729473ff7838c9206b792b50bdea123fef2e4c.zip |
Use a namedtuple to avoid numeric indexes
-rw-r--r-- | pkg_resources.py | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/pkg_resources.py b/pkg_resources.py index 1100978a..2151082b 100644 --- a/pkg_resources.py +++ b/pkg_resources.py @@ -29,6 +29,7 @@ import token import symbol import operator import platform +import collections from pkgutil import get_importer try: @@ -1534,6 +1535,7 @@ class ZipManifests(dict): """ Memoized zipfile manifests. """ + manifest_mod = collections.namedtuple('manifest_mod', 'manifest mtime') def load(self, path): """ @@ -1542,10 +1544,11 @@ class ZipManifests(dict): path = os.path.normpath(path) mtime = os.stat(path).st_mtime - if path not in self or self[path][0] != mtime: - self[path] = (mtime, self.build(path)) + if path not in self or self[path].mtime != mtime: + manifest = self.build(path) + self[path] = self.manifest_mod(manifest, mtime) - return self[path][1] + return self[path].manifest @classmethod def build(cls, path): |