Skip to content

Commit 9d4be3c

Browse files
committed
Handle different top level directories for nixpkgs GHC
Some newer GHC versions have the `package.conf.d` below a `lib` directory.
1 parent 72c3203 commit 9d4be3c

File tree

1 file changed

+10
-1
lines changed

1 file changed

+10
-1
lines changed

haskell/private/pkgdb_to_bzl.py

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,14 @@
2121
if len(sys.argv) == 3:
2222
repo_dir = "external/" + sys.argv[1]
2323
topdir = sys.argv[2]
24+
25+
if os.path.exists(os.path.join(topdir, 'package.conf.d')):
26+
package_conf_dir = os.path.join(topdir, 'package.conf.d')
27+
elif os.path.exists(os.path.join(topdir, 'lib', 'package.conf.d')):
28+
topdir = os.path.join(topdir, 'lib')
29+
package_conf_dir = os.path.join(topdir, 'package.conf.d')
30+
else:
31+
sys.exit("could not find package.conf.d directory at {}".format(topdir))
2432
else:
2533
sys.exit("Usage: pkgdb_to_bzl.py <REPO_NAME> <TOPDIR>")
2634

@@ -79,7 +87,8 @@ def hs_library_pattern(name, mode = "static", profiling = False):
7987

8088
# Accumulate package id to package name mappings.
8189
pkg_id_map = []
82-
for conf in glob.glob(os.path.join(topdir, "package.conf.d", "*.conf")):
90+
91+
for conf in glob.glob(os.path.join(package_conf_dir, '*.conf')):
8392
with open(conf, 'r') as f:
8493
pkg = package_configuration.parse_package_configuration(f)
8594

0 commit comments

Comments
 (0)