Skip to content

Commit

Permalink
Use python3
Browse files Browse the repository at this point in the history
Signed-off-by: Appu Goundan <[email protected]>
  • Loading branch information
loosebazooka committed Jul 19, 2021
1 parent 4e1ef5d commit e51932c
Show file tree
Hide file tree
Showing 3 changed files with 28 additions and 14 deletions.
19 changes: 12 additions & 7 deletions cloudbuild.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -17,17 +17,22 @@ steps:
set -o errexit
set -o xtrace
bazel build --host_force_python=PY2 //package_manager:dpkg_parser.par
# Make sure python points to python3
# perhaps the gcr.io/cloud-marketplace-containers/google/bazel image
# should be doing this though
update-alternatives --install /usr/bin/python python /usr/bin/python3 0
bazel build //package_manager:dpkg_parser.par
# Optional: trigger building package bundles without concurrency to avoid
# flakiness: https://github.com/GoogleContainerTools/distroless/issues/646
bazel build --jobs=1 --host_force_python=PY2 @package_bundle_amd64_debian10//file:packages.bzl
bazel build --jobs=1 --host_force_python=PY2 @package_bundle_arm_debian10//file:packages.bzl
bazel build --jobs=1 --host_force_python=PY2 @package_bundle_arm64_debian10//file:packages.bzl
bazel build --jobs=1 --host_force_python=PY2 @package_bundle_s390x_debian10//file:packages.bzl
bazel build --jobs=1 --host_force_python=PY2 @package_bundle_ppc64le_debian10//file:packages.bzl
bazel build --jobs=1 @package_bundle_amd64_debian10//file:packages.bzl
bazel build --jobs=1 @package_bundle_arm_debian10//file:packages.bzl
bazel build --jobs=1 @package_bundle_arm64_debian10//file:packages.bzl
bazel build --jobs=1 @package_bundle_s390x_debian10//file:packages.bzl
bazel build --jobs=1 @package_bundle_ppc64le_debian10//file:packages.bzl
bazel run --host_force_python=PY2 //:publish
bazel run //:publish
- name: docker
env:
Expand Down
4 changes: 2 additions & 2 deletions package_manager/version_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,11 +27,11 @@ def get_epoch(version_str):

try:
epoch = int(version_str[0:e_index])
except ValueError:
except ValueError as value_error:
raise Exception(
'Corrupt dpkg version %s: epochs can only be ints, and '
'epochless versions cannot use the colon character.' %
version_str)
version_str) from value_error

return epoch, version_str[e_index + 1:]

Expand Down
19 changes: 14 additions & 5 deletions test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -21,17 +21,26 @@ set -o xtrace
buildifier -mode=fix $(find . -name 'BUILD*' -o -name 'WORKSPACE*' -o -name '*.bzl' -type f)
find . -name "*.py" | xargs pylint --disable=R,C

# Make sure python points to python3
PYTHON_VERSION=$(python --version)
if [[ ! $PYTHON_VERSION == Python\ 3* ]];
then
echo "python must point to a python3, currently points to $(readlink -f "$(which python)")"
echo "maybe run: update-alternatives --install /usr/bin/python python /usr/bin/python3"
exit 1
fi

# Bazel build and test
bazel clean --curses=no
bazel build --curses=no //package_manager:dpkg_parser.par

# Optional: trigger building package bundles without concurrency to avoid
# flakiness: https://github.com/GoogleContainerTools/distroless/issues/646
bazel build --jobs=1 --host_force_python=PY2 @package_bundle_amd64_debian10//file:packages.bzl
bazel build --jobs=1 --host_force_python=PY2 @package_bundle_arm_debian10//file:packages.bzl
bazel build --jobs=1 --host_force_python=PY2 @package_bundle_arm64_debian10//file:packages.bzl
bazel build --jobs=1 --host_force_python=PY2 @package_bundle_s390x_debian10//file:packages.bzl
bazel build --jobs=1 --host_force_python=PY2 @package_bundle_ppc64le_debian10//file:packages.bzl
bazel build --jobs=1 @package_bundle_amd64_debian10//file:packages.bzl
bazel build --jobs=1 @package_bundle_arm_debian10//file:packages.bzl
bazel build --jobs=1 @package_bundle_arm64_debian10//file:packages.bzl
bazel build --jobs=1 @package_bundle_s390x_debian10//file:packages.bzl
bazel build --jobs=1 @package_bundle_ppc64le_debian10//file:packages.bzl

bazel build --curses=no //...
# Run all tests not tagged as "manual"
Expand Down

0 comments on commit e51932c

Please sign in to comment.