diff options
author | Giampaolo Rodola <g.rodola@gmail.com> | 2021-12-15 11:46:07 +0100 |
---|---|---|
committer | Giampaolo Rodola <g.rodola@gmail.com> | 2021-12-15 11:46:07 +0100 |
commit | ff2f4d4c4986bffbc5348a197396e11bef057346 (patch) | |
tree | ec673f29b1a18be6313a73ce642e68266a6aee93 /scripts | |
parent | ebbaae8d1f42f051282af79d60f19cb1161088a5 (diff) | |
download | psutil-ff2f4d4c4986bffbc5348a197396e11bef057346.tar.gz |
assert scripts have +x bit
Signed-off-by: Giampaolo Rodola <g.rodola@gmail.com>
Diffstat (limited to 'scripts')
-rwxr-xr-x | scripts/internal/git_pre_commit.py | 5 | ||||
-rwxr-xr-x | scripts/internal/winmake.py | 10 |
2 files changed, 8 insertions, 7 deletions
diff --git a/scripts/internal/git_pre_commit.py b/scripts/internal/git_pre_commit.py index dca17ffb..c6f223bb 100755 --- a/scripts/internal/git_pre_commit.py +++ b/scripts/internal/git_pre_commit.py @@ -13,6 +13,7 @@ the files which were modified in the commit. Checks: - assert not pdb.set_trace in code - assert no bare except clause ("except:") in code - assert "flake8" checks pass +- assert "isort" checks pass - assert C linter checks pass - abort if files were added/renamed/removed and MANIFEST.in was not updated @@ -124,7 +125,7 @@ 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 is not flake8 compliant; " + return exit("python code didn't pass 'flake8' style check; " "try running 'make fix-flake8'") # isort assert os.path.exists('.isort.cfg') @@ -132,7 +133,7 @@ def main(): PYTHON, " ".join(py_files)) ret = subprocess.call(shlex.split(cmd)) if ret != 0: - return exit("python code is not flake8 compliant; " + return exit("python code didn't pass 'isort' style check; " "try running 'make fix-imports'") # C linter if c_files: diff --git a/scripts/internal/winmake.py b/scripts/internal/winmake.py index 4452ef09..6c482975 100755 --- a/scripts/internal/winmake.py +++ b/scripts/internal/winmake.py @@ -156,11 +156,11 @@ def rm(pattern, directory=False): safe_remove(pattern) return - for root, subdirs, subfiles in os.walk('.'): + for root, dirs, files in os.walk('.'): root = os.path.normpath(root) if root.startswith('.git/'): continue - found = fnmatch.filter(subdirs if directory else subfiles, pattern) + found = fnmatch.filter(dirs if directory else files, pattern) for name in found: path = os.path.join(root, name) if directory: @@ -195,15 +195,15 @@ def safe_rmtree(path): def recursive_rm(*patterns): """Recursively remove a file or matching a list of patterns.""" - for root, subdirs, subfiles in os.walk(u'.'): + for root, dirs, files in os.walk(u'.'): root = os.path.normpath(root) if root.startswith('.git/'): continue - for file in subfiles: + for file in files: for pattern in patterns: if fnmatch.fnmatch(file, pattern): safe_remove(os.path.join(root, file)) - for dir in subdirs: + for dir in dirs: for pattern in patterns: if fnmatch.fnmatch(dir, pattern): safe_rmtree(os.path.join(root, dir)) |