diff options
author | Giampaolo Rodola <g.rodola@gmail.com> | 2023-04-10 23:48:49 +0200 |
---|---|---|
committer | Giampaolo Rodola <g.rodola@gmail.com> | 2023-04-10 23:48:49 +0200 |
commit | f11c0552f2bcfc8bc3afa35d29adb4dc5525c092 (patch) | |
tree | 79eadf1f560dcbc4f008975979e04f8e4cfbe57d /scripts/internal/git_pre_commit.py | |
parent | 6b8700270e2c32e876dfca081dbbec832aa4e7a0 (diff) | |
parent | 4dd1e215f3d49fb3a5074b82430bf6199c14898e (diff) | |
download | psutil-f11c0552f2bcfc8bc3afa35d29adb4dc5525c092.tar.gz |
merge from master
Signed-off-by: Giampaolo Rodola <g.rodola@gmail.com>
Diffstat (limited to 'scripts/internal/git_pre_commit.py')
-rwxr-xr-x | scripts/internal/git_pre_commit.py | 20 |
1 files changed, 10 insertions, 10 deletions
diff --git a/scripts/internal/git_pre_commit.py b/scripts/internal/git_pre_commit.py index 87783627..dad0066b 100755 --- a/scripts/internal/git_pre_commit.py +++ b/scripts/internal/git_pre_commit.py @@ -107,16 +107,16 @@ def main(): # space at end of line if line.endswith(' '): print("%s:%s %r" % (path, lineno, line)) - return exit("space at end of line") + return sys.exit("space at end of line") line = line.rstrip() # # pdb (now provided by flake8-debugger plugin) # if "pdb.set_trace" in line: # print("%s:%s %s" % (path, lineno, line)) - # return exit("you forgot a pdb in your python code") + # return sys.exit("you forgot a pdb in your python code") # # bare except clause (now provided by flake8-blind-except plugin) # if "except:" in line and not line.endswith("# NOQA"): # print("%s:%s %s" % (path, lineno, line)) - # return exit("bare except clause") + # return sys.exit("bare except clause") # Python linters if py_files: @@ -125,28 +125,28 @@ def main(): cmd = "%s -m flake8 --config=.flake8 %s" % (PYTHON, " ".join(py_files)) ret = subprocess.call(shlex.split(cmd)) if ret != 0: - return exit("python code didn't pass 'flake8' style check; " - "try running 'make fix-flake8'") + return sys.exit("python code didn't pass 'flake8' style check; " + "try running 'make fix-flake8'") # isort cmd = "%s -m isort --check-only %s" % ( PYTHON, " ".join(py_files)) ret = subprocess.call(shlex.split(cmd)) if ret != 0: - return exit("python code didn't pass 'isort' style check; " - "try running 'make fix-imports'") + return sys.exit("python code didn't pass 'isort' style check; " + "try running 'make fix-imports'") # C linter if c_files: # XXX: we should escape spaces and possibly other amenities here cmd = "%s scripts/internal/clinter.py %s" % (PYTHON, " ".join(c_files)) ret = subprocess.call(cmd, shell=True) if ret != 0: - return exit("C code didn't pass style check") + return sys.exit("C code didn't pass style check") if new_rm_mv: out = sh("%s scripts/internal/generate_manifest.py" % PYTHON) with open_text('MANIFEST.in') as f: if out.strip() != f.read().strip(): - exit("some files were added, deleted or renamed; " - "run 'make generate-manifest' and commit again") + sys.exit("some files were added, deleted or renamed; " + "run 'make generate-manifest' and commit again") main() |