Module: check_mk
Branch: master
Commit: a5b25747f3da6efe4bfd8784a061bd8a3c399623
URL:
http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=a5b25747f3da6e…
Author: Lars Michelsen <lm(a)mathias-kettner.de>
Date: Fri Apr 22 21:07:05 2016 +0200
pylint: Using optional build path for temporary files
---
pylint/pylint_cmk.py | 10 +++++++---
1 file changed, 7 insertions(+), 3 deletions(-)
diff --git a/pylint/pylint_cmk.py b/pylint/pylint_cmk.py
index 401fb1e..3e390b5 100644
--- a/pylint/pylint_cmk.py
+++ b/pylint/pylint_cmk.py
@@ -74,7 +74,9 @@ def add_file(f, path):
def get_test_dir():
- base_path = tempfile.mkdtemp(prefix="cmk_pylint")
+ base_path = os.environ.get("JOB_PATH")
+ if not base_path:
+ base_path = tempfile.mkdtemp(prefix="cmk_pylint")
print("Prepare check in %s..." % base_path)
return base_path
@@ -103,8 +105,10 @@ def run_pylint(cfg_file, base_path):
print("Finished with exit code: %d" % exit_code)
if exit_code == 0:
- print("Removing build path...")
- shutil.rmtree(base_path)
+ # Don't remove directory when specified via JOB_PATH env
+ if not os.environ.get("JOB_PATH"):
+ print("Removing build path...")
+ shutil.rmtree(base_path)
return exit_code