diff options
author | Bert Belder <bertbelder@gmail.com> | 2018-07-08 19:14:55 +0200 |
---|---|---|
committer | Ryan Dahl <ry@tinyclouds.org> | 2018-07-08 13:40:18 -0400 |
commit | 7c5db007deb43d65550213ff07ad95bc0cce6f00 (patch) | |
tree | cfd7b299448250086eb7e423f28bceed33a95d66 /tools/util.py | |
parent | f917c5e722d7ee5abd58704eb0e5d49072249e94 (diff) |
tools: fix windows
This fixes most things, but format.py doesn't work yet, because
yapf is broken due to some depot_tools shimming python.
Diffstat (limited to 'tools/util.py')
-rw-r--r-- | tools/util.py | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/tools/util.py b/tools/util.py index 1d44acd48..40c98e336 100644 --- a/tools/util.py +++ b/tools/util.py @@ -7,12 +7,19 @@ import subprocess def run(args): print " ".join(args) env = os.environ.copy() + if os.name == "nt": + # Run through shell to make .bat/.cmd files work. + args = ["cmd", "/c"] + args subprocess.check_call(args, env=env) def remove_and_symlink(target, name, target_is_dir=False): try: - os.unlink(name) + # On Windows, directory symlink can only be removed with rmdir(). + if os.name == "nt" and os.path.isdir(name): + os.rmdir(name) + else: + os.unlink(name) except: pass symlink(target, name, target_is_dir) |