Skip to content

Commit

Permalink
use python3, python2 is deprecated
Browse files Browse the repository at this point in the history
Signed-off-by: cpanato <ctadeu@gmail.com>
  • Loading branch information
cpanato committed Jan 27, 2023
1 parent 7fe1831 commit 074ad49
Show file tree
Hide file tree
Showing 10 changed files with 18 additions and 18 deletions.
2 changes: 1 addition & 1 deletion docs/book/src/developers/development.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
5. Install [Kustomize][kustomize]
- `brew install kustomize` on macOS.
- [install instructions](https://kubectl.docs.kubernetes.io/installation/kustomize/) on Windows + WSL2, Linux and macOS.
6. Install Python 3.x or 2.7.x, if neither is already installed.
6. Install Python 3.x, if neither is already installed.
7. Install make.
- `brew install make` on MacOS.
- `sudo apt install make` on Windows + WSL2.
Expand Down
2 changes: 1 addition & 1 deletion hack/boilerplate/boilerplate.py.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/usr/bin/env python
#!/usr/bin/env python3

# Copyright YEAR The Kubernetes Authors.
#
Expand Down
2 changes: 1 addition & 1 deletion hack/boilerplate/boilerplate_test.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/usr/bin/env python
#!/usr/bin/env python3

# Copyright 2016 The Kubernetes Authors.
#
Expand Down
2 changes: 1 addition & 1 deletion hack/boilerplate/test/fail.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/usr/bin/env python
#!/usr/bin/env python3

# Copyright 2015 The Kubernetes Authors.
#
Expand Down
2 changes: 1 addition & 1 deletion hack/boilerplate/test/pass.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/usr/bin/env python
#!/usr/bin/env python3

# Copyright 2015 The Kubernetes Authors.
#
Expand Down
2 changes: 1 addition & 1 deletion hack/checkin_account.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/usr/bin/env python
#!/usr/bin/env python3

# Copyright 2019 The Kubernetes Authors.
#
Expand Down
12 changes: 6 additions & 6 deletions hack/checkout_account.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/usr/bin/env python
#!/usr/bin/env python3

# Copyright 2019 The Kubernetes Authors.
#
Expand All @@ -16,8 +16,8 @@

"""Checks out a gcp account from E2E"""

import urllib
import httplib
from urllib.parse import urlencode
import http.client as httplib
import os
import sys
import json
Expand All @@ -29,7 +29,7 @@

def post_request(host, input_state = "clean"):
conn = httplib.HTTPConnection(host)
conn.request("POST", "/acquire?%s" % urllib.urlencode({
conn.request("POST", "/acquire?%s" % urlencode({
'type': RESOURCE_TYPE,
'owner': USER,
'state': input_state,
Expand All @@ -56,5 +56,5 @@ def post_request(host, input_state = "clean"):
sys.exit("Got invalid response %d: %s" % (status, reason))

body = json.loads(result)
print 'export BOSKOS_RESOURCE_NAME="%s";' % body['name']
print 'export GCP_PROJECT="%s";' % body['name']
print('export BOSKOS_RESOURCE_NAME="%s";' % body['name'])
print('export GCP_PROJECT="%s";' % body['name'])
2 changes: 1 addition & 1 deletion hack/heartbeat_account.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/usr/bin/env python
#!/usr/bin/env python3

# Copyright 2019 The Kubernetes Authors.
#
Expand Down
4 changes: 2 additions & 2 deletions scripts/ci-conformance.sh
Original file line number Diff line number Diff line change
Expand Up @@ -212,7 +212,7 @@ main() {
# Check out the account from Boskos and store the produced environment
# variables in a temporary file.
account_env_var_file="$(mktemp)"
python hack/checkout_account.py 1>"${account_env_var_file}"
python3 hack/checkout_account.py 1>"${account_env_var_file}"
checkout_account_status="${?}"

# If the checkout process was a success then load the account's
Expand All @@ -231,7 +231,7 @@ main() {

# run the heart beat process to tell boskos that we are still
# using the checked out account periodically
python -u hack/heartbeat_account.py >> "$ARTIFACTS/logs/boskos.log" 2>&1 &
python3 -u hack/heartbeat_account.py >> "$ARTIFACTS/logs/boskos.log" 2>&1 &
# shellcheck disable=SC2116
HEART_BEAT_PID=$(echo $!)
fi
Expand Down
6 changes: 3 additions & 3 deletions scripts/ci-e2e.sh
Original file line number Diff line number Diff line change
Expand Up @@ -172,7 +172,7 @@ cleanup() {
fi

# stop boskos heartbeat
[[ -z ${HEART_BEAT_PID:-} ]] || kill -9 "${HEART_BEAT_PID}" || true
kill -9 "${HEART_BEAT_PID}" || true
}

# our exit handler (trap)
Expand Down Expand Up @@ -205,7 +205,7 @@ main() {
# Check out the account from Boskos and store the produced environment
# variables in a temporary file.
account_env_var_file="$(mktemp)"
python hack/checkout_account.py 1>"${account_env_var_file}"
python3 hack/checkout_account.py 1>"${account_env_var_file}"
checkout_account_status="${?}"

# If the checkout process was a success then load the account's
Expand All @@ -224,7 +224,7 @@ main() {

# run the heart beat process to tell boskos that we are still
# using the checked out account periodically
python -u hack/heartbeat_account.py >> "$ARTIFACTS/logs/boskos.log" 2>&1 &
python3 -u hack/heartbeat_account.py >> "$ARTIFACTS/logs/boskos.log" 2>&1 &
# shellcheck disable=SC2116
HEART_BEAT_PID=$(echo $!)
fi
Expand Down

0 comments on commit 074ad49

Please sign in to comment.