Skip to content

Commit 24f9a93

Browse files
committed
etc: licenseck: don't hardcode a specific year
1 parent b432e82 commit 24f9a93

File tree

5 files changed

+20
-59
lines changed

5 files changed

+20
-59
lines changed

src/compiletest/common.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
// Copyright 2012-2013 The Rust Project Developers. See the
2-
// COPYRIGHT file at the top-level directory of this distribution and at
1+
// Copyright 2012-2013 The Rust Project Developers. See the COPYRIGHT
2+
// file at the top-level directory of this distribution and at
33
// http://rust-lang.org/COPYRIGHT.
44
//
55
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or

src/compiletest/header.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
// Copyright 2012-2013 The Rust Project Developers. See the
2-
// COPYRIGHT file at the top-level directory of this distribution and at
1+
// Copyright 2012-2013 The Rust Project Developers. See the COPYRIGHT
2+
// file at the top-level directory of this distribution and at
33
// http://rust-lang.org/COPYRIGHT.
44
//
55
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or

src/compiletest/runtest.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
// Copyright 2012-2013 The Rust Project Developers. See the
2-
// COPYRIGHT file at the top-level directory of this distribution and at
1+
// Copyright 2012-2013 The Rust Project Developers. See the COPYRIGHT
2+
// file at the top-level directory of this distribution and at
33
// http://rust-lang.org/COPYRIGHT.
44
//
55
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or

src/etc/licenseck.py

+12-51
Original file line numberDiff line numberDiff line change
@@ -8,20 +8,8 @@
88
# option. This file may not be copied, modified, or distributed
99
# except according to those terms.
1010

11-
license0 = """\
12-
// Copyright 2012-2013 The Rust Project Developers. See the
13-
// COPYRIGHT file at the top-level directory of this distribution and at
14-
// http://rust-lang.org/COPYRIGHT.
15-
//
16-
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
17-
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
18-
// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
19-
// option. This file may not be copied, modified, or distributed
20-
// except according to those terms.
21-
"""
22-
23-
license1 = """\
24-
// Copyright 2012 The Rust Project Developers. See the COPYRIGHT
11+
license1 = """// Copyright """
12+
license2 = """ The Rust Project Developers. See the COPYRIGHT
2513
// file at the top-level directory of this distribution and at
2614
// http://rust-lang.org/COPYRIGHT.
2715
//
@@ -32,20 +20,8 @@
3220
// except according to those terms.
3321
"""
3422

35-
license2 = """\
36-
// Copyright 2013 The Rust Project Developers. See the COPYRIGHT
37-
// file at the top-level directory of this distribution and at
38-
// http://rust-lang.org/COPYRIGHT.
39-
//
40-
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
41-
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
42-
// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
43-
// option. This file may not be copied, modified, or distributed
44-
// except according to those terms.
45-
"""
46-
47-
license3 = """\
48-
# Copyright 2013 The Rust Project Developers. See the COPYRIGHT
23+
license3 = """# Copyright """
24+
license4 = """ The Rust Project Developers. See the COPYRIGHT
4925
# file at the top-level directory of this distribution and at
5026
# http://rust-lang.org/COPYRIGHT.
5127
#
@@ -56,20 +32,6 @@
5632
# except according to those terms.
5733
"""
5834

59-
license4 = """\
60-
// Copyright 2012-2013 The Rust Project Developers. See the COPYRIGHT
61-
// file at the top-level directory of this distribution and at
62-
// http://rust-lang.org/COPYRIGHT.
63-
//
64-
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
65-
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
66-
// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
67-
// option. This file may not be copied, modified, or distributed
68-
// except according to those terms.
69-
"""
70-
71-
licenses = [license0, license1, license2, license3, license4]
72-
7335
exceptions = [
7436
"rt/rust_android_dummy.cpp", # BSD, chromium
7537
"rt/rust_android_dummy.h", # BSD, chromium
@@ -82,20 +44,19 @@
8244
]
8345

8446
def check_license(name, contents):
85-
valid_license = False
86-
for a_valid_license in licenses:
87-
if contents.startswith(a_valid_license):
88-
valid_license = True
89-
break
90-
if valid_license:
91-
return True
92-
47+
# Whitelist check
9348
for exception in exceptions:
9449
if name.endswith(exception):
9550
return True
9651

52+
# Xfail check
9753
firstlineish = contents[:100]
9854
if firstlineish.find("xfail-license") != -1:
9955
return True
10056

101-
return False
57+
# License check
58+
boilerplate = contents[:500]
59+
if (boilerplate.find(license1) == -1 or boilerplate.find(license2) == -1) and \
60+
(boilerplate.find(license3) == -1 or boilerplate.find(license4) == -1):
61+
return False
62+
return True

src/libsyntax/ext/source_util.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
// Copyright 2012-2013 The Rust Project Developers. See the
2-
// COPYRIGHT file at the top-level directory of this distribution and at
1+
// Copyright 2012-2013 The Rust Project Developers. See the COPYRIGHT
2+
// file at the top-level directory of this distribution and at
33
// http://rust-lang.org/COPYRIGHT.
44
//
55
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or

0 commit comments

Comments
 (0)