Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 0 additions & 2 deletions .github/workflows/build-wheel-release-upload.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,6 @@ name: Release (GitHub/PyPI) and Deploy Docs
on:
workflow_dispatch:
push:
branches:
- "**"
tags:
- "*" # Trigger on all tags initially, but tag and release privilege are verified in _build-wheel-release-upload.yml

Expand Down
1 change: 1 addition & 0 deletions MANIFEST.in
Original file line number Diff line number Diff line change
Expand Up @@ -11,3 +11,4 @@ global-exclude .DS_Store # Exclude Mac filesystem artifacts.
global-exclude __pycache__ # Exclude Python cache directories.
global-exclude .git* # Exclude git files and directories.
global-exclude .idea # Exclude PyCharm project settings.
global-exclude SConscript.configure SConscript # SCons build scripts
1 change: 1 addition & 0 deletions requirements/pip.txt
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
setuptools
numpy
44 changes: 31 additions & 13 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,14 +20,31 @@


def get_boost_libraries():
base_lib = "boost_python"
major, minor = str(sys.version_info[0]), str(sys.version_info[1])
tags = [f"{major}{minor}", major, ""]
mttags = ["", "-mt"]
candidates = [base_lib + tag for tag in tags for mt in mttags] + [base_lib]
for lib in candidates:
if find_library(lib):
return [lib]
# the names we'll search for
major, minor = sys.version_info[:2]
candidates = [
f"boost_python{major}{minor}",
f"boost_python{major}",
"boost_python",
]

conda_prefix = os.environ.get("CONDA_PREFIX")
if conda_prefix:
libdir = os.path.join(conda_prefix, "lib")
for name in candidates:
so = f"lib{name}.so"
if os.path.isfile(os.path.join(libdir, so)):
# return the plain "boost_python311" etc (no "lib" prefix or ".so")
return [name]

# fallback to ldconfig
for name in candidates:
found = find_library(name)
if found:
# find_library may return "libboost_python3.so.1.74.0" etc
# strip off lib*.so.* if you like, or just return name
return [name]

raise RuntimeError("Cannot find a suitable Boost.Python library.")


Expand Down Expand Up @@ -92,10 +109,11 @@ def create_extensions():
return [ext]


setup_args = dict(
ext_modules=[],
)
def ext_modules():
if set(sys.argv) & {"build_ext", "bdist_wheel", "install"}:
return create_extensions()
return []


if __name__ == "__main__":
setup_args["ext_modules"] = create_extensions()
setup(**setup_args)
setup(ext_modules=ext_modules())
Loading