build: avoid version parse when uploading release
This commit is contained in:
parent
ab4dbbedf0
commit
da4450b574
19
tasks.py
19
tasks.py
|
@ -25,26 +25,11 @@ Tasks for Tailbone
|
|||
"""
|
||||
|
||||
import os
|
||||
import re
|
||||
import shutil
|
||||
|
||||
from invoke import task
|
||||
|
||||
|
||||
here = os.path.abspath(os.path.dirname(__file__))
|
||||
__version__ = None
|
||||
pattern = re.compile(r'^version = "(\d+\.\d+\.\d+)"$')
|
||||
with open(os.path.join(here, 'pyproject.toml'), 'rt') as f:
|
||||
for line in f:
|
||||
line = line.rstrip('\n')
|
||||
match = pattern.match(line)
|
||||
if match:
|
||||
__version__ = match.group(1)
|
||||
break
|
||||
if not __version__:
|
||||
raise RuntimeError("could not parse version!")
|
||||
|
||||
|
||||
@task
|
||||
def release(c, tests=False):
|
||||
"""
|
||||
|
@ -53,7 +38,9 @@ def release(c, tests=False):
|
|||
if tests:
|
||||
c.run('tox')
|
||||
|
||||
if os.path.exists('dist'):
|
||||
shutil.rmtree('dist')
|
||||
if os.path.exists('Tailbone.egg-info'):
|
||||
shutil.rmtree('Tailbone.egg-info')
|
||||
c.run('python -m build --sdist')
|
||||
c.run(f'twine upload dist/tailbone-{__version__}.tar.gz')
|
||||
c.run('twine upload dist/*')
|
||||
|
|
Loading…
Reference in a new issue