Skip to content

Commit 08b41b6

Browse files
committed
Handle cases of packages with no files
For packages installed in 'pip editable' or 'setup.py develop' mode, the `package` dict has no "files" key, so this fails with a KeyError. (I am assuming that some version of pip returned a `package` dict with "files" present but set to `None` or somesuch, so I have left the "`or []`" even though it seems like a simple mistake.)
1 parent 7194c15 commit 08b41b6

File tree

2 files changed

+2
-2
lines changed

2 files changed

+2
-2
lines changed

pip_check_reqs/find_extra_reqs.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ def find_extra_reqs(options):
2424
for package in search_packages_info(all_pkgs):
2525
log.debug('installed package: %s (at %s)', package['name'],
2626
package['location'])
27-
for f in package['files'] or []:
27+
for f in package.get('files', []) or []:
2828
path = os.path.realpath(os.path.join(package['location'], f))
2929
installed_files[path] = package['name']
3030
package_path = common.is_package_file(path)

pip_check_reqs/find_missing_reqs.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ def find_missing_reqs(options):
2626
for package in search_packages_info(all_pkgs):
2727
log.debug('installed package: %s (at %s)', package['name'],
2828
package['location'])
29-
for file in package['files'] or []:
29+
for file in package.get('files', []) or []:
3030
path = os.path.realpath(os.path.join(package['location'], file))
3131
installed_files[path] = package['name']
3232
package_path = common.is_package_file(path)

0 commit comments

Comments
 (0)