-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathlark.patch
46 lines (43 loc) · 1.49 KB
/
lark.patch
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
diff --git a/lark/load_grammar.py b/lark/load_grammar.py
index 362a845..a965fb3 100644
--- a/lark/load_grammar.py
+++ b/lark/load_grammar.py
@@ -9,6 +9,7 @@ from copy import copy, deepcopy
import pkgutil
from ast import literal_eval
from contextlib import suppress
+from importlib import resources
from typing import List, Tuple, Union, Callable, Dict, Optional, Sequence, Generator
from .utils import bfs, logger, classify_bool, is_id_continue, is_id_start, bfs_all_unique, small_factors, OrderedSet
@@ -851,7 +852,9 @@ class FromPackageLoader:
for path in to_try:
full_path = os.path.join(path, grammar_path)
try:
- text: Optional[bytes] = pkgutil.get_data(self.pkg_name, full_path)
+ pkg = ".".join([self.pkg_name] + full_path.split(os.path.sep)[:-1])
+ item = full_path.split(os.path.sep)[-1]
+ text: Optional[bytes] = resources.read_binary(pkg, item)
except IOError as e:
err = e
continue
diff --git a/pyproject.toml b/pyproject.toml
index 8e40e13..ba06996 100644
--- a/pyproject.toml
+++ b/pyproject.toml
@@ -19,7 +19,7 @@ classifiers = [
]
requires-python = ">=3.6"
dependencies = []
-dynamic = ["version"]
+version = "1.1.9"
[project.readme]
text = """
@@ -71,9 +71,6 @@ include-package-data = true
"*" = ["*.lark"]
lark = ["py.typed"]
-[tool.setuptools.dynamic]
-version = {attr = "lark.__version__"}
-
[tool.mypy]
files = "lark"
python_version = "3.6"