Skip to content

Commit cf6333a

Browse files
Merge pull request #143 from alliander-opensource/fix/options-in-build-extension
Fix some options in the build step
2 parents 5c5deb6 + a4d1835 commit cf6333a

File tree

2 files changed

+3
-15
lines changed

2 files changed

+3
-15
lines changed

pyproject.toml

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -21,9 +21,6 @@ readme = "README.md"
2121
license = { text = "MPL-2.0" }
2222
classifiers = [
2323
"Programming Language :: Python :: 3",
24-
"Programming Language :: Python :: 3.8",
25-
"Programming Language :: Python :: 3.9",
26-
"Programming Language :: Python :: 3.10",
2724
"Programming Language :: Python :: Implementation :: CPython",
2825
"Programming Language :: C++",
2926
"Programming Language :: Cython",
@@ -101,7 +98,7 @@ manylinux-aarch64-image = "manylinux2014"
10198
[tool.cibuildwheel.macos]
10299
build = ["cp*-macosx_*"]
103100
archs = ["x86_64", "arm64"]
104-
environment = { CC="clang", CXX="clang++", MACOSX_DEPLOYMENT_TARGET="10.15" }
101+
environment = { CC="clang", CXX="clang++" }
105102
# Skip trying to test arm64 builds on Intel Macs
106103
test-skip = ["*-macosx_arm64", "*-macosx_universal2:arm64"]
107104

setup.py

Lines changed: 2 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -129,6 +129,8 @@ def generate_build_ext(pkg_dir: Path, pkg_name: str):
129129
"-fvisibility=hidden",
130130
]
131131
lflags += ["-lpthread", "-O3"]
132+
# for linux/macos add visibility to the init function
133+
define_macros.append(("PyMODINIT_FUNC", 'extern "C" __attribute__((visibility ("default"))) PyObject*'))
132134
# # extra flag for Mac
133135
if platform.system() == "Darwin":
134136
# compiler flag to set version
@@ -145,17 +147,6 @@ def generate_build_ext(pkg_dir: Path, pkg_name: str):
145147
cython_src_cpp = [x.with_suffix(".cpp") for x in cython_src]
146148
print("Generated cpp files")
147149
print(cython_src_cpp)
148-
# for linux add visibility to the init function
149-
if not if_win:
150-
for cpp_src in cython_src_cpp:
151-
with open(cpp_src) as f:
152-
cpp_code = f.read()
153-
cpp_code_modified = cpp_code.replace(
154-
"#define __Pyx_PyMODINIT_FUNC PyMODINIT_FUNC",
155-
'#define __Pyx_PyMODINIT_FUNC extern "C" __attribute__((visibility ("default"))) PyObject* ',
156-
)
157-
with open(cpp_src, "w") as f:
158-
f.write(cpp_code_modified)
159150

160151
# list of extensions of generated cpp files from cython
161152
exts = [

0 commit comments

Comments
 (0)