Skip to content

Commit 982e882

Browse files
committed
Revert "Use cygpath to convert ERLANG_HOME"
This reverts commit 68402d5.
1 parent 68402d5 commit 982e882

File tree

2 files changed

+11
-4
lines changed

2 files changed

+11
-4
lines changed

repositories/erlang_config.bzl

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

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

142-
def _msys2_path(repository_ctx, path):
143-
return repository_ctx.execute(["cygpath", "-u", path]).stdout.strip("\n")
144-
145143
def _default_erlang_dict(repository_ctx):
146144
if _is_windows(repository_ctx):
147145
if ERLANG_HOME_ENV_VAR in repository_ctx.os.environ:
@@ -152,7 +150,7 @@ def _default_erlang_dict(repository_ctx):
152150
if erl_path == None:
153151
erl_path = repository_ctx.path("C:/Program Files/Erlang OTP/bin/erl.exe")
154152
erlang_home = _erlang_home_from_erl_path(repository_ctx, erl_path)
155-
erlang_home = _msys2_path(erlang_home)
153+
erlang_home = msys2_path(erlang_home)
156154
elif ERLANG_HOME_ENV_VAR in repository_ctx.os.environ:
157155
erlang_home = repository_ctx.os.environ[ERLANG_HOME_ENV_VAR]
158156
erl_path = path_join(erlang_home, "bin", "erl")

util.bzl

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,15 @@ 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+
2231
def without(item, elements):
2332
c = list(elements)
2433
c.remove(item)

0 commit comments

Comments
 (0)