diff options
author | Jason R. Coombs <jaraco@jaraco.com> | 2015-12-11 10:16:25 -0500 |
---|---|---|
committer | Jason R. Coombs <jaraco@jaraco.com> | 2015-12-11 10:16:25 -0500 |
commit | cd28f4e0eddf3f571cb0efe05a23fa4a7a254de7 (patch) | |
tree | a71dd6bf9eeffb9bc9e836a24f19c39eb97534ec /setuptools/package_index.py | |
parent | 5ba1d009e2c44b63fc2d2e1de09fd1d768c10fca (diff) | |
download | external_python_setuptools-cd28f4e0eddf3f571cb0efe05a23fa4a7a254de7.tar.gz external_python_setuptools-cd28f4e0eddf3f571cb0efe05a23fa4a7a254de7.tar.bz2 external_python_setuptools-cd28f4e0eddf3f571cb0efe05a23fa4a7a254de7.zip |
Replace nested code with short-circuit return.
Diffstat (limited to 'setuptools/package_index.py')
-rwxr-xr-x | setuptools/package_index.py | 14 |
1 files changed, 9 insertions, 5 deletions
diff --git a/setuptools/package_index.py b/setuptools/package_index.py index f81b8d78..5adb8c2b 100755 --- a/setuptools/package_index.py +++ b/setuptools/package_index.py @@ -362,11 +362,15 @@ class PackageIndex(Environment): with open(os.path.join(path, entry)) as raw_lines: # filter non-empty lines lines = list(filter(None, map(str.strip, raw_lines))) - if len(lines)==2: - for dist in find_distributions(os.path.join(path, lines[0])): - dist.location = os.path.join(path, *lines) - dist.precedence = SOURCE_DIST - self.add(dist) + + if len(lines) != 2: + # format is not recognized; punt + return + + for dist in find_distributions(os.path.join(path, lines[0])): + dist.location = os.path.join(path, *lines) + dist.precedence = SOURCE_DIST + self.add(dist) def process_index(self,url,page): """Process the contents of a PyPI page""" |