Skip to content

Commit

Permalink
Merge pull request #48 from vaidik/v0.9.0
Browse files Browse the repository at this point in the history
bump version to 0.9.0
  • Loading branch information
vaidik authored Oct 5, 2020
2 parents 514e4b6 + 0f3f45e commit cb7219d
Show file tree
Hide file tree
Showing 4 changed files with 43 additions and 1 deletion.
5 changes: 5 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,10 @@
#
# Shortcuts for various tasks.

bump-version:
dephell deps convert --from=setup.py --to=requirements.txt
python tools/bump-version.py --get-current
python tools/bump-version.py --set-version

sdist:
python setup.py sdist
1 change: 1 addition & 0 deletions requirements.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
lark-parser<0.8.0,>=0.7.1
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
from setuptools import setup, find_packages


__version__ = '.'.join(map(str, (0, 8, 3)))
__version__ = '0.9.0'

install_requires = [
'lark-parser>=0.7.1,<0.8.0'
Expand Down
36 changes: 36 additions & 0 deletions tools/bump-version.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
import re
import sys


VERSION_RE = r'\'(([0-9]+\.){2}[0-9])\''


if __name__ == '__main__':
cmd = sys.argv[1]

if cmd == '--get-current':
with open('setup.py') as fp:
for line in fp.readlines():
if '__version__' in line:
match = re.search(VERSION_RE, line)
if match:
print(match.groups()[0])
elif cmd == '--set-version':
stdin_input = input()
if not len(stdin_input):
print('No input provided on stdin.')
sys.exit(1)

lines = []
with open('setup.py') as fp:
for line in fp.readlines():
if '__version__' in line:
line = re.sub(VERSION_RE, '\'%s\'' % stdin_input, line)
lines.append(line)

with open('setup.py', 'w') as fp:
fp.write(''.join(lines))

else:
print('Invalid command')
sys.exit(1)

0 comments on commit cb7219d

Please sign in to comment.