Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

If wheel has no package directories, use lib_sdir as a suffix #210

Merged
merged 2 commits into from
Jun 7, 2024
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
6 changes: 6 additions & 0 deletions Changelog.md
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
4 changes: 3 additions & 1 deletion delocate/cmd/delocate_wheel.py
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
4 changes: 2 additions & 2 deletions delocate/delocating.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
-------
Expand All @@ -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(
Expand Down
6 changes: 4 additions & 2 deletions delocate/tests/test_wheelies.py
Original file line number Diff line number Diff line change
Expand Up @@ -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")
Expand Down
Loading