diff options
author | Giampaolo Rodola <g.rodola@gmail.com> | 2016-09-05 00:49:16 +0200 |
---|---|---|
committer | Giampaolo Rodola <g.rodola@gmail.com> | 2016-09-05 00:49:16 +0200 |
commit | ab8d678112df54c7483ccb5f95f25e640752426a (patch) | |
tree | 924d4e5860c2369f6dc02237c907ce5070d84956 | |
parent | 63a77c97d700418b11d4d25355faedb0e74c6b84 (diff) | |
download | psutil-ab8d678112df54c7483ccb5f95f25e640752426a.tar.gz |
update git hook
-rwxr-xr-x | .git-pre-commit | 11 |
1 files changed, 6 insertions, 5 deletions
diff --git a/.git-pre-commit b/.git-pre-commit index a3161291..804c0a86 100755 --- a/.git-pre-commit +++ b/.git-pre-commit @@ -11,10 +11,10 @@ import sys def main(): out = subprocess.check_output("git diff --cached --name-only", shell=True) - files = [x for x in out.split(b'\n') if x.endswith(b'.py') and - os.path.exists(x)] + py_files = [x for x in out.split(b'\n') if x.endswith(b'.py') and + os.path.exists(x)] - for path in files: + for path in py_files: with open(path) as f: data = f.read() @@ -36,7 +36,7 @@ def main(): sys.exit("commit aborted: bare except clause") # flake8 - if files: + if py_files: try: import flake8 # NOQA except ImportError: @@ -44,7 +44,8 @@ def main(): "run 'make setup-dev-env'") ret = subprocess.call( - "%s -m flake8 %s" % (sys.executable, " ".join(files)), shell=True) + "%s -m flake8 %s" % (sys.executable, " ".join(py_files)), + shell=True) if ret != 0: sys.exit("commit aborted: python code is not flake8-compliant") |