From 3851c949295cd155279a48fb9d8957dc2a3fea5c Mon Sep 17 00:00:00 2001 From: Jon Michael Aanes Date: Mon, 1 Apr 2024 00:53:09 +0200 Subject: [PATCH] Bump workflows to 6.02 --- .gitea/workflows/package.yml | 2 +- personal_data/__main__.py | 1 - setup.py | 42 ++++++++++++++++++++++++++++++++++++ test/test_util.py | 6 ++++++ 4 files changed, 49 insertions(+), 2 deletions(-) create mode 100644 setup.py create mode 100644 test/test_util.py diff --git a/.gitea/workflows/package.yml b/.gitea/workflows/package.yml index f62720a..785cd69 100644 --- a/.gitea/workflows/package.yml +++ b/.gitea/workflows/package.yml @@ -3,7 +3,7 @@ on: [push] jobs: Package: - uses: jmaa/workflows/.gitea/workflows/python-package.yaml@main + uses: jmaa/workflows/.gitea/workflows/python-package.yaml@v6.02 secrets: PIPY_REPO_USER: ${{ secrets.PIPY_REPO_USER }} PIPY_REPO_PASS: ${{ secrets.PIPY_REPO_PASS }} diff --git a/personal_data/__main__.py b/personal_data/__main__.py index bd9e2f6..ed6aeff 100644 --- a/personal_data/__main__.py +++ b/personal_data/__main__.py @@ -1,4 +1,3 @@ - import requests import requests_cache import csv diff --git a/setup.py b/setup.py new file mode 100644 index 0000000..0aa309e --- /dev/null +++ b/setup.py @@ -0,0 +1,42 @@ +#!/usr/bin/env python +import re + +from setuptools import setup + +PACKAGE_NAME = 'personal_data' + +with open('README.md') as f: + readme = f.read() + +with open(PACKAGE_NAME + '/_version.py') as f: + text = f.read() + match = re.match(r'^__version__\s*=\s*(["\'])([\d\.]+)\1$', text) + version = match.group(2) + del match, text + +with open('requirements.txt') as f: + install_requires = f.read().strip().split('\n') + + +def get_short_description(readme: str): + readme = re.sub(r'#+[^\n]*\n+', '', readme) + m = re.search(r'^\s*(\w+[\w\s,`]+\.)', readme) + try: + return m.group(1) + except AttributeError as err: + msg = 'Could not determine short description' + raise Exception(msg) from err + + +setup( + name=PACKAGE_NAME, + version=version, + description=get_short_description(readme), + long_description=readme, + long_description_content_type='text/markdown', + author='Jmaa', + author_email='jonjmaa@gmail.com', + url='https://gitfub.space/Jmaa/' + PACKAGE_NAME, + packages=[PACKAGE_NAME], + install_requires=install_requires, +) diff --git a/test/test_util.py b/test/test_util.py new file mode 100644 index 0000000..9f59611 --- /dev/null +++ b/test/test_util.py @@ -0,0 +1,6 @@ + +import personal_data.data + +def test(): + assert True +