summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGiampaolo Rodola <g.rodola@gmail.com>2018-03-24 12:24:59 +0100
committerGiampaolo Rodola <g.rodola@gmail.com>2018-03-24 12:24:59 +0100
commitcfc67c0b153816cb53d81eb944b8cb4ed0be2d20 (patch)
treec17e5c659371aabd7386a274a6aa4e0561f2bf82
parent95b8e4ba7c2f90d6239266890212feb4031c6bed (diff)
downloadpsutil-cfc67c0b153816cb53d81eb944b8cb4ed0be2d20.tar.gz
fix git commit hook cmd on win
-rw-r--r--Makefile2
-rwxr-xr-xscripts/internal/winmake.py12
2 files changed, 12 insertions, 2 deletions
diff --git a/Makefile b/Makefile
index d9f4a854..f7b4cd7f 100644
--- a/Makefile
+++ b/Makefile
@@ -264,7 +264,7 @@ bench-oneshot-2: ## Same as above but using perf module (supposed to be more pr
$(TEST_PREFIX) $(PYTHON) scripts/internal/bench_oneshot_2.py
check-broken-links: ## Look for broken links in source files.
- git ls-files | xargs $(PYTHON) -Wa scripts/internal/check_broken_links.py
+ git ls-files | xargs $(PYTHON) -Wa scripts/internal/check_broken_links.py
help: ## Display callable targets.
@grep -E '^[a-zA-Z_-]+:.*?## .*$$' $(MAKEFILE_LIST) | sort | awk 'BEGIN {FS = ":.*?## "}; {printf "\033[36m%-20s\033[0m %s\n", $$1, $$2}'
diff --git a/scripts/internal/winmake.py b/scripts/internal/winmake.py
index 548f7a8e..19c27ed1 100755
--- a/scripts/internal/winmake.py
+++ b/scripts/internal/winmake.py
@@ -28,6 +28,8 @@ PYTHON = os.getenv('PYTHON', sys.executable)
TSCRIPT = os.getenv('TSCRIPT', 'psutil\\tests\\__main__.py')
GET_PIP_URL = "https://bootstrap.pypa.io/get-pip.py"
PY3 = sys.version_info[0] == 3
+HERE = os.path.abspath(os.path.dirname(__file__))
+ROOT_DIR = os.path.realpath(os.path.join(HERE, "..", ".."))
DEPS = [
"coverage",
"flake8",
@@ -442,18 +444,26 @@ def test_memleaks():
@cmd
def install_git_hooks():
+ """Install GIT pre-commit hook."""
if os.path.isdir('.git'):
- shutil.copy(".git-pre-commit", ".git\\hooks\\pre-commit")
+ src = os.path.join(ROOT_DIR, ".git-pre-commit")
+ dst = os.path.realpath(
+ os.path.join(ROOT_DIR, ".git", "hooks", "pre-commit"))
+ with open(src, "rt") as s:
+ with open(dst, "wt") as d:
+ d.write(s.read())
@cmd
def bench_oneshot():
+ """Benchmarks for oneshot() ctx manager (see #799)."""
install()
sh("%s -Wa scripts\\internal\\bench_oneshot.py" % PYTHON)
@cmd
def bench_oneshot_2():
+ """Same as above but using perf module (supposed to be more precise)."""
install()
sh("%s -Wa scripts\\internal\\bench_oneshot_2.py" % PYTHON)