|
| 1 | +# |
| 2 | +# delocate_wheel_local.sh |
| 3 | +# |
| 4 | +# The MIT License (MIT) |
| 5 | +# Copyright (c) 2024 dātma, inc™ |
| 6 | +# |
| 7 | +# Permission is hereby granted, free of charge, to any person obtaining a copy of |
| 8 | +# this software and associated documentation files (the "Software"), to deal in |
| 9 | +# the Software without restriction, including without limitation the rights to |
| 10 | +# use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of |
| 11 | +# the Software, and to permit persons to whom the Software is furnished to do so, |
| 12 | +# subject to the following conditions: |
| 13 | +# |
| 14 | +# The above copyright notice and this permission notice shall be included in all |
| 15 | +# copies or substantial portions of the Software. |
| 16 | +# |
| 17 | +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR |
| 18 | +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS |
| 19 | +# FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR |
| 20 | +# COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER |
| 21 | +# IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN |
| 22 | +# CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. |
| 23 | +# |
| 24 | +# Description: Script to delocate wheel by sanitizing native library paths |
| 25 | +# |
| 26 | + |
| 27 | +#!/bin/bash |
| 28 | + |
| 29 | +if [[ $(uname) == "Linux" ]]; then |
| 30 | + exit 0 |
| 31 | +fi |
| 32 | + |
| 33 | +pushd dist |
| 34 | + |
| 35 | +mkdir genomicsdb |
| 36 | +for WHEEL in $(ls *.whl) |
| 37 | +do |
| 38 | + echo "delocating WHEEL=$WHEEL" |
| 39 | + VERSION=$(echo $WHEEL | grep -o cp... | head -n1 | cut -c 3-5) |
| 40 | + LIB=genomicsdb.cpython-$VERSION-darwin.so |
| 41 | + CYTHON_LIB=genomicsdb/$LIB |
| 42 | + rm -fr $CYTHON_LIB |
| 43 | + unzip -j $WHEEL $CYTHON_LIB > /dev/null |
| 44 | + mv $LIB genomicsdb |
| 45 | + ls $CYTHON_LIB > /dev/null |
| 46 | + if [[ $? != 0 ]]; then |
| 47 | + echo "Could not find CYTHON_LIB=$CYTHON_LIB" |
| 48 | + exit 1 |
| 49 | + fi |
| 50 | + install_name_tool -change @rpath/libtiledbgenomicsdb.1.dylib @loader_path/lib/libtiledbgenomicsdb.1.dylib $CYTHON_LIB |
| 51 | + otool -L $CYTHON_LIB |
| 52 | + zip $WHEEL $CYTHON_LIB |
| 53 | +done |
| 54 | +rm -fr genomicsdb |
| 55 | + |
| 56 | +popd |
0 commit comments