Skip to content

Commit a69ce56

Browse files
committed
Merge branch 'topic/robustness' into 'master'
Make scripts robust to liblktlang import failures Closes #755 See merge request eng/libadalang/langkit!1000
2 parents abc6bef + 9378a79 commit a69ce56

File tree

2 files changed

+20
-2
lines changed

2 files changed

+20
-2
lines changed

langkit/compile_context.py

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,16 @@
5757

5858
try:
5959
import liblktlang as L
60-
except ImportError:
60+
except (ImportError, OSError):
61+
# ImportError may be raised if liblktlang is not available.
62+
#
63+
# OSError may be raised if liblktlang is available, but the underlying
64+
# dynamic library is missing dependency libraries. This can occur if the
65+
# library was built with one version of the compiler, and then the compiler
66+
# installation gets updated. liblktlang has stale library links and fails
67+
# to load.
68+
#
69+
# In both scenarios, assume liblktlang is not available and continue.
6170
pass
6271

6372

langkit/diagnostics.py

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,16 @@
1818
liblktlang_available = True
1919
try:
2020
import liblktlang as L
21-
except ImportError:
21+
except (ImportError, OSError):
22+
# ImportError may be raised if liblktlang is not available.
23+
#
24+
# OSError may be raised if liblktlang is available, but the underlying
25+
# dynamic library is missing dependency libraries. This can occur if the
26+
# library was built with one version of the compiler, and then the compiler
27+
# installation gets updated. liblktlang has stale library links and fails
28+
# to load.
29+
#
30+
# In both scenarios, assume liblktlang is not available and continue.
2231
liblktlang_available = False
2332

2433

0 commit comments

Comments
 (0)