mirror of
https://github.com/bndr/pipreqs.git
synced 2025-06-04 18:45:22 +00:00
Merge pull request #24 from Lee-W/master
Skip irreverent directory and change logging level
This commit is contained in:
commit
d558f73c4e
10
.gitignore
vendored
10
.gitignore
vendored
@ -42,3 +42,13 @@ output/*/index.html
|
||||
# Sphinx
|
||||
docs/_build
|
||||
.idea/
|
||||
# Created by https://www.gitignore.io/api/vim
|
||||
|
||||
### Vim ###
|
||||
[._]*.s[a-w][a-z]
|
||||
[._]s[a-w][a-z]
|
||||
*.un~
|
||||
Session.vim
|
||||
.netrwhist
|
||||
*~
|
||||
|
||||
|
@ -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:
|
||||
@ -166,8 +174,8 @@ def init(args):
|
||||
os.path.join(args['<path>'], "requirements.txt"))
|
||||
|
||||
if not args["--savepath"] and not args["--force"] and os.path.exists(path):
|
||||
logging.info("Requirements.txt already exists, "
|
||||
"use --force to overwrite it")
|
||||
logging.warning("Requirements.txt already exists, "
|
||||
"use --force to overwrite it")
|
||||
return
|
||||
generate_requirements_file(path, imports)
|
||||
logging.info("Successfully saved requirements file in " + path)
|
||||
|
Loading…
x
Reference in New Issue
Block a user