-
Notifications
You must be signed in to change notification settings - Fork 0
/
bintray.py
executable file
·47 lines (35 loc) · 1.25 KB
/
bintray.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
import argparse
import importlib
import json
import requests as r
parser = argparse.ArgumentParser(description='Set bintray info')
parser.add_argument('conanlib', type=str,
help='Name of conan class in conanfile.py')
parser.add_argument('username', type=str, help='Bintray username')
parser.add_argument('password', type=str, help='Bintray password')
def main(argvs):
args = parser.parse_args(argvs)
mod = importlib.import_module("conanfile")
pkg = getattr(mod, args.conanlib)
info = dict()
info['desc'] = pkg.description
info['licenses'] = [pkg.license]
info['vcs_url'] = pkg.url
info['website_url'] = pkg.homepage
info['labels'] = list(pkg.topics)
url = 'https://api.bintray.com/packages/sintef-ocean/conan/{}%3asintef' \
.format(pkg.name)
try:
res = r.patch(url,
auth=(args.username, args.password),
data=json.dumps(info))
if not res.ok:
print("Could not set package info: {}".format(res.reason))
else:
print("Set package info: {}".format(res.reason))
except Exception:
print("WARNING failed to set package info")
exit(0)
if __name__ == "__main__":
import sys
main(sys.argv[1:])