Skip to content

Commit

Permalink
pull: Add the FSF ID to per-license files as 'id'
Browse files Browse the repository at this point in the history
This allows you to convert an SPDX ID back to a FSF ID:

  $ curl -s https://wking.github.io/fsf-api/spdx/MIT.json | jq -r .id
  Expat

without scraping the information out of 'uris'.
  • Loading branch information
wking committed Jan 4, 2018
1 parent 695b1fd commit ee338b3
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
3 changes: 2 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,8 @@ You can pull an individual license from a few places:

Licenses have the following properties:

* FSF ID: a short slug identifying the license.
* `id`: a short slug identifying the license.
In [`licenses-full.json`](#licenses-full.json), this is information is in the in root object key and not duplicated in the value.
* `name`: a short string naming the license.
* `uris`: an array of URIs for the license.
The first entry in this array will always be an entry on the [the FSF's HTML page][fsf-list].
Expand Down
3 changes: 2 additions & 1 deletion pull.py
Original file line number Diff line number Diff line change
Expand Up @@ -286,7 +286,8 @@ def save(licenses, dir=os.curdir):
license = license.copy()
if 'tags' in license:
license['tags'] = sorted(license['tags'])
full_index[id] = license
full_index[id] = license.copy()
license['id'] = id
license_path = os.path.join(dir, '{}.json'.format(id))
with open(license_path, 'w') as f:
json.dump(obj=license, fp=f, indent=2, sort_keys=True)
Expand Down

0 comments on commit ee338b3

Please sign in to comment.