2023-10-28 17:48:37 -05:00
|
|
|
# -*- coding: utf-8; -*-
|
|
|
|
"""
|
|
|
|
Tasks for WuttJamaican
|
|
|
|
"""
|
|
|
|
|
|
|
|
import os
|
2024-06-10 13:42:59 -05:00
|
|
|
import re
|
2023-10-28 17:48:37 -05:00
|
|
|
import shutil
|
|
|
|
|
|
|
|
from invoke import task
|
|
|
|
|
|
|
|
|
|
|
|
here = os.path.abspath(os.path.dirname(__file__))
|
2024-06-10 13:42:59 -05:00
|
|
|
__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!")
|
2023-10-28 17:48:37 -05:00
|
|
|
|
|
|
|
|
|
|
|
@task
|
2023-11-20 21:44:00 -06:00
|
|
|
def release(c, skip_tests=False):
|
2023-10-28 17:48:37 -05:00
|
|
|
"""
|
|
|
|
Release a new version of WuttJamaican
|
|
|
|
"""
|
2023-11-20 21:44:00 -06:00
|
|
|
if not skip_tests:
|
|
|
|
c.run('tox')
|
2023-11-19 00:53:35 -06:00
|
|
|
|
2023-10-28 17:48:37 -05:00
|
|
|
# rebuild local tar.gz file for distribution
|
|
|
|
if os.path.exists('WuttJamaican.egg-info'):
|
|
|
|
shutil.rmtree('WuttJamaican.egg-info')
|
|
|
|
c.run('python -m build --sdist')
|
|
|
|
|
|
|
|
# upload to PyPI
|
2024-04-14 15:02:58 -05:00
|
|
|
filename = f'wuttjamaican-{__version__}.tar.gz'
|
2023-10-28 17:48:37 -05:00
|
|
|
c.run(f'twine upload dist/{filename}')
|