Skip to content

Commit

Permalink
Add public domain license (ros-infrastructure#87)
Browse files Browse the repository at this point in the history
* Add test for 'Public Domain' license mapping.

* Add mapping for public_domain license.
  • Loading branch information
allenh1 authored Nov 8, 2017
1 parent ad0c0b5 commit a4b2ec3
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 1 deletion.
3 changes: 3 additions & 0 deletions superflore/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -125,6 +125,7 @@ def get_license(l):
cc_by_nc_sa_re = '^(CC(.)?BY(.)?NC(.)?SA(.)?)'
moz_re = '^(Mozilla)((.)*(1\\.1))?'
boost_re = '^(Boost)((.)*([1]))?'
pub_dom_re = '^(Public(.)?Domain)'
mit_re = '^MIT'
f = re.IGNORECASE

Expand Down Expand Up @@ -163,6 +164,8 @@ def get_license(l):
return 'CC-BY-SA-3.0'
elif re.search(boost_re, l, f):
return 'Boost-1.0'
elif re.search(pub_dom_re, l, f):
return 'public_domain'
else:
print(colored('Could not match license "{0}".'.format(l), 'red'))
raise UnknownLicense('bad license')
Expand Down
3 changes: 2 additions & 1 deletion tests/test_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,8 @@ def test_get_license(self):
self.assertEqual(ret, 'Boost-1.0')
ret = get_license('GNU GPLv3')
self.assertEqual(ret, 'GPL-3')

ret = get_license('Public Domain')
self.assertEqual(ret, 'public_domain')

if __name__ == '__main__':
unittest.main()

0 comments on commit a4b2ec3

Please sign in to comment.