2014-02-07 20:08:32 +01:00
|
|
|
# Copyright 2013-2014 The Rust Project Developers. See the COPYRIGHT
|
2013-01-17 23:28:42 -08:00
|
|
|
# file at the top-level directory of this distribution and at
|
|
|
|
# http://rust-lang.org/COPYRIGHT.
|
|
|
|
#
|
|
|
|
# Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
|
|
|
|
# http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
|
|
|
|
# <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
|
|
|
|
# option. This file may not be copied, modified, or distributed
|
|
|
|
# except according to those terms.
|
|
|
|
|
2014-01-04 21:16:57 +01:00
|
|
|
license1 = """// Copyright """
|
|
|
|
license2 = """ The Rust Project Developers. See the COPYRIGHT
|
2013-01-17 23:28:42 -08:00
|
|
|
// file at the top-level directory of this distribution and at
|
|
|
|
// http://rust-lang.org/COPYRIGHT.
|
|
|
|
//
|
|
|
|
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
|
|
|
|
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
|
|
|
|
// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
|
|
|
|
// option. This file may not be copied, modified, or distributed
|
|
|
|
// except according to those terms.
|
|
|
|
"""
|
|
|
|
|
2014-01-04 21:16:57 +01:00
|
|
|
license3 = """# Copyright """
|
|
|
|
license4 = """ The Rust Project Developers. See the COPYRIGHT
|
2013-01-17 23:28:42 -08:00
|
|
|
# file at the top-level directory of this distribution and at
|
|
|
|
# http://rust-lang.org/COPYRIGHT.
|
|
|
|
#
|
|
|
|
# Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
|
|
|
|
# http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
|
|
|
|
# <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
|
|
|
|
# option. This file may not be copied, modified, or distributed
|
|
|
|
# except according to those terms.
|
|
|
|
"""
|
|
|
|
|
|
|
|
exceptions = [
|
|
|
|
"rt/rust_android_dummy.cpp", # BSD, chromium
|
|
|
|
"rt/rust_android_dummy.h", # BSD, chromium
|
|
|
|
"rt/isaac/randport.cpp", # public domain
|
|
|
|
"rt/isaac/rand.h", # public domain
|
|
|
|
"rt/isaac/standard.h", # public domain
|
2014-12-23 11:53:35 -08:00
|
|
|
"libstd/sync/mpsc/mpsc_queue.rs", # BSD
|
|
|
|
"libstd/sync/mpsc/spsc_queue.rs", # BSD
|
2014-06-12 23:41:48 +02:00
|
|
|
"test/bench/shootout-binarytrees.rs", # BSD
|
2014-09-08 08:43:21 +02:00
|
|
|
"test/bench/shootout-chameneos-redux.rs", # BSD
|
2014-06-08 22:25:49 +02:00
|
|
|
"test/bench/shootout-fannkuch-redux.rs", # BSD
|
2014-09-17 08:44:44 +02:00
|
|
|
"test/bench/shootout-fasta.rs", # BSD
|
2014-09-25 00:31:47 +02:00
|
|
|
"test/bench/shootout-fasta-redux.rs", # BSD
|
2014-07-26 15:06:40 +02:00
|
|
|
"test/bench/shootout-k-nucleotide.rs", # BSD
|
2014-07-01 10:00:27 +02:00
|
|
|
"test/bench/shootout-mandelbrot.rs", # BSD
|
2014-06-05 09:55:49 +02:00
|
|
|
"test/bench/shootout-meteor.rs", # BSD
|
2014-09-07 19:16:55 +02:00
|
|
|
"test/bench/shootout-nbody.rs", # BSD
|
2014-06-07 19:34:29 +02:00
|
|
|
"test/bench/shootout-regex-dna.rs", # BSD
|
2014-09-07 18:09:01 +02:00
|
|
|
"test/bench/shootout-reverse-complement.rs", # BSD
|
2014-09-17 08:33:57 +02:00
|
|
|
"test/bench/shootout-spectralnorm.rs", # BSD
|
2014-07-04 21:39:15 +02:00
|
|
|
"test/bench/shootout-threadring.rs", # BSD
|
2013-01-17 23:28:42 -08:00
|
|
|
]
|
|
|
|
|
|
|
|
def check_license(name, contents):
|
2014-01-04 21:16:57 +01:00
|
|
|
# Whitelist check
|
2013-01-17 23:28:42 -08:00
|
|
|
for exception in exceptions:
|
|
|
|
if name.endswith(exception):
|
|
|
|
return True
|
|
|
|
|
2014-01-04 21:16:57 +01:00
|
|
|
# Xfail check
|
2013-01-17 23:28:42 -08:00
|
|
|
firstlineish = contents[:100]
|
2014-02-07 20:08:32 +01:00
|
|
|
if firstlineish.find("ignore-license") != -1:
|
2013-01-17 23:28:42 -08:00
|
|
|
return True
|
|
|
|
|
2014-01-04 21:16:57 +01:00
|
|
|
# License check
|
|
|
|
boilerplate = contents[:500]
|
|
|
|
if (boilerplate.find(license1) == -1 or boilerplate.find(license2) == -1) and \
|
|
|
|
(boilerplate.find(license3) == -1 or boilerplate.find(license4) == -1):
|
|
|
|
return False
|
2014-02-07 20:08:32 +01:00
|
|
|
return True
|