Created
December 12, 2018 22:51
-
-
Save matthew-brett/ec2fdd022f478b95ed6d18cf45bc7c62 to your computer and use it in GitHub Desktop.
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
from glob import glob | |
from os.path import dirname, join as pjoin | |
from delocate.tools import (get_install_id, | |
set_install_id, | |
get_install_names, | |
set_install_name) | |
def process_dylib(dylib_path): | |
iid = get_install_id(dylib_path) | |
bad_start = '@executable_path/../lib/' | |
n_bad = len(bad_start) | |
if iid.startswith(bad_start): | |
set_install_id(dylib_path, iid[n_bad:]) | |
for install_name in get_install_names(dylib_path): | |
if install_name.startswith(bad_start): | |
new_name = '@loader_path/' + install_name[n_bad:] | |
set_install_name(dylib_path, install_name, new_name) | |
def get_dylibs(): | |
import savReaderWriter | |
base = dirname(savReaderWriter.__file__) | |
globber = pjoin(base, 'spssio', 'macos', '*.dylib') | |
return glob(globber) | |
def main(): | |
for dylib in get_dylibs(): | |
print('Processing', dylib) | |
process_dylib(dylib) | |
if __name__ == '__main__': | |
main() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment