mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-07-25 12:43:23 +00:00
Merge pull request #79448 from falcon78921/wip-k8s-boilerplate
hack/boilerplate: added regex to strip Python shebang
This commit is contained in:
commit
e74f75a98b
@ -99,7 +99,7 @@ def file_passes(filename, refs, regexs):
|
|||||||
if extension == "go" or extension == "generatego":
|
if extension == "go" or extension == "generatego":
|
||||||
p = regexs["go_build_constraints"]
|
p = regexs["go_build_constraints"]
|
||||||
(data, found) = p.subn("", data, 1)
|
(data, found) = p.subn("", data, 1)
|
||||||
elif extension == "sh":
|
elif extension in ["sh", "py"]:
|
||||||
p = regexs["shebang"]
|
p = regexs["shebang"]
|
||||||
(data, found) = p.subn("", data, 1)
|
(data, found) = p.subn("", data, 1)
|
||||||
|
|
||||||
@ -205,7 +205,7 @@ def get_regexs():
|
|||||||
regexs["date"] = re.compile(get_dates())
|
regexs["date"] = re.compile(get_dates())
|
||||||
# strip // +build \n\n build constraints
|
# strip // +build \n\n build constraints
|
||||||
regexs["go_build_constraints"] = re.compile(r"^(// \+build.*\n)+\n", re.MULTILINE)
|
regexs["go_build_constraints"] = re.compile(r"^(// \+build.*\n)+\n", re.MULTILINE)
|
||||||
# strip #!.* from shell scripts
|
# strip #!.* from scripts
|
||||||
regexs["shebang"] = re.compile(r"^(#!.*\n)\n*", re.MULTILINE)
|
regexs["shebang"] = re.compile(r"^(#!.*\n)\n*", re.MULTILINE)
|
||||||
# Search for generated files
|
# Search for generated files
|
||||||
regexs["generated"] = re.compile( 'DO NOT EDIT' )
|
regexs["generated"] = re.compile( 'DO NOT EDIT' )
|
||||||
|
@ -1,5 +1,3 @@
|
|||||||
#!/usr/bin/env python
|
|
||||||
|
|
||||||
# Copyright YEAR The Kubernetes Authors.
|
# Copyright YEAR The Kubernetes Authors.
|
||||||
#
|
#
|
||||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
Loading…
Reference in New Issue
Block a user