diff options
author | Patrick Nguyen <drpng@google.com> | 2016-10-20 12:09:18 -0800 |
---|---|---|
committer | TensorFlower Gardener <gardener@tensorflow.org> | 2016-10-20 13:19:03 -0700 |
commit | c5ab3dd177dc16bb211821e38219f350a613b5e8 (patch) | |
tree | 69f38f2790f85f31dae60b6b7c6b136b3b380daa /tensorflow/tools/git/gen_git_source.py | |
parent | 8532897352ada1d8ecd3ca1dd17aaa869a42d4b8 (diff) |
Merge changes from github.
Change: 136750267
Diffstat (limited to 'tensorflow/tools/git/gen_git_source.py')
-rwxr-xr-x | tensorflow/tools/git/gen_git_source.py | 11 |
1 files changed, 8 insertions, 3 deletions
diff --git a/tensorflow/tools/git/gen_git_source.py b/tensorflow/tools/git/gen_git_source.py index 8b02c09064..db9de3f816 100755 --- a/tensorflow/tools/git/gen_git_source.py +++ b/tensorflow/tools/git/gen_git_source.py @@ -112,9 +112,14 @@ def configure(src_base_path, debug=False): if src is None: open(os.path.join(gen_path, target), "w").write("") else: - if hasattr(os, 'symlink'): - os.symlink(src, os.path.join(gen_path, target)) - else: + try: + # In python 3.5, symlink function exists even on Windows. But requires + # Windows Admin privileges, otherwise an OSError will be thrown. + if hasattr(os, 'symlink'): + os.symlink(src, os.path.join(gen_path, target)) + else: + shutil.copy2(src, os.path.join(gen_path, target)) + except OSError: shutil.copy2(src, os.path.join(gen_path, target)) json.dump(spec, open(os.path.join(gen_path, "spec.json"), "w"), indent=2) |