aboutsummaryrefslogtreecommitdiff
path: root/python/tools
diff options
context:
space:
mode:
authorambrosin <ambrosin@google.com>2022-06-22 06:52:13 -0700
committerCopybara-Service <copybara-worker@google.com>2022-06-22 06:53:31 -0700
commit6e14f7c3c5ca1046964d1fba0d57d675e9e53e61 (patch)
treeabe8e3bab6d90853c5f99217fb6c177fd13c63fa /python/tools
parente3b3313230d38e99db076e0d868a248fd877b3a7 (diff)
downloadtink-6e14f7c3c5ca1046964d1fba0d57d675e9e53e61.tar.gz
Refactor Tink Python testdata path helper function
- Replace `TINK_SRC_PATH` with the more specific `TINK_PYTHON_ROOT_PATH`; testing/helper.py expects the root of the Tink Python folder (e.g., which for github.com/google/tink this is tink/python). - Modify `tink_py_testdata_path` to raise an exception if an environment variable is set but the path is invalid rather than fallback. - Update kokoro test scripts and release scripts accordingly. - Remove redundant options from `tink_py_testdata_path` and the Google internal path. PiperOrigin-RevId: 456502202
Diffstat (limited to 'python/tools')
-rwxr-xr-xpython/tools/distribution/build_linux_binary_wheels.sh6
-rwxr-xr-xpython/tools/distribution/create_release.sh10
-rwxr-xr-xpython/tools/distribution/test_linux_binary_wheels.sh2
3 files changed, 9 insertions, 9 deletions
diff --git a/python/tools/distribution/build_linux_binary_wheels.sh b/python/tools/distribution/build_linux_binary_wheels.sh
index 1ff44335d..133084392 100755
--- a/python/tools/distribution/build_linux_binary_wheels.sh
+++ b/python/tools/distribution/build_linux_binary_wheels.sh
@@ -34,9 +34,9 @@ PYTHON_VERSIONS["3.9"]="cp39-cp39"
PYTHON_VERSIONS["3.10"]="cp310-cp310"
readonly -A PYTHON_VERSIONS
-readonly TINK_SRC_PATH="/tmp/tink"
+readonly TINK_PYTHON_ROOT_PATH="/tmp/tink/python"
-readonly BAZEL_VERSION="$(cat "${TINK_SRC_PATH}/python/.bazelversion")"
+readonly BAZEL_VERSION="$(cat ${TINK_PYTHON_ROOT_PATH}/.bazelversion)"
readonly PROTOC_VERSION="3.19.3"
# Get dependencies which are needed for building Tink.
@@ -52,7 +52,7 @@ curl -OL "https://github.com/protocolbuffers/protobuf/releases/download/v${PROTO
unzip -o "${PROTOC_ZIP}" -d /usr/local bin/protoc
# Setup required for Tink.
-export TINK_PYTHON_SETUPTOOLS_OVERRIDE_BASE_PATH="${TINK_SRC_PATH}"
+export TINK_PYTHON_SETUPTOOLS_OVERRIDE_BASE_PATH="${TINK_PYTHON_ROOT_PATH}/.."
# Workaround for grpc which expects a python2 installation, which is not present
# in the manylinux2014 container. Cannot be an empty string, otherwise Bazel
diff --git a/python/tools/distribution/create_release.sh b/python/tools/distribution/create_release.sh
index ff18bcd45..f35c00c0e 100755
--- a/python/tools/distribution/create_release.sh
+++ b/python/tools/distribution/create_release.sh
@@ -29,8 +29,8 @@ readonly PYTHON_VERSIONS
readonly PLATFORM="$(uname | tr '[:upper:]' '[:lower:]')"
-export TINK_SRC_PATH="${PWD}/.."
-readonly TINK_VERSION="$(grep ^TINK "${TINK_SRC_PATH}/python/VERSION" \
+export TINK_PYTHON_ROOT_PATH="${PWD}"
+readonly TINK_VERSION="$(grep ^TINK "${TINK_PYTHON_ROOT_PATH}/VERSION" \
| awk '{gsub(/"/, "", $3); print $3}')"
readonly IMAGE_NAME="quay.io/pypa/manylinux2014_x86_64"
@@ -45,11 +45,11 @@ build_linux() {
export DOCKER_CONTENT_TRUST=1
# Build binary wheels.
- docker run --volume "${TINK_SRC_PATH}:/tmp/tink" --workdir /tmp/tink/python \
+ docker run --volume "${TINK_PYTHON_ROOT_PATH}/..:/tmp/tink" --workdir /tmp/tink/python \
"${IMAGE}" /tmp/tink/python/tools/distribution/build_linux_binary_wheels.sh
## Test binary wheels.
- docker run --volume "${TINK_SRC_PATH}:/tmp/tink" --workdir /tmp/tink/python \
+ docker run --volume "${TINK_PYTHON_ROOT_PATH}/..:/tmp/tink" --workdir /tmp/tink/python \
"${IMAGE}" /tmp/tink/python/tools/distribution/test_linux_binary_wheels.sh
echo "### Building Linux source distribution ###"
@@ -59,7 +59,7 @@ build_linux() {
enable_py_version "${latest}"
# Build source distribution.
- export TINK_PYTHON_SETUPTOOLS_OVERRIDE_BASE_PATH="${TINK_SRC_PATH}"
+ export TINK_PYTHON_SETUPTOOLS_OVERRIDE_BASE_PATH="${TINK_PYTHON_ROOT_PATH}/.."
python3 setup.py sdist
local sdist_filename="tink-${TINK_VERSION}.tar.gz"
set_owner_within_tar "dist/${sdist_filename}"
diff --git a/python/tools/distribution/test_linux_binary_wheels.sh b/python/tools/distribution/test_linux_binary_wheels.sh
index b4e80db36..5b2e89271 100755
--- a/python/tools/distribution/test_linux_binary_wheels.sh
+++ b/python/tools/distribution/test_linux_binary_wheels.sh
@@ -36,7 +36,7 @@ readonly -A PYTHON_VERSIONS
# Keep in sync with the output of the auditwheel tool.
readonly PLATFORM_TAG_SET="manylinux_2_17_x86_64.manylinux2014_x86_64"
-export TINK_SRC_PATH="/tmp/tink"
+export TINK_PYTHON_ROOT_PATH="/tmp/tink/python"
# Required to fix https://github.com/pypa/manylinux/issues/357.
export LD_LIBRARY_PATH="/usr/local/lib"