Skip to content

Commit

Permalink
Merge 5d02bed into cb4add2
Browse files Browse the repository at this point in the history
  • Loading branch information
solstag committed Apr 26, 2021
2 parents cb4add2 + 5d02bed commit b6ec7bc
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions pipreqs/pipreqs.py
Original file line number Diff line number Diff line change
Expand Up @@ -209,7 +209,7 @@ def get_imports_info(
def get_locally_installed_packages(encoding=None):
packages = {}
ignore = ["tests", "_tests", "egg", "EGG", "info"]
for path in sys.path:
for path in reversed(sys.path):
for root, dirs, files in os.walk(path):
for item in files:
if "top_level" in item:
Expand All @@ -223,7 +223,11 @@ def get_locally_installed_packages(encoding=None):
continue
for i_item in package_import:
if ((i_item not in ignore) and
(package[0] not in ignore)):
(package[0] not in ignore) and
(
os.path.isdir(os.path.join(path, i_item)) or
os.path.isfile(os.path.join(path, i_item + '.py'))
)):
version = None
if len(package) > 1:
version = package[1].replace(
Expand Down

0 comments on commit b6ec7bc

Please sign in to comment.