Skip to content

Commit b2937e4

Browse files
authored
Deploy .conan-libs/ to source dir (#49)
* deploy .conan-libs/ to source dir * wip * debug * wip * use package * use package * use build/.conan-libs
1 parent 9851722 commit b2937e4

5 files changed

Lines changed: 6 additions & 6 deletions

File tree

docs/configuration.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -201,7 +201,7 @@ wheel `.dist-info/licenses/` and sdist PKG-INFO.
201201

202202
When your extension links to Conan-provided shared libraries, the backend:
203203

204-
1. Deploys them to a `.conan-libs/` directory next to the wheel.
204+
1. Deploys them to a `.conan-libs/` directory in the project source root.
205205
2. Patches the extension RPATH so that repair tools can discover and bundle
206206
those libraries.
207207

@@ -225,7 +225,7 @@ automatically on Linux and macOS. On Windows, add this to your `pyproject.toml`:
225225
```toml
226226
[tool.cibuildwheel.windows]
227227
before-all = "pip install delvewheel"
228-
repair-wheel-command = 'delvewheel repair --add-path "{wheel}/../.conan-libs" -w "{dest_dir}" "{wheel}"'
228+
repair-wheel-command = 'delvewheel repair --add-path "{project}/build/.conan-libs" -w "{dest_dir}" "{wheel}"'
229229
```
230230

231231
The `.conan-libs/` directory is a build artifact and can be deleted after the

examples/cibw-example/pyproject.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ repair-wheel-command = "MACOSX_DEPLOYMENT_TARGET=11.0 delocate-wheel --require-a
4343
# before-all installs delvewheel in the runner environment where repair-wheel-command runs.
4444
# before-build would install it in the per-wheel build venv, which is not on the repair PATH.
4545
before-all = "pip install delvewheel"
46-
repair-wheel-command = 'delvewheel repair --add-path "{wheel}/../.conan-libs" -w "{dest_dir}" "{wheel}"'
46+
repair-wheel-command = 'delvewheel repair --add-path "{project}/examples/cibw-example/build/.conan-libs" -w "{dest_dir}" "{wheel}"'
4747

4848
# CONAN_CPYTHON_VERSION for Conan profiles that use cpython-portable (e.g. macOS x86_64)
4949
[[tool.cibuildwheel.overrides]]

pyproject.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"
44

55
[project]
66
name = "conan-py-build"
7-
version = "0.5.0"
7+
version = "0.5.1"
88
description = "A minimal PEP 517 compliant build backend that uses Conan to build Python C/C++ extensions"
99
readme = "README.md"
1010
license = {text = "MIT"}

src/conan_py_build/build.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -514,7 +514,7 @@ def _do_build_wheel(
514514

515515
user_presets_conf = "tools.cmake.cmaketoolchain:user_presets=" # empty = disable CMakeUserPresets.json
516516

517-
runtime_deploy_dir = (wheel_dir / ".conan-libs").resolve()
517+
runtime_deploy_dir = (source_dir / "build" / ".conan-libs").resolve()
518518
if runtime_deploy_dir.exists():
519519
shutil.rmtree(runtime_deploy_dir)
520520
runtime_deploy_dir.mkdir(parents=True)

src/conan_py_build/wheel_deploy.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -95,7 +95,7 @@ def _set_deploy_rpath(staging_dir: Path, deploy_dir: Path) -> None:
9595
return
9696

9797
print(
98-
f"WARNING: Shared libraries deployed to {deploy_dir.name}/. "
98+
f"WARNING: Shared libraries deployed to {deploy_dir}. "
9999
"This wheel is an intermediate artifact — run auditwheel repair (Linux), "
100100
"delocate-wheel (macOS), or delvewheel repair (Windows) before installing or distributing. "
101101
"Local installs may work by accident while that directory exists.",

0 commit comments

Comments
 (0)