aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJason R. Coombs <jaraco@jaraco.com>2014-07-05 12:02:01 -0400
committerJason R. Coombs <jaraco@jaraco.com>2014-07-05 12:02:01 -0400
commitbd7e1edff511c8410acfb640d005502d66910b41 (patch)
tree22408006ba111550ade01c4b7cd161cd5f1c1919
parente7df10e709c9a847e14d1db8d744b39c0183cf8c (diff)
downloadexternal_python_setuptools-bd7e1edff511c8410acfb640d005502d66910b41.tar.gz
external_python_setuptools-bd7e1edff511c8410acfb640d005502d66910b41.tar.bz2
external_python_setuptools-bd7e1edff511c8410acfb640d005502d66910b41.zip
Make memoized zip manifests opt-in using the PKG_RESOURCES_CACHE_ZIP_MANIFESTS environment variable. Ref #154.
-rw-r--r--CHANGES.txt8
-rw-r--r--pkg_resources.py6
2 files changed, 11 insertions, 3 deletions
diff --git a/CHANGES.txt b/CHANGES.txt
index 003e2d5d..ef456a7e 100644
--- a/CHANGES.txt
+++ b/CHANGES.txt
@@ -6,8 +6,12 @@ CHANGES
5.4
---
-* Issue #154: Cache the reading of the zip file index for cases where the
- same zip-file is used for multiple packages (like PEX).
+* Issue #154: ``pkg_resources`` will now cache the zip manifests rather than
+ re-processing the same file from disk multiple times, but only if the
+ environment variable ``PKG_RESOURCES_CACHE_ZIP_MANIFESTS`` is set. Clients
+ that package many modules in the same zip file will see some improvement
+ in startup time by enabling this feature. This feature is not enabled by
+ default because it causes a substantial increase in memory usage.
---
5.3
diff --git a/pkg_resources.py b/pkg_resources.py
index f4c7f5e9..3782384a 100644
--- a/pkg_resources.py
+++ b/pkg_resources.py
@@ -1602,7 +1602,11 @@ class ZipProvider(EggProvider):
"""Resource support for zips and eggs"""
eagers = None
- _zip_manifests = ZipManifests()
+ _zip_manifests = (
+ MemoizedZipManifests()
+ if os.environ.get('PKG_RESOURCES_CACHE_ZIP_MANIFESTS') else
+ ZipManifests()
+ )
def __init__(self, module):
EggProvider.__init__(self, module)