Skip to content

Commit 68402d5

Browse files
committed
Use cygpath to convert ERLANG_HOME
1 parent c63a92e commit 68402d5

File tree

2 files changed

+4
-11
lines changed

2 files changed

+4
-11
lines changed

repositories/erlang_config.bzl

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
load(
22
"//:util.bzl",
3-
"msys2_path",
43
"path_join",
54
)
65

@@ -140,6 +139,9 @@ def _erlang_home_from_erl_path(repository_ctx, erl_path):
140139
def _is_windows(repository_ctx):
141140
return repository_ctx.os.name.lower().find("windows") != -1
142141

142+
def _msys2_path(repository_ctx, path):
143+
return repository_ctx.execute(["cygpath", "-u", path]).stdout.strip("\n")
144+
143145
def _default_erlang_dict(repository_ctx):
144146
if _is_windows(repository_ctx):
145147
if ERLANG_HOME_ENV_VAR in repository_ctx.os.environ:
@@ -150,7 +152,7 @@ def _default_erlang_dict(repository_ctx):
150152
if erl_path == None:
151153
erl_path = repository_ctx.path("C:/Program Files/Erlang OTP/bin/erl.exe")
152154
erlang_home = _erlang_home_from_erl_path(repository_ctx, erl_path)
153-
erlang_home = msys2_path(erlang_home)
155+
erlang_home = _msys2_path(erlang_home)
154156
elif ERLANG_HOME_ENV_VAR in repository_ctx.os.environ:
155157
erlang_home = repository_ctx.os.environ[ERLANG_HOME_ENV_VAR]
156158
erl_path = path_join(erlang_home, "bin", "erl")

util.bzl

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -19,15 +19,6 @@ def windows_path(path):
1919
).replace("/", "\\")
2020
return path.replace("/", "\\")
2121

22-
def msys2_path(path):
23-
for letter in _DRIVE_LETTERS:
24-
for prefix in ["%s:" % letter.upper(), "%s:" % letter]:
25-
if path.startswith(prefix):
26-
return "/%s" % letter + path.removeprefix(
27-
prefix,
28-
).replace("\\", "/")
29-
return path.replace("\\", "/")
30-
3122
def without(item, elements):
3223
c = list(elements)
3324
c.remove(item)

0 commit comments

Comments
 (0)