mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-07-30 15:05:27 +00:00
Merge pull request #8129 from eparis/boilerplate-date
Check if people copy, but do not update the boilerplate
This commit is contained in:
commit
d918651199
@ -1,5 +1,5 @@
|
||||
/*
|
||||
Copyright 2014 The Kubernetes Authors All rights reserved.
|
||||
Copyright YEAR The Kubernetes Authors All rights reserved.
|
||||
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
you may not use this file except in compliance with the License.
|
||||
|
@ -47,11 +47,15 @@ def file_passes(filename, extension, ref, regexs):
|
||||
# trim our file to the same number of lines as the reference file
|
||||
data = data[:len(ref)]
|
||||
|
||||
# Replace all occurances of the regex "2015" with "2014"
|
||||
p = regexs["year"]
|
||||
for d in data:
|
||||
if p.search(d):
|
||||
return False
|
||||
|
||||
# Replace all occurances of the regex "2015|2014" with "YEAR"
|
||||
p = regexs["date"]
|
||||
for i, d in enumerate(data):
|
||||
|
||||
(data[i], found) = p.subn( '2014', d)
|
||||
(data[i], found) = p.subn('YEAR', d)
|
||||
if found != 0:
|
||||
break
|
||||
|
||||
@ -81,6 +85,8 @@ def main():
|
||||
ref = ref_file.read().splitlines()
|
||||
|
||||
regexs = {}
|
||||
# Search for "YEAR" which exists in the boilerplate, but shouldn't in the real thing
|
||||
regexs["year"] = re.compile( 'YEAR' )
|
||||
# dates can be 2014 or 2015, company holder names can be anything
|
||||
regexs["date"] = re.compile( '(2014|2015)' )
|
||||
# strip // +build \n\n build constraints
|
||||
|
2
hooks/boilerplate.py.txt
Executable file → Normal file
2
hooks/boilerplate.py.txt
Executable file → Normal file
@ -1,6 +1,6 @@
|
||||
#!/usr/bin/env python
|
||||
|
||||
# Copyright 2014 The Kubernetes Authors All rights reserved.
|
||||
# Copyright YEAR The Kubernetes Authors All rights reserved.
|
||||
#
|
||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||
# you may not use this file except in compliance with the License.
|
||||
|
@ -1,6 +1,6 @@
|
||||
#!/bin/bash
|
||||
|
||||
# Copyright 2014 The Kubernetes Authors All rights reserved.
|
||||
# Copyright YEAR The Kubernetes Authors All rights reserved.
|
||||
#
|
||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||
# you may not use this file except in compliance with the License.
|
||||
|
Loading…
Reference in New Issue
Block a user