mirror of
				https://github.com/optim-enterprises-bv/kubernetes.git
				synced 2025-11-03 19:58:17 +00:00 
			
		
		
		
	use python3 in hack
This commit is contained in:
		@@ -1,4 +1,4 @@
 | 
				
			|||||||
#!/usr/bin/env python
 | 
					#!/usr/bin/env python3
 | 
				
			||||||
 | 
					
 | 
				
			||||||
# Copyright 2015 The Kubernetes Authors.
 | 
					# Copyright 2015 The Kubernetes Authors.
 | 
				
			||||||
#
 | 
					#
 | 
				
			||||||
@@ -14,8 +14,6 @@
 | 
				
			|||||||
# See the License for the specific language governing permissions and
 | 
					# See the License for the specific language governing permissions and
 | 
				
			||||||
# limitations under the License.
 | 
					# limitations under the License.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
from __future__ import print_function
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
import argparse
 | 
					import argparse
 | 
				
			||||||
import datetime
 | 
					import datetime
 | 
				
			||||||
import difflib
 | 
					import difflib
 | 
				
			||||||
@@ -231,7 +229,7 @@ def get_regexs():
 | 
				
			|||||||
def main():
 | 
					def main():
 | 
				
			||||||
    regexs = get_regexs()
 | 
					    regexs = get_regexs()
 | 
				
			||||||
    refs = get_refs()
 | 
					    refs = get_refs()
 | 
				
			||||||
    filenames = get_files(refs.keys())
 | 
					    filenames = get_files(list(refs.keys()))
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    for filename in filenames:
 | 
					    for filename in filenames:
 | 
				
			||||||
        if not file_passes(filename, refs, regexs):
 | 
					        if not file_passes(filename, refs, regexs):
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -1,4 +1,4 @@
 | 
				
			|||||||
#!/usr/bin/env python
 | 
					#!/usr/bin/env python3
 | 
				
			||||||
 | 
					
 | 
				
			||||||
# Copyright 2016 The Kubernetes Authors.
 | 
					# Copyright 2016 The Kubernetes Authors.
 | 
				
			||||||
#
 | 
					#
 | 
				
			||||||
@@ -48,5 +48,5 @@ class TestBoilerplate(unittest.TestCase):
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
    sys.stdout = old_stdout
 | 
					    sys.stdout = old_stdout
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    self.assertEquals(
 | 
					    self.assertEqual(
 | 
				
			||||||
        output, ['././fail.go', '././fail.py'])
 | 
					        output, ['././fail.go', '././fail.py'])
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -1,4 +1,4 @@
 | 
				
			|||||||
#!/usr/bin/env python
 | 
					#!/usr/bin/env python3
 | 
				
			||||||
 | 
					
 | 
				
			||||||
# Copyright 2015 The Kubernetes Authors.
 | 
					# Copyright 2015 The Kubernetes Authors.
 | 
				
			||||||
#
 | 
					#
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -1,4 +1,4 @@
 | 
				
			|||||||
#!/usr/bin/env python
 | 
					#!/usr/bin/env python3
 | 
				
			||||||
 | 
					
 | 
				
			||||||
# Copyright 2015 The Kubernetes Authors.
 | 
					# Copyright 2015 The Kubernetes Authors.
 | 
				
			||||||
#
 | 
					#
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -1,4 +1,4 @@
 | 
				
			|||||||
#!/usr/bin/env python
 | 
					#!/usr/bin/env python3
 | 
				
			||||||
 | 
					
 | 
				
			||||||
# Copyright 2015 The Kubernetes Authors.
 | 
					# Copyright 2015 The Kubernetes Authors.
 | 
				
			||||||
#
 | 
					#
 | 
				
			||||||
@@ -14,8 +14,6 @@
 | 
				
			|||||||
# See the License for the specific language governing permissions and
 | 
					# See the License for the specific language governing permissions and
 | 
				
			||||||
# limitations under the License.
 | 
					# limitations under the License.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
from __future__ import print_function
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
import argparse
 | 
					import argparse
 | 
				
			||||||
import os
 | 
					import os
 | 
				
			||||||
import re
 | 
					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?")
 | 
					        print("Are you certain this flag should not have been declared with an - instead?")
 | 
				
			||||||
        l = list(new_excluded_flags)
 | 
					        l = list(new_excluded_flags)
 | 
				
			||||||
        l.sort()
 | 
					        l.sort()
 | 
				
			||||||
        print("%s" % "\n".join(l))
 | 
					        print(("%s" % "\n".join(l)))
 | 
				
			||||||
        sys.exit(1)
 | 
					        sys.exit(1)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
def main():
 | 
					def main():
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -1,4 +1,4 @@
 | 
				
			|||||||
#!/usr/bin/env python
 | 
					#!/usr/bin/env python3
 | 
				
			||||||
 | 
					
 | 
				
			||||||
# Copyright 2019 The Kubernetes Authors.
 | 
					# Copyright 2019 The Kubernetes Authors.
 | 
				
			||||||
