-
Notifications
You must be signed in to change notification settings - Fork 6
/
publish
executable file
·70 lines (62 loc) · 2.15 KB
/
publish
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
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
#!/bin/bash
set -e
set -x
# http://peterdowns.com/posts/first-time-with-pypi.html
write_setup_config () {
cat <<EOF > setup.py
#from distutils.core import setup
from setuptools import setup
import os
# read the contents of your README file
from os import path
this_directory = path.abspath(path.dirname(__file__))
with open(path.join(this_directory, 'README.md'), encoding='utf-8') as f:
long_description = f.read()
long_description = f"See the Homepage for a better formatted version.\n {long_description}"
def parse_requirements(filename):
""" load requirements from a pip requirements file """
lineiter = (line.strip() for line in open(filename))
return [line for line in lineiter if line and not line.startswith("#")]
install_reqs = parse_requirements("tranql/requirements.txt")
requirements = [str(r) for r in install_reqs]
setup(
name = 'tranql',
packages = [ 'tranql' ], # this must be the same as the name above
package_dir = { 'tranql' : 'tranql' },
package_data={ 'tranql' : [ ] },
version = '${version}',
description = 'TranQL Knowledge Network Query Language',
long_description=long_description,
long_description_content_type='text/markdown',
author = 'Steve Cox',
author_email = 'scox@renci.org',
install_requires = requirements,
include_package_data=True,
entry_points = {
#'console_scripts': ['ros=ros.app:main'],
},
url = 'http://github.com/NCATS-Tangerine/tranql.git',
download_url = 'http://github.com/NCATS-Tangerine/tranql/archive/0.01.tar.gz',
keywords = [ 'knowledge', 'network', 'graph', 'biomedical' ],
classifiers = [ ],
)
EOF
}
publish () {
version=$(echo $(cat version) 0.01 | awk '{printf "%G", $1 + $2}' )
echo "Publishing version: $version"
write_setup_config
git tag
if [ -z "$( git tag --list $version )" ]; then
python setup.py sdist
archive=dist/tranql-${version}.tar.gz
tar tf $archive
twine upload --skip-existing $archive
echo $version > version
git commit -am "api version $version"
git push origin master
git tag $version -m "publishing version $version"
git push --tags origin master
fi
}
publish $*