From 7f6216bcadbb360fdb339a5638f3c34da325f937 Mon Sep 17 00:00:00 2001 From: Ned Batchelder Date: Sat, 10 Apr 2021 10:16:13 -0400 Subject: build: remove obsolete Tidelift release notes support Tidelift removed their release notes API on 2021-03-09: https://forum.tidelift.com/t/release-notes-task/467 --- Makefile | 3 --- ci/tidelift_relnotes.py | 50 ------------------------------------------------- howto.txt | 2 -- 3 files changed, 55 deletions(-) delete mode 100644 ci/tidelift_relnotes.py diff --git a/Makefile b/Makefile index d7bc15b7..350a939c 100644 --- a/Makefile +++ b/Makefile @@ -165,8 +165,5 @@ relnotes_json: $(RELNOTES_JSON) ## Convert changelog to JSON for further parsin $(RELNOTES_JSON): $(CHANGES_MD) $(DOCBIN)/python ci/parse_relnotes.py tmp/rst_rst/changes.md $(RELNOTES_JSON) -tidelift_relnotes: $(RELNOTES_JSON) ## Upload parsed release notes to Tidelift. - $(DOCBIN)/python ci/tidelift_relnotes.py $(RELNOTES_JSON) pypi/coverage - github_releases: $(RELNOTES_JSON) ## Update GitHub releases. $(DOCBIN)/python ci/github_releases.py $(RELNOTES_JSON) nedbat/coveragepy diff --git a/ci/tidelift_relnotes.py b/ci/tidelift_relnotes.py deleted file mode 100644 index bc3a37d4..00000000 --- a/ci/tidelift_relnotes.py +++ /dev/null @@ -1,50 +0,0 @@ -#!/usr/bin/env python3 -""" -Upload release notes from a JSON file to Tidelift as Markdown chunks - -Put your Tidelift API token in a file called tidelift.token alongside this -program, for example: - - user/n3IwOpxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxc2ZwE4 - -Run with two arguments: the JSON file of release notes, and the Tidelift -package name: - - python tidelift_relnotes.py relnotes.json pypi/coverage - -Every section that has something that looks like a version number in it will -be uploaded as the release notes for that version. - -""" - -import json -import os.path -import sys - -import requests - - -def update_release_note(package, version, text): - """Update the release notes for one version of a package.""" - url = f"https://api.tidelift.com/external-api/lifting/{package}/release-notes/{version}" - token_file = os.path.join(os.path.dirname(__file__), "tidelift.token") - with open(token_file) as ftoken: - token = ftoken.read().strip() - headers = { - "Authorization": f"Bearer: {token}", - } - req_args = dict(url=url, data=text.encode('utf8'), headers=headers) - result = requests.post(**req_args) - if result.status_code == 409: - result = requests.put(**req_args) - print(f"{version}: {result.status_code}") - -def upload(json_filename, package): - """Main function: parse markdown and upload to Tidelift.""" - with open(json_filename) as jf: - relnotes = json.load(jf) - for relnote in relnotes: - update_release_note(package, relnote["version"], relnote["text"]) - -if __name__ == "__main__": - upload(*sys.argv[1:]) # pylint: disable=no-value-for-parameter diff --git a/howto.txt b/howto.txt index aae6c47d..02b8406c 100644 --- a/howto.txt +++ b/howto.txt @@ -65,8 +65,6 @@ - CHANGES.rst - add an "Unreleased" section to the top. $ git push -- Update Tidelift: - $ make tidelift_relnotes - Update GitHub releases: $ make github_releases - Update readthedocs -- cgit v1.2.1