You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: docs/source/how-to-guides/add_new_license.rst
+63-18Lines changed: 63 additions & 18 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -6,30 +6,75 @@ How To Add a New License for Detection
6
6
How to add a new license for detection?
7
7
---------------------------------------
8
8
9
-
To add new license, you first need to select a new and unique license key (mit
10
-
and gpl-2.0 are some of the existing license keys). All licenses are stored as
11
-
plain text files in the src/licensedcode/data/licenses directory using their key
12
-
as base for the file name(s).
9
+
To add new license, you first need to select a new and unique license `key` (mit
10
+
and gpl-2.0 are some of the existing license keys).
13
11
14
-
You need to create a pair of files:
12
+
The key name can contain only these symbols:
15
13
16
-
- a file with the text of the license saved in a plain text file named
17
-
key.LICENSE
14
+
- lowercase letters from a to z,
15
+
- numbers from 0 to 9,and
16
+
- dash - and . period signs. No spaces or underscore.
18
17
19
-
- a small text data file (in YAML format) named key.yml that contains license
20
-
information such as::
18
+
The license key also has to be less than 50 characters (same for `short_name`).
21
19
22
-
key: my-license
23
-
name: My License
20
+
We also have to add a `spdx_license_key` which is either a valid SPDX license key at
21
+
` The SPDX license list <https://spdx.org/licenses/>`_, or a `Licenseref-scancode-<key>`.
24
22
25
-
The key name can contain only these symbols:
23
+
All licenses are stored as a plain text file in the `src/licensedcode/data/licenses`
24
+
directory using their key as base for the file name. I.e. the filename for a license
25
+
with `key: mit` would be `mit.LICENSE`.
26
26
27
-
- lowercase letters from a to z,
28
-
- numbers from 0 to 9,and
29
-
- dash - and . period signs. No spaces.
27
+
You need to create a file with:
28
+
29
+
- the text of the license saved in plain text. We usually get rid of HTML tags or
30
+
other special characters, copyrights and only keep the original text as is,
31
+
with the original formatting intact.
32
+
33
+
- the data attributes for the license in YAML format as YAML frontmatter.
34
+
35
+
See an example license: `apache-2.0.LICENSE <https://github.com/nexB/scancode-toolkit/tree/develop/src/licensedcode/data/licenses/apache-2.0.LICENSE>`_
36
+
37
+
There are a couple of mandatory attributes:
38
+
39
+
- `key`
40
+
- `spdx_license_key`
41
+
- `short_name`
42
+
- `name`
43
+
- `category` (Use "Unstated License" if not known)
44
+
- `owner` (Use "Unspecified" if not known)
45
+
46
+
And more attributes which are not mandatory but nice to have always (if applicable):
47
+
48
+
- `other_spdx_license_keys`
49
+
- `osi_license_key`
50
+
- `minimum_coverage`
51
+
- `standard_notice`
52
+
- `notes`
53
+
54
+
We want to use `minimum_coverage` when there are other licenses which are very similar
55
+
and we want to make sure we match correctly these licenses, and `notes` for interesting
56
+
cases of licenses with descriptions to help identify origin, similarities to other licenses,
57
+
notes about the SPDX keys and others.
58
+
59
+
Some URLs:
60
+
61
+
- `homepage_url`
62
+
- `text_urls`
63
+
- `osi_url`
64
+
- `faq_url`
65
+
- `other_urls`
66
+
67
+
Also attributes having ignorables in the license text:
68
+
69
+
- `ignorable_urls`
70
+
- `ignorable_copyrights`
71
+
- `ignorable_authors`
72
+
- `ignorable_holders`
73
+
- `ignorable_emails`
30
74
31
-
Save these two files in the ``src/licensedcode/data/licenses/`` directory.
75
+
See the ``src/licensedcode/data/licenses/`` directory for many more examples.
32
76
33
-
Done!
77
+
.. note::
34
78
35
-
See the ``src/licensedcode/data/licenses/`` directory for many examples.
79
+
Add licenses in a local developement installation and run `scancode-reindex-licenses`
80
+
to make sure we reindex the licenses and this validates the new licenses.
0 commit comments