-
Notifications
You must be signed in to change notification settings - Fork 245
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
[Python] Exclude relocating packages in homebrew #210
Merged
Merged
Changes from all commits
Commits
Show all changes
8 commits
Select commit
Hold shift + click to select a range
b5c96f9
exclude homebrew and system library
eddyxu 3822e03
cleanup delocate
eddyxu 5350e0d
simplify mkdir
eddyxu 22cd8ed
reenable type tests
eddyxu 2b66f77
self made delocate
eddyxu 39371fc
require wheel dir
eddyxu 27ca0a7
clean up imports
eddyxu 02f2246
add comments
eddyxu File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,69 @@ | ||
#!/usr/bin/env python | ||
|
||
"""Customized Delocate that | ||
|
||
1. Delocate *.dylibs other than arrow | ||
2. Set arrow rpath to be able to load pyarrow installation. | ||
|
||
See | ||
https://github.com/matthew-brett/delocate/blob/master/delocate/cmd/delocate_wheel.py | ||
""" | ||
|
||
import glob | ||
import os | ||
import shutil | ||
from argparse import ArgumentParser | ||
|
||
from delocate import wheel_libs | ||
from delocate.delocating import filter_system_libs | ||
from delocate.tools import add_rpath, get_install_names, set_install_name | ||
from delocate.wheeltools import InWheelCtx | ||
|
||
|
||
def main(): | ||
parser = ArgumentParser() | ||
parser.add_argument("--require-archs", metavar="ARCH") | ||
parser.add_argument("-w", "--wheel-dir", required=True) | ||
parser.add_argument("wheel", nargs="+") | ||
|
||
args = parser.parse_args() | ||
for wheel in args.wheel: | ||
out_dir = args.wheel_dir | ||
out_wheel = wheel | ||
if out_dir: | ||
os.makedirs(out_dir, exist_ok=True) | ||
out_wheel = os.path.join(out_dir, os.path.basename(wheel)) | ||
|
||
lance_lib = [ | ||
p for p in wheel_libs(wheel, ignore_missing=True).keys() if "liblance." in p | ||
][0] | ||
|
||
with InWheelCtx(wheel, out_wheel): | ||
lance_dylib_path = None | ||
lance_dylib_path = os.path.join("lance", os.path.basename(lance_lib)) | ||
shutil.copy(lance_lib, lance_dylib_path) | ||
|
||
install_names = get_install_names(lance_dylib_path) | ||
for name in install_names: | ||
if filter_system_libs(name): | ||
if "protobuf" in name: | ||
shutil.copy(name, os.path.join("lance", os.path.basename(name))) | ||
set_install_name( | ||
lance_dylib_path, | ||
name, | ||
f"@loader_path/{os.path.basename(name)}", | ||
) | ||
else: | ||
set_install_name( | ||
lance_dylib_path, name, f"@rpath/{os.path.basename(name)}" | ||
) | ||
add_rpath(lance_dylib_path, "@rpath/../pyarrow") | ||
|
||
cython_so = glob.glob("lance/lib.cpython*.so")[0] | ||
set_install_name( | ||
cython_so, "@rpath/liblance.dylib", "@loader_path/liblance.dylib" | ||
) | ||
|
||
|
||
if __name__ == "__main__": | ||
main() |
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What happens if out_dir is None? Should this be required?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
fixed.