mirror of
https://github.com/bndr/pipreqs.git
synced 2025-06-07 12:05:33 +00:00
fix name resolution for local packages
This commit is contained in:
parent
e5493d922e
commit
3f5964fcb9
@ -229,7 +229,8 @@ def get_import_local(imports, encoding=None):
|
|||||||
result = []
|
result = []
|
||||||
for item in imports:
|
for item in imports:
|
||||||
if item.lower() in local:
|
if item.lower() in local:
|
||||||
result.append(local[item.lower()])
|
# append to result a matching package, as well as its exported modules
|
||||||
|
result.append(dict(**local[item.lower()], exports=item.lower()))
|
||||||
|
|
||||||
# removing duplicates of package/version
|
# removing duplicates of package/version
|
||||||
result_unique = [
|
result_unique = [
|
||||||
@ -443,9 +444,12 @@ def init(args):
|
|||||||
else:
|
else:
|
||||||
logging.debug("Getting packages information from Local/PyPI")
|
logging.debug("Getting packages information from Local/PyPI")
|
||||||
local = get_import_local(candidates, encoding=encoding)
|
local = get_import_local(candidates, encoding=encoding)
|
||||||
|
|
||||||
# Get packages that were not found locally
|
# Get packages that were not found locally
|
||||||
difference = [x for x in candidates
|
difference = [x for x in candidates
|
||||||
if x.lower() not in [z['name'].lower() for z in local]]
|
# check if candidate name is found in the list of exported modules, installed locally
|
||||||
|
if x.lower() not in [y['exports'] for y in local]]
|
||||||
|
|
||||||
imports = local + get_imports_info(difference,
|
imports = local + get_imports_info(difference,
|
||||||
proxy=proxy,
|
proxy=proxy,
|
||||||
pypi_server=pypi_server)
|
pypi_server=pypi_server)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user