#
 | 
					#
 | 
				
			||||||
@@ -14,8 +14,6 @@
 | 
				
			|||||||
# See the License for the specific language governing permissions and
 | 
					# See the License for the specific language governing permissions and
 | 
				
			||||||
# limitations under the License.
 | 
					# limitations under the License.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
from __future__ import print_function
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
import fnmatch
 | 
					import fnmatch
 | 
				
			||||||
import os
 | 
					import os
 | 
				
			||||||
import sys
 | 
					import sys
 | 
				
			||||||
@@ -26,7 +24,7 @@ def get_gomod_dependencies(rootdir, components):
 | 
				
			|||||||
    all_dependencies = {}
 | 
					    all_dependencies = {}
 | 
				
			||||||
    for component in components:
 | 
					    for component in components:
 | 
				
			||||||
        with open(os.path.join(rootdir, component, "go.mod")) as f:
 | 
					        with open(os.path.join(rootdir, component, "go.mod")) as f:
 | 
				
			||||||
            print(component + " dependencies")
 | 
					            print((component + " dependencies"))
 | 
				
			||||||
            all_dependencies[component] = []
 | 
					            all_dependencies[component] = []
 | 
				
			||||||
            lines = list(set(f))
 | 
					            lines = list(set(f))
 | 
				
			||||||
            lines.sort()
 | 
					            lines.sort()
 | 
				
			||||||
@@ -36,7 +34,7 @@ def get_gomod_dependencies(rootdir, components):
 | 
				
			|||||||
                        continue
 | 
					                        continue
 | 
				
			||||||
                    if ("k8s.io/" + dep + " =>") not in line:
 | 
					                    if ("k8s.io/" + dep + " =>") not in line:
 | 
				
			||||||
                        continue
 | 
					                        continue
 | 
				
			||||||
                    print("\t"+dep)
 | 
					                    print(("\t"+dep))
 | 
				
			||||||
                    if dep not in all_dependencies[component]:
 | 
					                    if dep not in all_dependencies[component]:
 | 
				
			||||||
                        all_dependencies[component].append(dep)
 | 
					                        all_dependencies[component].append(dep)
 | 
				
			||||||
    return all_dependencies
 | 
					    return all_dependencies
 | 
				
			||||||
@@ -62,7 +60,7 @@ def main():
 | 
				
			|||||||
    try:
 | 
					    try:
 | 
				
			||||||
        import yaml
 | 
					        import yaml
 | 
				
			||||||
    except ImportError:
 | 
					    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)
 | 
					        sys.exit(1)
 | 
				
			||||||
    rules_dependencies = get_rules_dependencies(rootdir + rules_file)
 | 
					    rules_dependencies = get_rules_dependencies(rootdir + rules_file)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@@ -95,7 +93,7 @@ def main():
 | 
				
			|||||||
        if "go" in branch:
 | 
					        if "go" in branch:
 | 
				
			||||||
            raise Exception("go version must not be specified for master branch for destination %s" % rule["destination"])
 | 
					            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:
 | 
					        if rule["destination"] not in gomod_dependencies:
 | 
				
			||||||
            raise Exception("missing go.mod for %s" % rule["destination"])
 | 
					            raise Exception("missing go.mod for %s" % rule["destination"])
 | 
				
			||||||
        processed_repos.append(rule["destination"])
 | 
					        processed_repos.append(rule["destination"])
 | 
				
			||||||
@@ -116,7 +114,7 @@ def main():
 | 
				
			|||||||
            if not found:
 | 
					            if not found:
 | 
				
			||||||
                raise Exception("Please add %s as a dependency under destination %s in %s" % (dep, rule["destination"], rules_file))
 | 
					                raise Exception("Please add %s as a dependency under destination %s in %s" % (dep, rule["destination"], rules_file))
 | 
				
			||||||
            else:
 | 
					            else:
 | 
				
			||||||
                print("  found dependency %s" % dep)
 | 
					                print(("  found dependency %s" % dep))
 | 
				
			||||||
        extraDeps = set(processed_deps) - set(gomod_dependencies[rule["destination"]])
 | 
					        extraDeps = set(processed_deps) - set(gomod_dependencies[rule["destination"]])
 | 
				
			||||||
        if len(extraDeps) > 0:
 | 
					        if len(extraDeps) > 0:
 | 
				
			||||||
            raise Exception("extra dependencies in rules for %s: %s" % (rule["destination"], ','.join(str(s) for s in extraDeps)))
 | 
					            raise Exception("extra dependencies in rules for %s: %s" % (rule["destination"], ','.join(str(s) for s in extraDeps)))
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -1,4 +1,4 @@
 | 
				
			|||||||
#!/usr/bin/env python
 | 
					#!/usr/bin/env python3
 | 
				
			||||||
 | 
					
 | 
				
			||||||
# Copyright 2017 The Kubernetes Authors.
 | 
					# Copyright 2017 The Kubernetes Authors.
 | 
				
			||||||
#
 | 
					#
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user