Skip to content

Commit 5d2b418

Browse files
committed
Validate license categories
Signed-off-by: Philippe Ombredanne <pombredanne@nexb.com>
1 parent b78f8fd commit 5d2b418

6 files changed

Lines changed: 26 additions & 5 deletions

File tree

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
key: cvwl
22
short_name: Collaborative Virtual Workspace License
33
name: Collaborative Virtual Workspace License
4-
category: Proprietary
4+
category: Proprietary Free
55
owner: Mitre
66
homepage_url: https://opensource.org/licenses/mitrepl
77
minimum_coverage: 30
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
key: ecma-documentation
22
short_name: ECMA Documentation License
33
name: ECMA Documentation License
4-
category: Free restricted
4+
category: Free Restricted
55
owner: Ecma International
66
homepage_url: http://www.ecma-international.org/publications/DISCLAIMER.pdf

src/licensedcode/data/licenses/flora-1.1.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
key: flora-1.1
22
short_name: Flora License v1.1
33
name: Flora License v1.1
4-
category: Proprietary
4+
category: Proprietary Free
55
owner: Tizen Association
66

77
other_urls:
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
key: redis-sala-proprietary-1.0
22
short_name: Redis Source Available License Agreement 1.0
33
name: Redis Source Available License Agreement 1.0
4-
category: Proprietary
4+
category: Proprietary Free
55
owner: Redis Labs Ltd.

src/licensedcode/data/licenses/us-govt-unlimited-rights.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
key: us-govt-unlimited-rights
22
short_name: US govt. Unlimited Rights
33
name: US govt. Unlimited Rights
4-
category: Unspecified
4+
category: Permissive
55
owner: US Government
66
text_urls:
77
- https://github.com/Slicer/Slicer/blob/v4.6.2/COPYRIGHT.txt

src/licensedcode/models.py

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -69,6 +69,26 @@
6969
TRACE_REPR = False
7070

7171

72+
FOSS_CATEGORIES = set([
73+
'Copyleft',
74+
'Copyleft Limited',
75+
'Patent License',
76+
'Permissive',
77+
'Public Domain',
78+
])
79+
80+
81+
OTHER_CATEGORIES = set([
82+
'Commercial',
83+
'Free Restricted',
84+
'Proprietary Free',
85+
'Unstated License',
86+
])
87+
88+
89+
CATEGORIES = FOSS_CATEGORIES | OTHER_CATEGORIES
90+
91+
7292
@attr.s(slots=True)
7393
class License(object):
7494
"""
@@ -252,6 +272,7 @@ def load(self):
252272
assert self.key == v, 'Inconsistent YAML key and file names for %r' % self.key
253273

254274
setattr(self, k, v)
275+
assert self.category in CATEGORIES, 'Unknown license category: {}'.format(self.category)
255276

256277
except Exception, e:
257278
# this is a rare case: fail loudly

0 commit comments

Comments
 (0)