Skip to content

Commit

Permalink
Merge pull request #210 from skirpichev/fix-lib-sdir
Browse files Browse the repository at this point in the history
If wheel has no package directories, use lib_sdir as a suffix
  • Loading branch information
HexDecimal authored Jun 7, 2024
2 parents 846f5b5 + a95f96c commit eb8a5bb
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 5 deletions.
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

0 comments on commit eb8a5bb

Please sign in to comment.