1
0

Updated workflows to v6.21
All checks were successful
Python Package / Test (push) Successful in 21s
Python Package / Package (push) Successful in 21s

This commit is contained in:
Jon Michael Aanes 2024-05-05 00:02:50 +02:00
parent a13483f4ba
commit c61bc9958b
Signed by: Jmaa
SSH Key Fingerprint: SHA256:Ab0GfHGCblESJx7JRE4fj4bFy/KRpeLhi41y4pF3sNA
4 changed files with 33 additions and 20 deletions

View File

@ -3,9 +3,12 @@ on: [push]
jobs: jobs:
Test: Test:
uses: jmaa/workflows/.gitea/workflows/python-test.yaml@v6.20 uses: jmaa/workflows/.gitea/workflows/python-test.yaml@v6.21
Package: Package:
uses: jmaa/workflows/.gitea/workflows/python-package.yaml@v6.20 uses: jmaa/workflows/.gitea/workflows/python-package.yaml@v6.21
with:
REGISTRY_DOMAIN: gitfub.space
REGISTRY_ORGANIZATION: Jmaa
secrets: secrets:
PIPY_REPO_USER: ${{ secrets.PIPY_REPO_USER }} PIPY_REPO_USER: ${{ secrets.PIPY_REPO_USER }}
PIPY_REPO_PASS: ${{ secrets.PIPY_REPO_PASS }} PIPY_REPO_PASS: ${{ secrets.PIPY_REPO_PASS }}

View File

@ -1,2 +0,0 @@
enforce_typing
frozendict

View File

@ -1 +0,0 @@
pytest

View File

@ -1,49 +1,62 @@
#!/usr/bin/env python #!/usr/bin/env python
import re import re
import pathlib
from setuptools import setup from setuptools import setup
PACKAGE_NAME = 'pbcabi' PACKAGE_NAME = "pbcabi"
with open('README.md') as f: with open("README.md") as f:
readme = f.read() readme = f.read()
with open(PACKAGE_NAME + '/_version.py') as f: with open(PACKAGE_NAME + "/_version.py") as f:
text = f.read() text = f.read()
match = re.match(r'^__version__\s*=\s*(["\'])([\d\.]+)\1$', text) match = re.match(r'^__version__\s*=\s*(["\'])([\d\.]+)\1$', text)
version = match.group(2) version = match.group(2)
del match, text del match, text
def read_requirements(path: str = 'requirements.txt'): def parse_requirements(text: str) -> list[str]:
return text.strip().split("\n")
def read_requirements(path: str):
with open(path) as f: with open(path) as f:
return f.read().strip().split('\n') return parse_requirements(f.read())
def get_short_description(readme: str): def get_short_description(readme: str):
readme = re.sub(r'#+[^\n]*\n+', '', readme) readme = re.sub(r"#+[^\n]*\n+", "", readme)
m = re.search(r'^\s*(\w+[\w\s,`]+\.)', readme) m = re.search(r"^\s*(\w+[\w\s,`]+\.)", readme)
try: try:
return m.group(1) return m.group(1)
except AttributeError as err: except AttributeError as err:
msg = 'Could not determine short description' msg = "Could not determine short description"
raise Exception(msg) from err raise Exception(msg) from err
REQUIREMENTS_MAIN = """
enforce_typing
frozendict
"""
REQUIREMENTS_TEST = """
pytest
"""
setup( setup(
name=PACKAGE_NAME, name=PACKAGE_NAME,
version=version, version=version,
description=get_short_description(readme), description=get_short_description(readme),
long_description=readme, long_description=readme,
long_description_content_type='text/markdown', long_description_content_type="text/markdown",
author='Jmaa', author="Jmaa",
author_email='jonjmaa@gmail.com', author_email="jonjmaa@gmail.com",
url='https://gitfub.space/Jmaa/' + PACKAGE_NAME, url="https://gitfub.space/Jmaa/" + PACKAGE_NAME,
packages=[PACKAGE_NAME], packages=[PACKAGE_NAME],
install_requires=read_requirements(), install_requires=parse_requirements(REQUIREMENTS_MAIN),
extras_require={ extras_require={
'test': read_requirements('requirements_test.txt'), "test": parse_requirements(REQUIREMENTS_TEST),
}, },
license="MIT",
python_requires=">=3.9", python_requires=">=3.9",
) )