mirror of https://github.com/dbcli/pgcli
Add a release script.
This commit is contained in:
parent
1b348c19b5
commit
19d5b2f58d
|
@ -0,0 +1,35 @@
|
||||||
|
#!/usr/bin/env python
|
||||||
|
import re
|
||||||
|
import ast
|
||||||
|
import subprocess
|
||||||
|
|
||||||
|
def version():
|
||||||
|
_version_re = re.compile(r'__version__\s+=\s+(.*)')
|
||||||
|
|
||||||
|
with open('pgcli/__init__.py', 'rb') as f:
|
||||||
|
version = str(ast.literal_eval(_version_re.search(
|
||||||
|
f.read().decode('utf-8')).group(1)))
|
||||||
|
|
||||||
|
return version
|
||||||
|
|
||||||
|
def create_git_tag(tag_name):
|
||||||
|
cmd = ['git', 'tag', tag_name]
|
||||||
|
print ' '.join(cmd)
|
||||||
|
subprocess.check_output(cmd)
|
||||||
|
|
||||||
|
def register_with_pypi():
|
||||||
|
cmd = ['python', 'setup.py', 'register']
|
||||||
|
print ' '.join(cmd)
|
||||||
|
subprocess.check_output(cmd)
|
||||||
|
|
||||||
|
def create_source_tarball():
|
||||||
|
cmd = ['python', 'setup.py', 'sdist']
|
||||||
|
print ' '.join(cmd)
|
||||||
|
subprocess.check_output(cmd)
|
||||||
|
|
||||||
|
if __name__ == '__main__':
|
||||||
|
ver = version()
|
||||||
|
print ver
|
||||||
|
create_git_tag('v%s' % ver)
|
||||||
|
register_with_pypi()
|
||||||
|
create_source_tarball()
|
Loading…
Reference in New Issue