Skip to content

Commit 4167eb1

Browse files
author
Peter Bengtsson
authored
clean up license preambles (mozilla-services#51)
1 parent 6d3e81b commit 4167eb1

File tree

10 files changed

+92
-0
lines changed

10 files changed

+92
-0
lines changed

bin/sanspreamble

+49
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
#!/usr/bin/env python
2+
3+
# This Source Code Form is subject to the terms of the Mozilla Public
4+
# License, v. 2.0. If a copy of the MPL was not distributed with this
5+
# file, you can obtain one at http://mozilla.org/MPL/2.0/.
6+
7+
import os
8+
import itertools
9+
import subprocess
10+
11+
12+
def run():
13+
14+
exceptions = (
15+
'docs/conf.py',
16+
'tests/blockade.py',
17+
'setup.py',
18+
)
19+
20+
alreadies = subprocess.check_output([
21+
'git', 'grep',
22+
'This Source Code Form is subject to the terms of the Mozilla Public'
23+
]).splitlines()
24+
alreadies = [x.split(':')[0] for x in alreadies]
25+
26+
out = subprocess.check_output(['git', 'ls-files']).splitlines()
27+
28+
suspect = []
29+
for fp in out:
30+
if fp in alreadies:
31+
continue
32+
if not os.stat(fp).st_size:
33+
continue
34+
if fp in exceptions:
35+
continue
36+
if True in itertools.imap(fp.endswith, ('.py', '.js')):
37+
suspect.append(fp)
38+
39+
for i, fp in enumerate(suspect):
40+
if not i:
41+
print('The following appear to lack a license preamble:'.upper())
42+
print(fp)
43+
44+
return len(suspect)
45+
46+
47+
if __name__ == '__main__':
48+
import sys
49+
sys.exit(run())

docs/dev.rst

+9
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,15 @@ All code files need to start with the MPLv2 header::
1111
# License, v. 2.0. If a copy of the MPL was not distributed with this
1212
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
1313

14+
To check if any file is lacking a license preamble, run:
15+
16+
.. code-block:: shell
17+
18+
$ ./bin/sanspreamble
19+
20+
It will exit non-zero if there are files lacking the preamble. It only
21+
checks git checked in files.
22+
1423
PEP8 is nice. All files are expected to be PEP8 and pyflakes compliant
1524
and the PEP8 rules (and exceptions) are defined in ``setup.cfg`` under
1625
the ``[flake8]`` heading.

manage.py

+5
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,9 @@
11
#!/usr/bin/env python
2+
3+
# This Source Code Form is subject to the terms of the Mozilla Public
4+
# License, v. 2.0. If a copy of the MPL was not distributed with this
5+
# file, you can obtain one at http://mozilla.org/MPL/2.0/.
6+
27
import os
38
import sys
49

metricsapp/src/App.js

+4
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
1+
/* This Source Code Form is subject to the terms of the Mozilla Public
2+
License, v. 2.0. If a copy of the MPL was not distributed with this
3+
file, you can obtain one at http://mozilla.org/MPL/2.0/. */
4+
15
import React, { Component } from 'react'
26
import { Line } from 'react-chartjs-2'
37
import './App.css'

metricsapp/src/App.test.js

+4
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
1+
/* This Source Code Form is subject to the terms of the Mozilla Public
2+
License, v. 2.0. If a copy of the MPL was not distributed with this
3+
file, you can obtain one at http://mozilla.org/MPL/2.0/. */
4+
15
import React from 'react';
26
import ReactDOM from 'react-dom';
37
import App from './App';

metricsapp/src/index.js

+4
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
1+
/* This Source Code Form is subject to the terms of the Mozilla Public
2+
License, v. 2.0. If a copy of the MPL was not distributed with this
3+
file, you can obtain one at http://mozilla.org/MPL/2.0/. */
4+
15
import React from 'react';
26
import ReactDOM from 'react-dom';
37
import App from './App';

tecken/markus_extra.py

+4
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
1+
# This Source Code Form is subject to the terms of the Mozilla Public
2+
# License, v. 2.0. If a copy of the MPL was not distributed with this
3+
# file, you can obtain one at http://mozilla.org/MPL/2.0/.
4+
15
from django.core.cache import cache
26
from django.conf import settings
37

test-with-nginx/generate.py

+5
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,9 @@
11
#!/usr/bin/env python
2+
3+
# This Source Code Form is subject to the terms of the Mozilla Public
4+
# License, v. 2.0. If a copy of the MPL was not distributed with this
5+
# file, you can obtain one at http://mozilla.org/MPL/2.0/.
6+
27
from __future__ import print_function
38

49
import sys

tests/conftest.py

+4
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
1+
# This Source Code Form is subject to the terms of the Mozilla Public
2+
# License, v. 2.0. If a copy of the MPL was not distributed with this
3+
# file, you can obtain one at http://mozilla.org/MPL/2.0/.
4+
15
import json
26

37
import pytest

tests/test_dockerflow_extra.py

+4
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
1+
# This Source Code Form is subject to the terms of the Mozilla Public
2+
# License, v. 2.0. If a copy of the MPL was not distributed with this
3+
# file, you can obtain one at http://mozilla.org/MPL/2.0/.
4+
15
from tecken.dockerflow_extra import check_redis_store_connected
26

37

0 commit comments

Comments
 (0)