Compare commits

...

1 Commits

Author SHA1 Message Date
Andreas Motl cc0fe78382 Packaging: Use versioningit for maintaining the package version
The Debian package builder has been saved to `bin/mkdeb.py` for now. It
needs to be refurbished into a `poethepoet` task subsequently.
2024-10-25 14:21:22 +02:00
7 changed files with 66 additions and 60 deletions
+12 -1
View File
@@ -1,6 +1,6 @@
# Development Sandbox
Set up a development sandbox.
## Setup
Acquire sources and install project in editable mode.
```shell
@@ -11,6 +11,8 @@ source .venv/bin/activate
pip install --editable '.[graphql,develop,release,test]'
```
## Operations
Invoke linter and software tests.
```shell
poe check
@@ -20,3 +22,12 @@ Format code.
```shell
poe format
```
## Release
```shell
git tag v2.1.0
git push --tags
poe release
```
+37
View File
@@ -0,0 +1,37 @@
# ruff: noqa: S605, S607
"""
Build and publish a .deb package.
https://pypi.python.org/pypi/stdeb/0.8.5#quickstart-2-just-tell-me-the-fastest-way-to-make-a-deb
"""
import os
from shutil import rmtree
here = os.path.abspath(os.path.dirname(__file__))
def get_version():
import responder
return responder.__version__
def run():
version = get_version()
try:
print("Removing previous builds")
rmtree(os.path.join(here, "deb_dist"))
except FileNotFoundError:
pass
print("Creating Debian package manifest")
os.system(
"python setup.py --command-packages=stdeb.command sdist_dsc "
"-z artful --package3=pipenv --depends3=python3-virtualenv-clone"
)
print("Building .deb")
os.chdir(f"deb_dist/pipenv-{version}")
os.system("dpkg-buildpackage -rfakeroot -uc -us")
if __name__ == "__main__":
run()
+2 -14
View File
@@ -20,23 +20,11 @@
# -- Project information -----------------------------------------------------
project = "responder"
copyright = "2018, A Kenneth Reitz project"
copyright = "2024, A Kenneth Reitz project"
author = "Kenneth Reitz"
# The short X.Y version
import os
# Path hackery to get current version number.
here = os.path.abspath(os.path.dirname(__file__))
about = {}
with open(os.path.join(here, "..", "..", "responder", "__version__.py")) as f:
exec(f.read(), about)
version = about["__version__"]
# The full version, including alpha/beta/rc tags
release = about["__version__"]
version = ""
# -- General configuration ---------------------------------------------------
+4
View File
@@ -2,12 +2,14 @@
build-backend = "setuptools.build_meta"
requires = [
"setuptools>=42", # At least v42 of setuptools required.
"versioningit",
]
[tool.ruff]
line-length = 90
extend-exclude = [
"bin/mkdeb.py",
"docs/source/conf.py",
"setup.py",
]
@@ -69,6 +71,8 @@ markers = [
]
xfail_strict = true
[tool.versioningit]
[tool.poe.tasks]
check = [
+8
View File
@@ -1,9 +1,17 @@
from importlib.metadata import PackageNotFoundError, version
from . import ext
from .core import API, Request, Response
try:
__version__ = version("responder")
except PackageNotFoundError: # pragma: no cover
__version__ = "unknown"
__all__ = [
"API",
"Request",
"Response",
"ext",
"__version__",
]
-1
View File
@@ -1 +0,0 @@
__version__ = "2.0.7"
+3 -44
View File
@@ -2,21 +2,15 @@
# -*- coding: utf-8 -*-
import codecs
import os
import sys
from shutil import rmtree
from setuptools import Command, find_packages, setup
from setuptools import find_packages, setup
from versioningit import get_cmdclasses
here = os.path.abspath(os.path.dirname(__file__))
with codecs.open(os.path.join(here, "README.md"), encoding="utf-8") as f:
long_description = "\n" + f.read()
about = {}
with open(os.path.join(here, "responder", "__version__.py")) as f:
exec(f.read(), about)
required = [
"aiofiles",
"apispec>=1.0.0b1",
@@ -31,43 +25,8 @@ required = [
"whitenoise",
]
# https://pypi.python.org/pypi/stdeb/0.8.5#quickstart-2-just-tell-me-the-fastest-way-to-make-a-deb
class DebCommand(Command):
"""Support for setup.py deb"""
description = "Build and publish the .deb package."
user_options = []
@staticmethod
def status(s):
"""Prints things in bold."""
print("\033[1m{0}\033[0m".format(s))
def initialize_options(self):
pass
def finalize_options(self):
pass
def run(self):
try:
self.status("Removing previous builds…")
rmtree(os.path.join(here, "deb_dist"))
except FileNotFoundError:
pass
self.status("Creating debian manifest…")
os.system(
"python setup.py --command-packages=stdeb.command sdist_dsc -z artful --package3=pipenv --depends3=python3-virtualenv-clone"
)
self.status("Building .deb…")
os.chdir("deb_dist/pipenv-{0}".format(about["__version__"]))
os.system("dpkg-buildpackage -rfakeroot -uc -us")
setup(
name="responder",
version=about["__version__"],
description="A familiar HTTP Service Framework for Python.",
long_description=long_description,
long_description_content_type="text/markdown",
@@ -103,5 +62,5 @@ setup(
"Programming Language :: Python :: Implementation :: PyPy",
"Topic :: Internet :: WWW/HTTP",
],
cmdclass={"deb": DebCommand},
cmdclass=get_cmdclasses(),
)