Avoid error when re-running release task

This commit is contained in:
Lance Edgar 2023-02-10 21:12:57 -06:00
parent acfc7f7d80
commit f7f60eff85

View file

@ -2,7 +2,7 @@
################################################################################
#
# Rattail -- Retail Software Framework
# Copyright © 2010-2022 Lance Edgar
# Copyright © 2010-2023 Lance Edgar
#
# This file is part of Rattail.
#
@ -24,8 +24,6 @@
Tasks for 'rattail-tempmon' package
"""
from __future__ import unicode_literals, absolute_import
import os
import shutil
@ -37,10 +35,11 @@ exec(open(os.path.join(here, 'rattail_tempmon', '_version.py')).read())
@task
def release(ctx):
def release(c):
"""
Release a new version of `rattail-tempmon`
"""
shutil.rmtree('rattail_tempmon.egg-info')
ctx.run('python -m build --sdist')
ctx.run('twine upload dist/rattail-tempmon-{}.tar.gz'.format(__version__))
if os.path.exists('rattail_tempmon.egg-info'):
shutil.rmtree('rattail_tempmon.egg-info')
c.run('python -m build --sdist')
c.run('twine upload dist/rattail-tempmon-{}.tar.gz'.format(__version__))