Skip to content

Commit ac05cc8

Browse files
committed
Resolve $topdir in ghc-pkg paths
1 parent 6fcc564 commit ac05cc8

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

haskell/private/pkgdb_to_bzl.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,9 +34,11 @@
3434
sys.exit("Usage: pkgdb_to_bzl.py <REPO_NAME> <TOPDIR>")
3535

3636
def resolve(path, pkgroot):
37-
"""Resolve references to ${pkgroot} with the given value"""
37+
"""Resolve references to ${pkgroot} with the given value, resolve $topdir with `topdir`"""
3838
if path.find("${pkgroot}") != -1:
3939
return path.strip("\"").replace("${pkgroot}", pkgroot)
40+
elif path.startswith("$topdir"):
41+
return os.path.normpath(path.replace("$topdir", topdir)).replace('\\', '/')
4042
else:
4143
return path
4244

0 commit comments

Comments
 (0)