Skip to content

Commit 0329bb5

Browse files
committed
Add a CLI option for the root directory
1 parent 24c3378 commit 0329bb5

File tree

1 file changed

+8
-3
lines changed

1 file changed

+8
-3
lines changed

.travis/build.py

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
1-
"""Update conda packages on binstars with latest versions"""
1+
"""
2+
Linter for diferite script types.
3+
"""
24
from __future__ import print_function
35

46
import argparse
@@ -15,6 +17,7 @@
1517
".py": (["pylint", "-rn"], "flake8", "pep8"),
1618
".sh": (["shellcheck", "-x"], "bashate"),
1719
}
20+
EXCLUDE = ('.', '..', '.venv', '.git', '.tox', 'dist', 'doc')
1821
CONFIG = {"whitelist": set()}
1922
CONFIG_PATH = os.path.expanduser("~/.cache/build/config.yml")
2023

@@ -137,7 +140,7 @@ def scripts(root):
137140
while files_queue:
138141
root = files_queue.pop()
139142
for files in os.listdir(root):
140-
if files in ('.', '..'):
143+
if files in EXCLUDE:
141144
continue
142145
file_path = os.path.join(root, files)
143146
if os.path.isfile(file_path):
@@ -151,6 +154,8 @@ def get_argparser():
151154
parser = argparse.ArgumentParser()
152155
parser.add_argument("--file_type", default=None, choices=CHECKS.keys(),
153156
dest="file_type", help="What file type to check.")
157+
parser.add_argument("--root", default=os.getenv("TRAVIS_BUILD_DIR"),
158+
dest="root", help="The root directory.")
154159
return parser
155160

156161

@@ -167,7 +172,7 @@ def main():
167172
args.file_type: CHECKS[args.file_type]
168173
}
169174

170-
for script in scripts(os.path.curdir):
175+
for script in scripts(args.root):
171176
script_type = script[-3:]
172177
if script_type not in checks:
173178
continue

0 commit comments

Comments
 (0)