diff --git a/hack/boilerplate/boilerplate.py b/hack/boilerplate/boilerplate.py index f2a47abb5a4..89224186aca 100755 --- a/hack/boilerplate/boilerplate.py +++ b/hack/boilerplate/boilerplate.py @@ -1,4 +1,4 @@ -#!/usr/bin/env python +#!/usr/bin/env python3 # Copyright 2015 The Kubernetes Authors. # @@ -14,8 +14,6 @@ # See the License for the specific language governing permissions and # limitations under the License. -from __future__ import print_function - import argparse import datetime import difflib @@ -231,7 +229,7 @@ def get_regexs(): def main(): regexs = get_regexs() refs = get_refs() - filenames = get_files(refs.keys()) + filenames = get_files(list(refs.keys())) for filename in filenames: if not file_passes(filename, refs, regexs): diff --git a/hack/boilerplate/boilerplate_test.py b/hack/boilerplate/boilerplate_test.py index 66453045f76..389e812a599 100644 --- a/hack/boilerplate/boilerplate_test.py +++ b/hack/boilerplate/boilerplate_test.py @@ -1,4 +1,4 @@ -#!/usr/bin/env python +#!/usr/bin/env python3 # Copyright 2016 The Kubernetes Authors. # @@ -48,5 +48,5 @@ class TestBoilerplate(unittest.TestCase): sys.stdout = old_stdout - self.assertEquals( + self.assertEqual( output, ['././fail.go', '././fail.py']) diff --git a/hack/boilerplate/test/fail.py b/hack/boilerplate/test/fail.py index cbdd06ff8a1..e59627aaa9b 100644 --- a/hack/boilerplate/test/fail.py +++ b/hack/boilerplate/test/fail.py @@ -1,4 +1,4 @@ -#!/usr/bin/env python +#!/usr/bin/env python3 # Copyright 2015 The Kubernetes Authors. # diff --git a/hack/boilerplate/test/pass.py b/hack/boilerplate/test/pass.py index 5b7ce29a25c..0a0f9c9d1ee 100644 --- a/hack/boilerplate/test/pass.py +++ b/hack/boilerplate/test/pass.py @@ -1,4 +1,4 @@ -#!/usr/bin/env python +#!/usr/bin/env python3 # Copyright 2015 The Kubernetes Authors. # diff --git a/hack/verify-flags-underscore.py b/hack/verify-flags-underscore.py index bb3dd2385d5..7d620a09424 100755 --- a/hack/verify-flags-underscore.py +++ b/hack/verify-flags-underscore.py @@ -1,4 +1,4 @@ -#!/usr/bin/env python +#!/usr/bin/env python3 # Copyright 2015 The Kubernetes Authors. # @@ -14,8 +14,6 @@ # See the License for the specific language governing permissions and # limitations under the License. -from __future__ import print_function - import argparse import os import re @@ -107,7 +105,7 @@ def check_underscore_in_flags(rootdir, files): print("Are you certain this flag should not have been declared with an - instead?") l = list(new_excluded_flags) l.sort() - print("%s" % "\n".join(l)) + print(("%s" % "\n".join(l))) sys.exit(1) def main(): diff --git a/hack/verify-publishing-bot.py b/hack/verify-publishing-bot.py index d63521cdd77..1e9f6c69c2b 100755 --- a/hack/verify-publishing-bot.py +++ b/hack/verify-publishing-bot.py @@ -1,4 +1,4 @@ -#!/usr/bin/env python +#!/usr/bin/env python3 # Copyright 2019 The Kubernetes Authors. # @@ -14,8 +14,6 @@ # See the License for the specific language governing permissions and # limitations under the License. -from __future__ import print_function - import fnmatch import os import sys @@ -26,7 +24,7 @@ def get_gomod_dependencies(rootdir, components): all_dependencies = {} for component in components: with open(os.path.join(rootdir, component, "go.mod")) as f: - print(component + " dependencies") + print((component + " dependencies")) all_dependencies[component] = [] lines = list(set(f)) lines.sort() @@ -36,7 +34,7 @@ def get_gomod_dependencies(rootdir, components): continue if ("k8s.io/" + dep + " =>") not in line: continue - print("\t"+dep) + print(("\t"+dep)) if dep not in all_dependencies[component]: all_dependencies[component].append(dep) return all_dependencies @@ -62,7 +60,7 @@ def main(): try: import yaml except ImportError: - print("Please install missing pyyaml module and re-run %s" % sys.argv[0]) + print(("Please install missing pyyaml module and re-run %s" % sys.argv[0])) sys.exit(1) rules_dependencies = get_rules_dependencies(rootdir + rules_file) @@ -95,7 +93,7 @@ def main(): if "go" in branch: raise Exception("go version must not be specified for master branch for destination %s" % rule["destination"]) - print("processing : %s" % rule["destination"]) + print(("processing : %s" % rule["destination"])) if rule["destination"] not in gomod_dependencies: raise Exception("missing go.mod for %s" % rule["destination"]) processed_repos.append(rule["destination"]) @@ -116,7 +114,7 @@ def main(): if not found: raise Exception("Please add %s as a dependency under destination %s in %s" % (dep, rule["destination"], rules_file)) else: - print(" found dependency %s" % dep) + print((" found dependency %s" % dep)) extraDeps = set(processed_deps) - set(gomod_dependencies[rule["destination"]]) if len(extraDeps) > 0: raise Exception("extra dependencies in rules for %s: %s" % (rule["destination"], ','.join(str(s) for s in extraDeps))) diff --git a/staging/src/k8s.io/kubectl/pkg/util/i18n/translations/extract.py b/staging/src/k8s.io/kubectl/pkg/util/i18n/translations/extract.py index f4c3398a2c4..33f9751287c 100644 --- a/staging/src/k8s.io/kubectl/pkg/util/i18n/translations/extract.py +++ b/staging/src/k8s.io/kubectl/pkg/util/i18n/translations/extract.py @@ -1,4 +1,4 @@ -#!/usr/bin/env python +#!/usr/bin/env python3 # Copyright 2017 The Kubernetes Authors. #