aboutsummaryrefslogtreecommitdiff
path: root/python/tools
diff options
context:
space:
mode:
authorambrosin <ambrosin@google.com>2022-07-05 03:36:13 -0700
committerCopybara-Service <copybara-worker@google.com>2022-07-05 03:37:57 -0700
commit7a4fa64c6bbfd8bf105731e019a312a6930d7e28 (patch)
tree45dd0667bfaa4fa5b5d920c6b3e5ea36ab01a05a /python/tools
parentbdb89bb67dd01416a28d565ed95637ba80ee5b80 (diff)
downloadtink-7a4fa64c6bbfd8bf105731e019a312a6930d7e28.tar.gz
Fixes for Tink Python's create_release.sh script:
- Save a copy of the WORKSPACE before building wheels, and restore it afterwards. - Give ownership of all the files in the Tink Python folder to the non-root user. PiperOrigin-RevId: 459043624
Diffstat (limited to 'python/tools')
-rwxr-xr-xpython/tools/distribution/create_release.sh10
1 files changed, 10 insertions, 0 deletions
diff --git a/python/tools/distribution/create_release.sh b/python/tools/distribution/create_release.sh
index 11de02d98..3de7a12f7 100755
--- a/python/tools/distribution/create_release.sh
+++ b/python/tools/distribution/create_release.sh
@@ -46,6 +46,10 @@ build_linux() {
# https://docs.docker.com/engine/security/trust/content_trust/).
export DOCKER_CONTENT_TRUST=1
+ # We use setup.py to build wheels; setup.py makes changes to the WORKSPACE
+ # file so we save a copy for backup.
+ cp WORKSPACE WORKSPACE.bak
+
# Build binary wheels.
docker run \
--volume "${TINK_PYTHON_ROOT_PATH}/..:/tmp/tink" \
@@ -60,6 +64,12 @@ build_linux() {
"${IMAGE}" \
"${workdir}/tools/distribution/test_linux_binary_wheels.sh"
+ # Restore the original WORKSPACE.
+ mv WORKSPACE.bak WORKSPACE
+
+ # Docker runs as root so we transfer ownership to the non-root user.
+ sudo chown -R "$(id -un):$(id -gn)" "${TINK_PYTHON_ROOT_PATH}"
+
echo "### Building Linux source distribution ###"
local sorted=( $( echo "${PYTHON_VERSIONS[@]}" \
| xargs -n1 | sort -V | xargs ) )