Merge pull request #37006 from njzjz:resolve-symbolic-links-for-cuda

PiperOrigin-RevId: 299867430
Change-Id: I5622a0eb6cd89373a00a07be755f4b3ea572374d
This commit is contained in:
TensorFlower Gardener 2020-03-09 10:06:18 -07:00
commit 336724e40a
4 changed files with 6 additions and 5 deletions

View File

@ -49,6 +49,7 @@ load(
"is_windows",
"raw_exec",
"read_dir",
"realpath",
"which",
)
@ -360,8 +361,8 @@ def _cuda_include_path(repository_ctx, cuda_config):
)
inc_entries = []
if target_dir != "":
inc_entries.append(target_dir)
inc_entries.append(cuda_config.cuda_toolkit_path + "/include")
inc_entries.append(realpath(repository_ctx, target_dir))
inc_entries.append(realpath(repository_ctx, cuda_config.cuda_toolkit_path + "/include"))
return inc_entries
def enable_cuda(repository_ctx):

View File

@ -437,7 +437,7 @@ def _get_legacy_path(env_name, default=[]):
def _normalize_path(path):
"""Returns normalized path, with forward slashes on Windows."""
path = os.path.normpath(path)
path = os.path.realpath(path)
if _is_windows():
path = path.replace("\\", "/")
return path

File diff suppressed because one or more lines are too long

View File

@ -265,7 +265,7 @@ def realpath(repository_ctx, path, bash_bin = None):
if bash_bin == None:
bash_bin = get_bash_bin(repository_ctx)
return execute(repository_ctx, [bash_bin, "-c", "realpath %s" % path]).stdout.strip()
return execute(repository_ctx, [bash_bin, "-c", "realpath \"%s\"" % path]).stdout.strip()
def err_out(result):
"""Returns stderr if set, else stdout.