Skip to content

Commit

Permalink
Import 'pybind11' instead running of a subprocess
Browse files Browse the repository at this point in the history
  • Loading branch information
jacquev6 committed Jun 12, 2024
1 parent 1703d04 commit 148947e
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 14 deletions.
12 changes: 6 additions & 6 deletions .github/workflows/build-topics-test-gha-branch.yml
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ jobs:
with:
python-version: ${{ matrix.python_version }}
- name: Install Python packages
run: pip${{ matrix.python_version }} install auditwheel build Chrones pybind11 twine
run: pip${{ matrix.python_version }} install auditwheel build Chrones pybind11 twine wheel
- name: Install CUDA
run: |
sudo apt-key adv --fetch-keys https://developer.download.nvidia.com/compute/cuda/repos/ubuntu2004/x86_64/3bf863cc.pub
Expand Down Expand Up @@ -87,7 +87,7 @@ jobs:
rm *.tar.gz
- name: Build the wheel
run: python${{ matrix.python_version }} -m build --wheel --outdir local-dist lincs-*
run: python${{ matrix.python_version }} -m build --no-isolation --wheel --outdir local-dist lincs-*
env:
LINCS_DEV_FORCE_NVCC: "true"
LINCS_DEV_FORCE_CHRONES: "true"
Expand Down Expand Up @@ -115,7 +115,7 @@ jobs:
with:
python-version: ${{ matrix.python_version }}
- name: Install Python packages
run: pip install build delvewheel pybind11 twine
run: pip install build delvewheel pybind11 twine wheel
- name: Install CUDA
uses: Jimver/[email protected]
id: cuda-toolkit
Expand Down Expand Up @@ -173,7 +173,7 @@ jobs:
rm *.tar.gz
- name: Build the wheel
run: python -m build --wheel --outdir local-dist (get-item lincs-*)
run: python -m build --no-isolation --wheel --outdir local-dist (get-item lincs-*)
env:
LINCS_DEV_FORCE_NVCC: "true"
LINCS_DEV_DEPENDENCIES: d:\lincs-deps
Expand Down Expand Up @@ -204,7 +204,7 @@ jobs:
with:
python-version: ${{ matrix.python_version }}
- name: Install Python packages
run: pip3 install build delocate pybind11 twine
run: pip3 install build delocate pybind11 twine wheel
- name: Install OpenMP
run: |
cd /Users/runner/work
Expand Down Expand Up @@ -246,7 +246,7 @@ jobs:
rm *.tar.gz
- name: Build the wheel
run: python3 -m build --wheel --outdir local-dist lincs-*
run: python3 -m build --no-isolation --wheel --outdir local-dist lincs-*
- name: Make the wheel machine-independent
run: delocate-wheel --wheel-dir dist local-dist/*.whl
- name: Check the wheel
Expand Down
13 changes: 5 additions & 8 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -225,14 +225,11 @@ def make_liblincs_extension():
print("WARNING: 'chrones' was not found, lincs will be compiled without Chrones", file=sys.stderr)

try:
include_dirs += [
option[2:]
for option in subprocess.run(
[sys.executable, "-m", "pybind11", "--includes"], capture_output=True, universal_newlines=True, check=True,
).stdout.strip().split(" ")
]
except subprocess.CalledProcessError:
print("WARNING: 'pybind11' was not found, compilation will fail", file=sys.stderr)
import pybind11
except ImportError:
print("WARNING: 'pybind11' was not found, compilation will fail. (Source distribution is OK)", file=sys.stderr)
else:
include_dirs += [pybind11.get_include()]

if sys.platform == "linux":
extra_compile_args["c++"] = ["-std=c++17", "-Werror=switch", "-fopenmp"]
Expand Down

0 comments on commit 148947e

Please sign in to comment.