aboutsummaryrefslogtreecommitdiffstats
path: root/pkg_resources
diff options
context:
space:
mode:
authorJason R. Coombs <jaraco@jaraco.com>2018-02-10 22:46:44 -0500
committerJason R. Coombs <jaraco@jaraco.com>2018-02-10 22:46:44 -0500
commit872cab1085f7dd763daed76124d5bcb4457d733e (patch)
tree551dc62d214f16769fcf82812eae8c7f60a14573 /pkg_resources
parentdc071a330c51804e9749e6d08370b048b785eadc (diff)
downloadexternal_python_setuptools-872cab1085f7dd763daed76124d5bcb4457d733e.tar.gz
external_python_setuptools-872cab1085f7dd763daed76124d5bcb4457d733e.tar.bz2
external_python_setuptools-872cab1085f7dd763daed76124d5bcb4457d733e.zip
Extract method for _build_dep_map
Diffstat (limited to 'pkg_resources')
-rw-r--r--pkg_resources/__init__.py32
1 files changed, 18 insertions, 14 deletions
diff --git a/pkg_resources/__init__.py b/pkg_resources/__init__.py
index 08547560..cecf7691 100644
--- a/pkg_resources/__init__.py
+++ b/pkg_resources/__init__.py
@@ -2683,20 +2683,24 @@ class Distribution(object):
try:
return self.__dep_map
except AttributeError:
- dm = self.__dep_map = {None: []}
- for name in 'requires.txt', 'depends.txt':
- for extra, reqs in split_sections(self._get_metadata(name)):
- if extra:
- if ':' in extra:
- extra, marker = extra.split(':', 1)
- if invalid_marker(marker):
- # XXX warn
- reqs = []
- elif not evaluate_marker(marker):
- reqs = []
- extra = safe_extra(extra) or None
- dm.setdefault(extra, []).extend(parse_requirements(reqs))
- return dm
+ self.__dep_map = self._build_dep_map()
+ return self.__dep_map
+
+ def _build_dep_map(self):
+ dm = {None: []}
+ for name in 'requires.txt', 'depends.txt':
+ for extra, reqs in split_sections(self._get_metadata(name)):
+ if extra:
+ if ':' in extra:
+ extra, marker = extra.split(':', 1)
+ if invalid_marker(marker):
+ # XXX warn
+ reqs = []
+ elif not evaluate_marker(marker):
+ reqs = []
+ extra = safe_extra(extra) or None
+ dm.setdefault(extra, []).extend(parse_requirements(reqs))
+ return dm
def requires(self, extras=()):
"""List of Requirements needed for this distro if `extras` are used"""