Merge pull request #18306 from lidizheng/rf-2-strip

Roll forward "Strip Python wheel binary" again
pull/18333/head
Lidi Zheng 6 years ago committed by GitHub
commit c9cfb2eaaf
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 17
      test/distrib/python/test_packages.sh
  2. 22
      tools/run_tests/artifacts/build_package_python.sh

@ -39,6 +39,13 @@ virtualenv "$VIRTUAL_ENV"
PYTHON=$VIRTUAL_ENV/bin/python
"$PYTHON" -m pip install --upgrade six pip
function validate_wheel_hashes() {
for file in "$@"; do
"$PYTHON" -m wheel unpack "$file" --dest-dir /tmp || return 1
done
return 0
}
function at_least_one_installs() {
for file in "$@"; do
if "$PYTHON" -m pip install "$file"; then
@ -49,6 +56,16 @@ function at_least_one_installs() {
}
#
# Validate the files in wheel matches their hashes and size in RECORD
#
if [[ "$1" == "binary" ]]; then
validate_wheel_hashes "${ARCHIVES[@]}"
validate_wheel_hashes "${TOOLS_ARCHIVES[@]}"
fi
#
# Install our distributions in order of dependencies
#

@ -23,6 +23,28 @@ mkdir -p artifacts/
# and we only collect them here to deliver them to the distribtest phase.
cp -r "${EXTERNAL_GIT_ROOT}"/input_artifacts/python_*/* artifacts/ || true
apt-get install -y python-pip
python -m pip install -U pip
python -m pip install -U wheel
strip_binary_wheel() {
WHEEL_PATH="$1"
TEMP_WHEEL_DIR=$(mktemp -d)
python -m wheel unpack "$WHEEL_PATH" -d "$TEMP_WHEEL_DIR"
find "$TEMP_WHEEL_DIR" -name "_protoc_compiler*.so" -exec strip --strip-debug {} ";"
find "$TEMP_WHEEL_DIR" -name "cygrpc*.so" -exec strip --strip-debug {} ";"
WHEEL_FILE=$(basename "$WHEEL_PATH")
DISTRIBUTION_NAME=$(basename "$WHEEL_PATH" | cut -d '-' -f 1)
VERSION=$(basename "$WHEEL_PATH" | cut -d '-' -f 2)
python -m wheel pack "$TEMP_WHEEL_DIR/$DISTRIBUTION_NAME-$VERSION" -d "$TEMP_WHEEL_DIR"
mv "$TEMP_WHEEL_DIR/$WHEEL_FILE" "$WHEEL_PATH"
}
for wheel in artifacts/*.whl; do
strip_binary_wheel "$wheel"
done
# TODO: all the artifact builder configurations generate a grpcio-VERSION.tar.gz
# source distribution package, and only one of them will end up
# in the artifacts/ directory. They should be all equivalent though.

Loading…
Cancel
Save