From 90094d13628c5f8c84dda0fad99f196a5f6acaad Mon Sep 17 00:00:00 2001 From: Sergey B Kirpichev Date: Tue, 12 Mar 2024 17:32:49 +0300 Subject: [PATCH 1/2] If wheel has no package directories, use lib_sdir as a suffix --- delocate/delocating.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/delocate/delocating.py b/delocate/delocating.py index 6e540bac..ccf407aa 100644 --- a/delocate/delocating.py +++ b/delocate/delocating.py @@ -543,7 +543,7 @@ def _decide_dylib_bundle_directory( lib_sdir : str, optional Default value for lib sub-directory passed in via :func:`delocate_wheel`. - Ignored if wheel has no package directories. + If wheel has no package directories, used as a suffix. Returns ------- @@ -559,7 +559,7 @@ def _decide_dylib_bundle_directory( # Otherwise, store dylib files in the first package alphabetically. return pjoin(min(package_dirs), lib_sdir) # Otherwise, use an auditwheel-style top-level name. - return pjoin(wheel_dir, f"{package_name}.dylibs") + return pjoin(wheel_dir, f"{package_name}{lib_sdir}") def _make_install_name_ids_unique( From a95f96c92aa89d864be440d43a8ceeb75128294b Mon Sep 17 00:00:00 2001 From: Kyle Benesch <4b796c65+github@gmail.com> Date: Fri, 7 Jun 2024 04:32:30 -0700 Subject: [PATCH 2/2] Document and test suffixes for non-package modules --- Changelog.md | 6 ++++++ delocate/cmd/delocate_wheel.py | 4 +++- delocate/tests/test_wheelies.py | 6 ++++-- 3 files changed, 13 insertions(+), 3 deletions(-) diff --git a/Changelog.md b/Changelog.md index a9b4644a..73de7593 100644 --- a/Changelog.md +++ b/Changelog.md @@ -10,6 +10,12 @@ rules on making a good Changelog. ## [Unreleased] +### Added + +- `delocate-wheel` `--lib-sdir` now changes the suffix of the bundled library + directory. + [#210](https://github.com/matthew-brett/delocate/pull/210) + ### Changed - Improved error message for when a MacOS target version is not met. diff --git a/delocate/cmd/delocate_wheel.py b/delocate/cmd/delocate_wheel.py index 26d0d75e..8d2e1e33 100755 --- a/delocate/cmd/delocate_wheel.py +++ b/delocate/cmd/delocate_wheel.py @@ -40,7 +40,9 @@ action="store", type=str, default=".dylibs", - help="Subdirectory in packages to store copied libraries", + help="Subdirectory in packages to store copied libraries" + "\nFor non-package wheels this will be used as a suffix for the library " + "directory", ) parser.add_argument( "-w", diff --git a/delocate/tests/test_wheelies.py b/delocate/tests/test_wheelies.py index cd60b068..68e0d2d8 100644 --- a/delocate/tests/test_wheelies.py +++ b/delocate/tests/test_wheelies.py @@ -455,12 +455,14 @@ def test_fix_toplevel() -> None: assert ( delocate_wheel( - TOPLEVEL_WHEEL, "out-1.0-cp39-cp39-macosx_10_9_x86_64.whl" + TOPLEVEL_WHEEL, + "out-1.0-cp39-cp39-macosx_10_9_x86_64.whl", + lib_sdir=".suffix_test", ) == stray_libs ) with InWheel("out-1.0-cp39-cp39-macosx_10_9_x86_64.whl") as wheel_path: - assert "fakepkg_toplevel.dylibs" in os.listdir(wheel_path) + assert "fakepkg_toplevel.suffix_test" in os.listdir(wheel_path) @pytest.mark.xfail(sys.platform != "darwin", reason="otool")