Skip to content

Commit 5472d32

Browse files
committed
hopefully this works
1 parent 82491b9 commit 5472d32

File tree

1 file changed

+15
-5
lines changed

1 file changed

+15
-5
lines changed

hatch_build.py

Lines changed: 15 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
import os
22
import shutil
33
import sysconfig
4+
from contextlib import suppress
45
from distutils.extension import Extension
56
from glob import glob
67

@@ -33,6 +34,9 @@ def initialize(self, version: str, data: dict):
3334
else:
3435
compiler.add_library_dir.append('.')
3536

37+
compiler.add_include_dir(
38+
os.path.join(sysconfig.get_path("platstdlib"), "lib")
39+
)
3640
compiler.add_include_dir(sysconfig.get_path("include"))
3741
compiler.define_macro("PY_SSIZE_T_CLEAN")
3842

@@ -61,11 +65,17 @@ def initialize(self, version: str, data: dict):
6165
self.app.abort("failed to link _pointers")
6266

6367
self.app.display_success("successfully linked _pointers")
64-
data["force_include"][
65-
os.path.join(lib, "lib_pointers.so")
66-
] = "src/_pointers.so"
67-
data["infer_tag"] = True
68-
data["pure_python"] = False
68+
69+
with suppress(KeyError):
70+
data["force_include"][
71+
os.path.join(lib, "lib_pointers.so")
72+
] = "src/_pointers.so"
73+
74+
with suppress(KeyError):
75+
data["infer_tag"] = True
76+
77+
with suppress(KeyError):
78+
data["pure_python"] = False
6979

7080
def clean(self, *_):
7181
path = os.path.join(self.root, "ext")

0 commit comments

Comments
 (0)