Module: check_mk
Branch: master
Commit: 3b9dad04471629fde46591336b78e536d2c24985
URL:
http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=3b9dad04471629…
Author: Lars Michelsen <lm(a)mathias-kettner.de>
Date: Fri Apr 22 21:31:55 2016 +0200
pylint: Add dedicated subdirectory for every pylint check
---
pylint/Makefile | 2 +-
pylint/pylint_cmk.py | 12 ++++++++----
2 files changed, 9 insertions(+), 5 deletions(-)
diff --git a/pylint/Makefile b/pylint/Makefile
index 1b8394e..5511a4f 100644
--- a/pylint/Makefile
+++ b/pylint/Makefile
@@ -20,6 +20,6 @@ checks:
build:
export TERM="linux" ; \
export PYLINT_ARGS="--output-format=parseable" ; \
- export PYLINT_OUTPUT="pylint.log" ; \
+ export PYLINT_OUTPUT="$$WORKDIR/pylint.log" ; \
echo -n > pylint.log ; \
$(MAKE) all
diff --git a/pylint/pylint_cmk.py b/pylint/pylint_cmk.py
index 3e390b5..633e8e0 100644
--- a/pylint/pylint_cmk.py
+++ b/pylint/pylint_cmk.py
@@ -74,9 +74,13 @@ def add_file(f, path):
def get_test_dir():
- base_path = os.environ.get("JOB_PATH")
- if not base_path:
+ base_path = os.environ.get("WORKDIR")
+ if base_path:
+ base_path += "/" + os.path.basename(sys.argv[0])
+ os.makedirs(base_path)
+ else:
base_path = tempfile.mkdtemp(prefix="cmk_pylint")
+
print("Prepare check in %s..." % base_path)
return base_path
@@ -105,8 +109,8 @@ def run_pylint(cfg_file, base_path):
print("Finished with exit code: %d" % exit_code)
if exit_code == 0:
- # Don't remove directory when specified via JOB_PATH env
- if not os.environ.get("JOB_PATH"):
+ # Don't remove directory when specified via WORKDIR env
+ if not os.environ.get("WORKDIR"):
print("Removing build path...")
shutil.rmtree(base_path)