diff options
author | Jason R. Coombs <jaraco@jaraco.com> | 2015-12-11 10:13:30 -0500 |
---|---|---|
committer | Jason R. Coombs <jaraco@jaraco.com> | 2015-12-11 10:13:30 -0500 |
commit | 5ba1d009e2c44b63fc2d2e1de09fd1d768c10fca (patch) | |
tree | a1f24511af5e8bad301a48827fad8263ece81e91 /setuptools/package_index.py | |
parent | 07037d10760792ffe616349ab7642b2fce0a0527 (diff) | |
download | external_python_setuptools-5ba1d009e2c44b63fc2d2e1de09fd1d768c10fca.tar.gz external_python_setuptools-5ba1d009e2c44b63fc2d2e1de09fd1d768c10fca.tar.bz2 external_python_setuptools-5ba1d009e2c44b63fc2d2e1de09fd1d768c10fca.zip |
Use context for opening file.
Diffstat (limited to 'setuptools/package_index.py')
-rwxr-xr-x | setuptools/package_index.py | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/setuptools/package_index.py b/setuptools/package_index.py index 525cb645..f81b8d78 100755 --- a/setuptools/package_index.py +++ b/setuptools/package_index.py @@ -359,8 +359,9 @@ class PackageIndex(Environment): self.scan_egg_link(item, entry) def scan_egg_link(self, path, entry): - lines = [_f for _f in map(str.strip, - open(os.path.join(path, entry))) if _f] + 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) |