From f7f60eff85f8c6a9d4e8fc1142ea675afc9ab9b7 Mon Sep 17 00:00:00 2001 From: Lance Edgar Date: Fri, 10 Feb 2023 21:12:57 -0600 Subject: [PATCH] Avoid error when re-running release task --- tasks.py | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/tasks.py b/tasks.py index 971888f..4fec2d2 100644 --- a/tasks.py +++ b/tasks.py @@ -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__))