2015-11-25 13:58:17 +00:00
|
|
|
#!/bin/bash
|
2013-11-04 01:39:46 +00:00
|
|
|
cd `dirname $0`
|
|
|
|
|
2015-11-25 13:58:17 +00:00
|
|
|
target=Darwin
|
|
|
|
brew=$HOME/.local
|
|
|
|
python_base=$HOME/python
|
|
|
|
base=$brew/Cellar/python3/3.5.0/Frameworks/Python.framework/Versions/3.5
|
2013-11-04 01:39:46 +00:00
|
|
|
|
2015-11-25 13:58:17 +00:00
|
|
|
if [ ! -e $python_base ]; then
|
|
|
|
echo prepare your installation before creating the distributable version
|
|
|
|
echo read prepare.sh and run it
|
|
|
|
exit 1
|
|
|
|
fi
|
|
|
|
|
|
|
|
rm -rf $target
|
|
|
|
mkdir -p $target/bin $target/lib $target/include
|
2013-11-04 01:39:46 +00:00
|
|
|
|
|
|
|
for bin in \
|
2014-09-30 16:45:12 +00:00
|
|
|
python3 \
|
2015-11-25 13:58:17 +00:00
|
|
|
python3.5 \
|
2013-11-04 01:39:46 +00:00
|
|
|
; do
|
2015-11-25 13:58:17 +00:00
|
|
|
cp -a $python_base/bin/$bin $target/bin/$python_bin
|
2013-11-04 01:39:46 +00:00
|
|
|
done
|
|
|
|
|
|
|
|
for bin in \
|
2014-09-30 16:45:12 +00:00
|
|
|
pip3 \
|
2013-11-04 01:39:46 +00:00
|
|
|
; do
|
2015-11-25 13:58:17 +00:00
|
|
|
sed "s/#\!.*python.*/#\!\/usr\/bin\/env python3/g" bin/$bin > $target/bin/$bin
|
2013-11-04 01:39:46 +00:00
|
|
|
done
|
|
|
|
|
2015-11-25 13:58:17 +00:00
|
|
|
cp -a $base/lib/python3.5 $target/lib/python3.5
|
|
|
|
rm $target/lib/python3.5/site-packages
|
|
|
|
rsync -a lib/python3.5/site-packages/ $target/lib/python3.5/site-packages/
|
|
|
|
cp -a $base/include/python3.5m $target/include/python3.5m
|
|
|
|
rm -r $target/lib/python3.5/test
|
|
|
|
find $target/ -name __pycache__ -type d | xargs rm -r
|
2013-11-04 01:39:46 +00:00
|
|
|
|
|
|
|
for lib in \
|
2015-11-25 13:58:17 +00:00
|
|
|
opt/libxml2/lib/libxml2.2.dylib \
|
|
|
|
opt/libxslt/lib/libexslt.0.dylib \
|
|
|
|
opt/libxslt/lib/libxslt.1.dylib \
|
|
|
|
opt/openssl/lib/libcrypto.1.0.0.dylib \
|
|
|
|
opt/openssl/lib/libssl.1.0.0.dylib \
|
|
|
|
opt/readline/lib/libreadline.6.dylib \
|
|
|
|
opt/sqlite/lib/libsqlite3.0.dylib \
|
|
|
|
opt/xz/lib/liblzma.5.dylib \
|
|
|
|
; do
|
|
|
|
cp -a ./$lib $target/lib/$(basename $lib)
|
|
|
|
done
|
|
|
|
|
|
|
|
for plib in \
|
|
|
|
$target/lib/python3.5/site-packages/lxml/etree.cpython-35m-darwin.so \
|
|
|
|
$target/lib/python3.5/site-packages/lxml/objectify.cpython-35m-darwin.so \
|
|
|
|
$target/lib/python3.5/lib-dynload/_hashlib.cpython-35m-darwin.so \
|
|
|
|
$target/lib/python3.5/lib-dynload/_lzma.cpython-35m-darwin.so \
|
|
|
|
$target/lib/python3.5/lib-dynload/_sqlite3.cpython-35m-darwin.so \
|
|
|
|
$target/lib/python3.5/lib-dynload/_ssl.cpython-35m-darwin.so \
|
|
|
|
$target/lib/python3.5/lib-dynload/readline.cpython-35m-darwin.so \
|
2013-11-04 01:39:46 +00:00
|
|
|
; do
|
2015-11-25 13:58:17 +00:00
|
|
|
for lib in \
|
|
|
|
opt/libxml2/lib/libxml2.2.dylib \
|
|
|
|
opt/libxslt/lib/libexslt.0.dylib \
|
|
|
|
opt/libxslt/lib/libxslt.1.dylib \
|
|
|
|
opt/openssl/lib/libcrypto.1.0.0.dylib \
|
|
|
|
opt/openssl/lib/libssl.1.0.0.dylib \
|
|
|
|
opt/readline/lib/libreadline.6.dylib \
|
|
|
|
opt/sqlite/lib/libsqlite3.0.dylib \
|
|
|
|
opt/xz/lib/liblzma.5.dylib \
|
|
|
|
; do
|
|
|
|
name=$(basename $lib)
|
|
|
|
fullpath=$brew/$lib
|
|
|
|
install_name_tool -change "$fullpath" "@rpath/$name" $plib
|
|
|
|
done
|
|
|
|
otool -L $plib
|
2013-11-04 01:39:46 +00:00
|
|
|
done
|