diff options
| author | Giampaolo Rodola <g.rodola@gmail.com> | 2021-10-26 23:12:24 +0200 |
|---|---|---|
| committer | Giampaolo Rodola <g.rodola@gmail.com> | 2021-10-26 23:12:24 +0200 |
| commit | 3ad8bc0aed19a5aabc2ac4a66e3fd89105b4d250 (patch) | |
| tree | 681122fa3774b71bb61fb73ae8591d675d6082b1 /scripts/internal/tidelift.py | |
| parent | 77586cb13e5ec4dc79294ce5fbb6253dd03926fa (diff) | |
| parent | 0e15b4890a1d84f2aa800b745fdb0642d2ee966d (diff) | |
| download | psutil-3ad8bc0aed19a5aabc2ac4a66e3fd89105b4d250.tar.gz | |
merge from master
Signed-off-by: Giampaolo Rodola <g.rodola@gmail.com>
Diffstat (limited to 'scripts/internal/tidelift.py')
| -rwxr-xr-x | scripts/internal/tidelift.py | 40 |
1 files changed, 40 insertions, 0 deletions
diff --git a/scripts/internal/tidelift.py b/scripts/internal/tidelift.py new file mode 100755 index 00000000..fcba3e61 --- /dev/null +++ b/scripts/internal/tidelift.py @@ -0,0 +1,40 @@ +#!/usr/bin/env python3 +# Copyright (c) 2009 Giampaolo Rodola'. All rights reserved. +# Use of this source code is governed by a BSD-style license that can be +# found in the LICENSE file. + +""" +Update news entry of Tidelift with latest HISTORY.rst section. +Put your Tidelift API token in a file first: +~/.tidelift.token +""" + +from __future__ import print_function +import os +import requests +import psutil +from psutil.tests import import_module_by_path + + +def upload_relnotes(package, version, text, token): + url = "https://api.tidelift.com/external-api/" + \ + "lifting/pypi/%s/release-notes/%s" % (package, version) + res = requests.put( + url=url, + data=text.encode('utf8'), + headers={"Authorization": "Bearer: %s" % token}) + print(version, res.status_code, res.text) + res.raise_for_status() + + +def main(): + here = os.path.abspath(os.path.dirname(__file__)) + path = os.path.join(here, "print_announce.py") + get_changes = import_module_by_path(path).get_changes + with open(os.path.expanduser("~/.tidelift.token")) as f: + token = f.read().strip() + upload_relnotes('psutil', psutil.__version__, get_changes(), token) + + +if __name__ == "__main__": + main() |
