mirror of
https://github.com/bndr/pipreqs.git
synced 2025-06-06 03:25:21 +00:00
Ignore irreverent directory when generating requirement.txt
* Currently ignore .git, __pycache__, env
This commit is contained in:
parent
fef28cc9c9
commit
301ff8ce83
@ -32,10 +32,18 @@ REGEXP = [
|
||||
def get_all_imports(path):
|
||||
imports = []
|
||||
candidates = []
|
||||
ignore_dirs = [".git", "__pycache__", "env"]
|
||||
|
||||
for root, dirs, files in os.walk(path):
|
||||
dirs[:] = [d for d in dirs if d not in ignore_dirs]
|
||||
|
||||
# for d in ignore_dirs:
|
||||
# if d in dirs:
|
||||
# dirs.remove(d)
|
||||
|
||||
candidates.append(os.path.basename(root))
|
||||
files = [fn for fn in files if os.path.splitext(fn)[1] == ".py"]
|
||||
|
||||
candidates += [os.path.splitext(fn)[0] for fn in files]
|
||||
for file_name in files:
|
||||
with open(os.path.join(root, file_name), "r") as f:
|
||||
|
Loading…
x
Reference in New Issue
Block a user