From ee338b3624a260d90509e4b0dac53f926b1e29e6 Mon Sep 17 00:00:00 2001 From: "W. Trevor King" Date: Thu, 4 Jan 2018 14:06:20 -0800 Subject: [PATCH] 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'. --- README.md | 3 ++- pull.py | 3 ++- 2 files changed, 4 insertions(+), 2 deletions(-) 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)