Skip to content

Commit e74c12b

Browse files
authored
Merge pull request #2139 from tweag/pkgdb-to-bzl-inexistent-dirs
Fix error when include dirs do not exist
2 parents bf2e6cd + 1e5c097 commit e74c12b

File tree

2 files changed

+23
-15
lines changed

2 files changed

+23
-15
lines changed

haskell/private/pkgdb_to_bzl.bzl

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,9 @@ def pkgdb_to_bzl(repository_ctx, paths, libdir):
1919
])
2020
if result.return_code:
2121
fail("Error executing pkgdb_to_bzl.py: {stderr}".format(stderr = result.stderr))
22+
elif result.stderr:
23+
# print any warnings from pkgdb_to_bzl.py
24+
print(result.stderr)
2225

2326
result_dict = json.decode(result.stdout)
2427

haskell/private/pkgdb_to_bzl.py

Lines changed: 20 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,11 @@ def resolve(path, pkgroot):
5050
else:
5151
return path
5252

53+
54+
def join_paths(paths):
55+
return ["/".join(ps) for ps in paths if not None in ps]
56+
57+
5358
symlinks = {}
5459

5560
def path_to_label(path, pkgroot, output=None):
@@ -218,36 +223,36 @@ def hs_library_pattern(name, mode = "static", profiling = False):
218223
name = pkg.name,
219224
id = pkg.id,
220225
version = pkg.version,
221-
hdrs = [
222-
"/".join([path_to_label(include_dir, pkgroot, output), header])
226+
hdrs = join_paths([
227+
[path_to_label(include_dir, pkgroot, output), header]
223228
for include_dir in pkg.include_dirs
224229
for header in match_glob(resolve(include_dir, pkgroot), "**/*.h")
225-
],
226-
includes = [
227-
"/".join([repo_dir, path_to_label(include_dir, pkgroot, output)])
230+
]),
231+
includes = join_paths([
232+
[repo_dir, path_to_label(include_dir, pkgroot, output)]
228233
for include_dir in pkg.include_dirs
229-
],
230-
static_libraries = [
231-
"/".join([path_to_label(library_dir, pkgroot, output), library])
234+
]),
235+
static_libraries = join_paths([
236+
[path_to_label(library_dir, pkgroot, output), library]
232237
for hs_library in pkg.hs_libraries
233238
for pattern in hs_library_pattern(hs_library, mode = "static", profiling = False)
234239
for library_dir in pkg.library_dirs
235240
for library in match_glob(resolve(library_dir, pkgroot), pattern)
236-
],
237-
static_profiling_libraries = [
238-
"/".join([path_to_label(library_dir, pkgroot, output), library])
241+
]),
242+
static_profiling_libraries = join_paths([
243+
[path_to_label(library_dir, pkgroot, output), library]
239244
for hs_library in pkg.hs_libraries
240245
for pattern in hs_library_pattern(hs_library, mode = "static", profiling = True)
241246
for library_dir in pkg.library_dirs
242247
for library in match_glob(resolve(library_dir, pkgroot), pattern)
243-
],
244-
shared_libraries = [
245-
"/".join([path_to_label(dynamic_library_dir, pkgroot, output), library])
248+
]),
249+
shared_libraries = join_paths([
250+
[path_to_label(dynamic_library_dir, pkgroot, output), library]
246251
for hs_library in pkg.hs_libraries
247252
for pattern in hs_library_pattern(hs_library, mode = "dynamic", profiling = False)
248253
for dynamic_library_dir in set(pkg.dynamic_library_dirs + pkg.library_dirs)
249254
for library in match_glob(resolve(dynamic_library_dir, pkgroot), pattern)
250-
],
255+
]),
251256
haddock_html = repr(haddock_html),
252257
haddock_interfaces = repr(haddock_interfaces),
253258
deps = pkg.depends,

0 commit comments

Comments
 (0)