From b4fc206a7b4c8cd188b8633b29eeb30015d1aacd Mon Sep 17 00:00:00 2001 From: Alessandro Arzilli Date: Wed, 8 May 2024 19:30:57 +0200 Subject: [PATCH] _scripts: upgrade to python3 (#3716) Upgrade python script to python3 --- _scripts/latestver.py | 8 ++++---- _scripts/test_mac.sh | 2 +- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/_scripts/latestver.py b/_scripts/latestver.py index b8483009..2603a48b 100644 --- a/_scripts/latestver.py +++ b/_scripts/latestver.py @@ -1,6 +1,6 @@ -#!/usr/bin/python +#!/usr/bin/python3 import json -import urllib +import urllib.request import sys import re @@ -19,9 +19,9 @@ def splitver(x): return v ver = sys.argv[1] -d = json.loads(urllib.urlopen('https://go.dev/dl/?mode=json&include=all').read()) +d = json.loads(urllib.request.urlopen('https://go.dev/dl/?mode=json&include=all').read()) ds = sorted(d, reverse=True, key=lambda it: splitver(it['version'][2:])) for x in ds: if x['version'][:len(ver)] == ver: - print x['version'] + print(x['version']) exit(0) diff --git a/_scripts/test_mac.sh b/_scripts/test_mac.sh index 78b21594..53644f34 100644 --- a/_scripts/test_mac.sh +++ b/_scripts/test_mac.sh @@ -25,7 +25,7 @@ if [ "$GOVERSION" = "gotip" ]; then cd - else echo Finding latest patch version for $GOVERSION - GOVERSION=$(python _scripts/latestver.py $GOVERSION) + GOVERSION=$(python3 _scripts/latestver.py $GOVERSION) echo Go $GOVERSION on $ARCH cd $TMPDIR curl -sSL "https://storage.googleapis.com/golang/$GOVERSION.darwin-$ARCH.tar.gz" | tar -xz