From 452c7be40e5e806cf6fa54e5d680da621111b18a Mon Sep 17 00:00:00 2001 From: James McClune Date: Wed, 26 Jun 2019 18:07:07 -0400 Subject: [PATCH] hack/boilerplate: added regex to strip Python shebang Fixes Prow Build Error: Boilerplate header is wrong for: /home/prow/go/src/k8s.io/kubernetes/hack/update_owners.py Signed-off-by: James McClune --- hack/boilerplate/boilerplate.py | 4 ++-- hack/boilerplate/boilerplate.py.txt | 2 -- 2 files changed, 2 insertions(+), 4 deletions(-) diff --git a/hack/boilerplate/boilerplate.py b/hack/boilerplate/boilerplate.py index cabbaa71e88..efba05bf8dc 100755 --- a/hack/boilerplate/boilerplate.py +++ b/hack/boilerplate/boilerplate.py @@ -99,7 +99,7 @@ def file_passes(filename, refs, regexs): if extension == "go" or extension == "generatego": p = regexs["go_build_constraints"] (data, found) = p.subn("", data, 1) - elif extension == "sh": + elif extension in ["sh", "py"]: p = regexs["shebang"] (data, found) = p.subn("", data, 1) @@ -205,7 +205,7 @@ def get_regexs(): regexs["date"] = re.compile(get_dates()) # strip // +build \n\n build constraints 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) # Search for generated files regexs["generated"] = re.compile( 'DO NOT EDIT' ) diff --git a/hack/boilerplate/boilerplate.py.txt b/hack/boilerplate/boilerplate.py.txt index a2e72e5988e..384f325abf3 100644 --- a/hack/boilerplate/boilerplate.py.txt +++ b/hack/boilerplate/boilerplate.py.txt @@ -1,5 +1,3 @@ -#!/usr/bin/env python - # Copyright YEAR The Kubernetes Authors. # # Licensed under the Apache License, Version 2.0 (the "License");