Preparations for PEP440 support
Currrently, builds for patches are broken because the version numbers generated for them are not valid according to PEP 440 [1]. Previous attempts [2] have shown that this cannot be solved in a single commit (needs coordination with sr.ht-apkbuilds), so here is an attempt at preparing this repo for a switch without breaking anything. The grand plan is roughly: 1. Add a pyproject.toml without touching setup.py (this commit) 2. Switch APKBUILD from `python setup.py build` to `python -m build` 3. Reduce setup.py to a stub, encoding all relevant information in pyproject.toml With this commit, this module can be build with both `python setup.py build` and `python -m build`, if, _and only if_ the PKGVER environment variable is set, which is true for all our tooling. As the version passed in via the environment is still not PEP440-compatible, packaging non-tagged versions will remain broken until step three above is executed. The .gitattributes and .git_archival files are included for the future setup. Since packages are built from `git-archive` tarballs, the commit information has to be transported into the tarballs. The setuptools-scm package specifies a mechanism for this [3]. Note, that in order to avoid a hilarious bug [4] the checked in `.git_archival.txt` differs from the template found in the documentation. The git version on git.sr.ht is new enough that the `describe-name` will be expanded, and if present it is the only information that setuptools-scm really requires. [1] https://peps.python.org/pep-0440 [2] https://lists.sr.ht/~sircmpwn/sr.ht-dev/patches/50784 [3]: https://setuptools-scm.readthedocs.io/en/latest/usage/#git-archives [4]: https://github.com/pypa/setuptools_scm/issues/806
This commit is contained in:
parent
7b45163d8a
commit
57ee342790
|
@ -0,0 +1 @@
|
|||
describe-name: $Format:%(describe:tags=true,match=*[0-9]*)$
|
|
@ -0,0 +1 @@
|
|||
.git_archival.txt export-subst
|
|
@ -0,0 +1,58 @@
|
|||
[build-system]
|
||||
requires = ["setuptools", "setuptools_scm"]
|
||||
build-backend = "setuptools.build_meta"
|
||||
|
||||
[project]
|
||||
name = "srht"
|
||||
dynamic = ["version"]
|
||||
description = "sr.ht core modules"
|
||||
readme = "README.md"
|
||||
authors = [{name = "Drew DeVault", email = "sir@cmpwn.com"}]
|
||||
dependencies = [
|
||||
"flask",
|
||||
"humanize",
|
||||
"sqlalchemy",
|
||||
"sqlalchemy-utils",
|
||||
"psycopg2",
|
||||
"markdown",
|
||||
"mistletoe",
|
||||
"bleach",
|
||||
"requests",
|
||||
"BeautifulSoup4",
|
||||
"pygments",
|
||||
"cryptography",
|
||||
"prometheus_client",
|
||||
"alembic",
|
||||
"redis",
|
||||
"celery",
|
||||
]
|
||||
license.text = "BSD-3-Clause"
|
||||
|
||||
[project.urls]
|
||||
repository = "https://git.sr.ht/~sircmpwn/core.sr.ht"
|
||||
|
||||
[tool.setuptools]
|
||||
packages = [
|
||||
"srht",
|
||||
"srht.alembic",
|
||||
"srht.alembic.versions",
|
||||
"srht.graphql",
|
||||
"srht.oauth",
|
||||
"srht.webhook",
|
||||
]
|
||||
[tool.setuptools.package-data]
|
||||
srht = [
|
||||
'Makefile',
|
||||
'minify-css.js',
|
||||
'templates/*.html',
|
||||
'scss/*.scss',
|
||||
'scss/*.css',
|
||||
'scss/bootstrap/LICENSE',
|
||||
'scss/bootstrap/scss/*.scss',
|
||||
'scss/bootstrap/scss/mixins/*.scss',
|
||||
'scss/bootstrap/scss/utilities/*.scss',
|
||||
'static/*',
|
||||
'static/icons/*',
|
||||
]
|
||||
|
||||
[tool.setuptools_scm]
|
Loading…
Reference in New Issue