1
0
mirror of https://github.com/nvbn/thefuck.git synced 2024-10-05 18:31:10 +01:00
thefuck/release.py

38 lines
1.0 KiB
Python
Raw Normal View History

2015-04-21 21:30:15 +01:00
#!/usr/bin/env python
from subprocess import call
2015-07-27 21:31:06 +01:00
import os
2015-04-21 21:30:15 +01: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 21:31:01 +01:00
call('git pull', shell=True)
2015-04-21 21:30:15 +01: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 21:31:06 +01:00
env = os.environ
env['CONVERT_README'] = 'true'
2019-05-27 17:32:48 +01:00
call('rm -rf dist/*', shell=True, env=env)
call('python setup.py sdist bdist_wheel', shell=True, env=env)
call('twine upload dist/*', shell=True, env=env)