From: W. Trevor King Date: Thu, 4 Jan 2018 22:06:20 +0000 (-0800) Subject: pull: Add the FSF ID to per-license files as 'id' X-Git-Url: https://vcs.fsf.org/?a=commitdiff_plain;h=ee338b3624a260d90509e4b0dac53f926b1e29e6;p=fsf-license-api.git pull: Add the FSF ID to per-license files as 'id' 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'. --- diff --git a/README.md b/README.md index ed1d37c..b395af5 100644 --- a/README.md +++ b/README.md @@ -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]. diff --git a/pull.py b/pull.py index ec471cb..995e2a7 100755 --- a/pull.py +++ b/pull.py @@ -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)