diff options
| author | Giampaolo Rodola <g.rodola@gmail.com> | 2018-03-24 12:24:59 +0100 |
|---|---|---|
| committer | Giampaolo Rodola <g.rodola@gmail.com> | 2018-03-24 12:24:59 +0100 |
| commit | cfc67c0b153816cb53d81eb944b8cb4ed0be2d20 (patch) | |
| tree | c17e5c659371aabd7386a274a6aa4e0561f2bf82 /scripts/internal | |
| parent | 95b8e4ba7c2f90d6239266890212feb4031c6bed (diff) | |
| download | psutil-cfc67c0b153816cb53d81eb944b8cb4ed0be2d20.tar.gz | |
fix git commit hook cmd on win
Diffstat (limited to 'scripts/internal')
| -rwxr-xr-x | scripts/internal/winmake.py | 12 |
1 files changed, 11 insertions, 1 deletions
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) |
