Skip to content

Instantly share code, notes, and snippets.

@joerick
Last active May 8, 2018 04:57
Show Gist options
  • Save joerick/3efcfb4fa5bae29e343612ce9824b7e3 to your computer and use it in GitHub Desktop.
Save joerick/3efcfb4fa5bae29e343612ce9824b7e3 to your computer and use it in GitHub Desktop.
patch-python-macos-openssl wheel build
#!/bin/bash
set -o errexit
set -o xtrace
version=0.1
package_name=patch_python_macos_openssl
tag=cp27-cp27m-macosx_10_6_intel
wheel_root=$package_name-$version
info_dir=$wheel_root/$package_name-$version.dist-info
mkdir -p $wheel_root/_ssl_lib
cp lib/libcrypto.1.0.0.dylib $wheel_root/_ssl_lib
cp lib/libssl.1.0.0.dylib $wheel_root/_ssl_lib
cp lib/python3.4/lib-dynload/_ssl.so $wheel_root
# do some work with install_name_tool here to rewrite the paths from
# _ssl.so to the dynamic libraries
# e.g.
# install_name_tool -change /Library/Frameworks/Python.framework/Versions/3.4/lib/libssl.1.0.0.dylib @rpath/_ssl_lib/libssl.1.0.0.dylib patch_python_macos_openssl-0.1/_ssl.so
mkdir -p $info_dir
cat > $info_dir/WHEEL <<EOF
Wheel-Version: 1.0
Generator: $package_name
Root-Is-Purelib: false
Tag: $tag
EOF
cat > $info_dir/METADATA <<EOF
Metadata-Version: 2.1
Name: $package_name
Version: $version
License: UNKNOWN
Platform: UNKNOWN
UNKNOWN
EOF
cat > $info_dir/RECORD <<EOF
_ssl.so,,
_ssl_lib/libcrypto.1.0.0.dylib,,
_ssl_lib/libssl.1.0.0.dylib,,
$package_name-$version.dist-info/WHEEL,,
$package_name-$version.dist-info/METADATA,,
$package_name-$version.dist-info/RECORD,,
EOF
ditto -ck $wheel_root $package_name-$version-$tag.whl
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment