Skip to content

Commit e5933fa

Browse files
committed
fasm: patch ignored runtime dependency warnings
see: ngi-nix/ngipkgs#7 (comment) fasm provides two options for runtime parsing: `textx` and ANTLR4. ANTLR4 is: - not immediately in nixpkgs as a C++ runtime with compatible CMake hooks - not easily exposed in the fasm build scripts. There is an Arch Linux specific workaround on an unmerged branch. For the time being, fall back to the flower `textx` parser and patch out the runtime warning: ``` RuntimeWarning: Unable to import fast Antlr4 parser implementation. ImportError: cannot import name tags Falling back to the much slower pure Python textX based parser implementation. Getting the faster antlr parser can normally be done by installing the required dependencies and then reinstalling the fasm package with: pip uninstall pip install -v fasm warn( ``` Thanks for the tip fricklerhandwerk! Signed-off-by: Jack Leightcap <[email protected]>
1 parent bcd1a73 commit e5933fa

File tree

2 files changed

+36
-2
lines changed

2 files changed

+36
-2
lines changed

nix/fasm/default.nix

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,9 @@ buildPythonPackage rec {
3333
hash = "sha256-oC6vSpI9u8gEA2C85k00WdXzpH5GxeqtfNqqMduW5Jg=";
3434
};
3535

36-
patches = map fetchPatchFromAur [
36+
patches = [
37+
./textx-default.patch
38+
] ++ (map fetchPatchFromAur [
3739
{
3840
name = "0001-cmake-install-parse_fasm.so.patch";
3941
sha256 = "sha256-ZEq/hTXjCIkVkWhgCYWtRe3wftdYMNwhNC4KNnBI2Dc=";
@@ -70,7 +72,7 @@ buildPythonPackage rec {
7072
name = "0009-Use-cmake-directly-instead-of-letting-setup.py-try-t.patch";
7173
sha256 = "sha256-/Ay+XjTE7MPcQg5yeo7zuKE2T/tE/P1sIMxgRYeSWNI=";
7274
}
73-
];
75+
]);
7476

7577

7678
nativeBuildInputs = [

nix/fasm/textx-default.patch

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
diff --git a/fasm/parser/__init__.py b/fasm/parser/__init__.py
2+
index edd02e4..9d188e0 100644
3+
--- a/fasm/parser/__init__.py
4+
+++ b/fasm/parser/__init__.py
5+
@@ -22,25 +22,8 @@ from warnings import warn
6+
available = []
7+
""" List of parser submodules available. Strings should match module names. """
8+
9+
-try:
10+
- from fasm.parser.antlr import \
11+
- parse_fasm_filename, parse_fasm_string, implementation
12+
- available.append('antlr')
13+
-except ImportError as e:
14+
- warn(
15+
- """Unable to import fast Antlr4 parser implementation.
16+
- ImportError: {}
17+
-
18+
- Falling back to the much slower pure Python textX based parser
19+
- implementation.
20+
-
21+
- Getting the faster antlr parser can normally be done by installing the
22+
- required dependencies and then reinstalling the fasm package with:
23+
- pip uninstall
24+
- pip install -v fasm
25+
-""".format(e), RuntimeWarning)
26+
- from fasm.parser.textx import \
27+
- parse_fasm_filename, parse_fasm_string, implementation
28+
+from fasm.parser.textx import \
29+
+ parse_fasm_filename, parse_fasm_string, implementation
30+
31+
# The textx parser is available as a fallback.
32+
available.append('textx')

0 commit comments

Comments
 (0)