2015-04-21 22:30:15 +02:00
|
|
|
#!/usr/bin/env python
|
|
|
|
from subprocess import call
|
2015-07-27 23:31:06 +03:00
|
|
|
import os
|
2015-04-21 22:30:15 +02:00
|
|
|
import re
|
|
|
|
|
|
|
|
|
|
|
|
version = None
|
|
|
|
|
|
|
|
|
|
|
|
def get_new_setup_py_lines():
|
|
|
|
global version
|
|
|
|
with open('setup.py', 'r') as sf:
|
|
|
|
current_setup = sf.readlines()
|
|
|
|
for line in current_setup:
|
|
|
|
if line.startswith('VERSION = '):
|
|
|
|
major, minor = re.findall(r"VERSION = '(\d+)\.(\d+)'", line)[0]
|
|
|
|
version = "{}.{}".format(major, int(minor) + 1)
|
|
|
|
yield "VERSION = '{}'\n".format(version)
|
|
|
|
else:
|
|
|
|
yield line
|
|
|
|
|
|
|
|
|
|
|
|
lines = list(get_new_setup_py_lines())
|
|
|
|
with open('setup.py', 'w') as sf:
|
|
|
|
sf.writelines(lines)
|
|
|
|
|
2015-04-21 22:31:01 +02:00
|
|
|
call('git pull', shell=True)
|
2015-04-21 22:30:15 +02:00
|
|
|
call('git commit -am "Bump to {}"'.format(version), shell=True)
|
|
|
|
call('git tag {}'.format(version), shell=True)
|
|
|
|
call('git push', shell=True)
|
|
|
|
call('git push --tags', shell=True)
|
2015-07-27 23:31:06 +03:00
|
|
|
|
|
|
|
env = os.environ
|
|
|
|
env['CONVERT_README'] = 'true'
|
2019-05-27 18:32:48 +02:00
|
|
|
call('rm -rf dist/*', shell=True, env=env)
|
2018-10-16 21:08:08 +02:00
|
|
|
call('python setup.py sdist bdist_wheel', shell=True, env=env)
|
|
|
|
call('twine upload dist/*', shell=True, env=env)
|