feat: switch from setup.cfg to pyproject.toml + hatchling
This commit is contained in:
parent
70f496893b
commit
ffe33b20bc
6 changed files with 79 additions and 78 deletions
18
tasks.py
18
tasks.py
|
@ -25,13 +25,24 @@ Tasks for rattail-harvest
|
|||
"""
|
||||
|
||||
import os
|
||||
import re
|
||||
import shutil
|
||||
|
||||
from invoke import task
|
||||
|
||||
|
||||
here = os.path.abspath(os.path.dirname(__file__))
|
||||
exec(open(os.path.join(here, 'rattail_harvest', '_version.py')).read())
|
||||
__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
|
||||
|
@ -40,8 +51,9 @@ def release(c):
|
|||
Release a new version of rattail-harvest
|
||||
"""
|
||||
# rebuild local tar.gz file for distribution
|
||||
shutil.rmtree('rattail_harvest.egg-info')
|
||||
c.run('python setup.py sdist --formats=gztar')
|
||||
if os.path.exists('rattail_harvest.egg-info'):
|
||||
shutil.rmtree('rattail_harvest.egg-info')
|
||||
c.run('python -m build --sdist')
|
||||
|
||||
# upload to public PyPI
|
||||
filename = f'rattail_harvest-{__version__}.tar.gz'
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue