Skip to content

Commit

Permalink
Work around missing Poetry package on Bullseye
Browse files Browse the repository at this point in the history
Bullseye (and by extension, Byzantium) doesn’t carry the
`python3-poetry-core` package.

Migrate the build process to Flit v3.0.0, which is supported natively
in Bullseye’s version of pybuild.

Additional workarounds required for Flit v3.0.0:

- Use old-style metadata (`tool.flit.metadata` section in
  `pyproject.toml`)

- Restructure the `tool.poe.tasks` section in `pyproject.toml`, because
  Flit would error out when using nested keys outside of section
  headings, e.g. `tasks.cmd = "poe -v"`.
  • Loading branch information
claui committed Jul 18, 2024
1 parent df9e8f1 commit 4dad929
Show file tree
Hide file tree
Showing 5 changed files with 156 additions and 3 deletions.
6 changes: 6 additions & 0 deletions debian/changelog
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
itchcraft (0.1.0~bpo11+1) UNRELEASED; urgency=medium

* Work around missing Poetry package on Bullseye

-- Claudia Pellegrino <[email protected]> Thu, 18 Jul 2024 19:55:40 +0200

itchcraft (0.1.0) UNRELEASED; urgency=medium

* Initial release
Expand Down
2 changes: 1 addition & 1 deletion debian/control
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ Source: itchcraft
Section: python
Priority: optional
Maintainer: Claudia Pellegrino <[email protected]>
Build-Depends: debhelper-compat (= 13), dh-python, pybuild-plugin-pyproject, python3-all, python3-myst-parser, python3-poetry-core, python3-sphinx
Build-Depends: debhelper-compat (= 13), dh-python, flit, python3-all, python3-myst-parser, python3-sphinx
Standards-Version: 4.5.1
Homepage: https://github.com/claui/itchcraft
Vcs-Browser: https://github.com/claui/itchcraft
Expand Down
148 changes: 148 additions & 0 deletions debian/patches/replace-poetry.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,148 @@
From 44f3e1d60c27c2a7861c3950d961e8476de6f8ee Mon Sep 17 00:00:00 2001
From: Claudia <[email protected]>
Date: Sun, 25 Feb 2024 12:24:33 +0100
Subject: [PATCH] Work around missing Poetry package on Bullseye
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

Bullseye (and by extension, Byzantium) doesn’t carry the
`python3-poetry-core` package.

Migrate the build process to Flit v3.0.0, which is supported natively
in Bullseye’s version of pybuild.

Additional workarounds required for Flit v3.0.0:

- Use old-style metadata (`tool.flit.metadata` section in
`pyproject.toml`)

- Restructure the `tool.poe.tasks` section in `pyproject.toml`, because
Flit would error out when using nested keys outside of section
headings, e.g. `tasks.cmd = "poe -v"`.
---
--- a/pyproject.toml
+++ b/pyproject.toml
@@ -1,6 +1,48 @@
+# Use Flit instead of Poetry as long as we need to support Debian 11,
+# which doesn’t provide Poetry.
+#
+# On top of that, Debian 11 only ships flit v3.0.0, which means we have
+# to use old-style metadata, too (`tool.flit.metadata` instead of
+# `project`, and `flit_core >=2` instead of `flit_core >=3.2`.)
+
[build-system]
-requires = ["poetry-core>=1.9.0"]
-build-backend = "poetry.core.masonry.api"
+requires = ["flit_core >=2,<4"]
+build-backend = "flit_core.buildapi"
+
+[tool.flit.metadata]
+module = "itchcraft"
+author = "Claudia Pellegrino"
+author-email = "[email protected]"
+description-file = "README.md"
+requires-python = ">=3.9"
+requires = [
+ "colorama >=0.4.4",
+ "fire >=0.4.0",
+ "pyusb >= 1.0.0",
+ "tenacity >= 6.0.0"
+]
+classifiers = [
+ "Development Status :: 3 - Alpha",
+ "License :: OSI Approved :: Apache Software License",
+ "Operating System :: POSIX :: Linux",
+ "Topic :: Utilities",
+]
+
+[tool.flit.metadata.requires-extra]
+dev = [
+ "autopep8 >=2.0.0",
+ "mypy >=1.8",
+ "myst-parser >=2.0.0",
+ "pdoc >=14.0",
+ "poethepoet >=0.24",
+ "pylint >=3.0",
+ "pytest >=6.0.2",
+ "sphinx >=7.1.2, <7.2.0",
+ "types-colorama >=0.4.4"
+]
+
+[tool.flit.scripts]
+itchcraft = "itchcraft.cli:run"

[tool.mypy]
check_untyped_defs = true
@@ -18,71 +60,6 @@ warn_redundant_casts = true
warn_return_any = true
warn_unused_ignores = true

-[tool.poetry]
-name = "itchcraft"
-version = "0.1.0"
-description = "Alternative frontend for heat-based USB insect bite healers"
-readme = [
- "README.md",
- "USAGE.md",
-]
-authors = [
- "Claudia Pellegrino <[email protected]>",
-]
-license = "Apache-2.0"
-# See https://pypi.org/pypi?%3Aaction=list_classifiers
-classifiers = [
- "Development Status :: 3 - Alpha",
- "Operating System :: MacOS",
- "Operating System :: POSIX :: Linux",
- "Topic :: Utilities",
-]
-
-[tool.poetry.dependencies]
-python = ">=3.9"
-colorama = "*"
-dataclass-wizard = ">=0.22"
-fire = "*"
-pyusb = "^1.2.1"
-tenacity = "^8.5.0"
-
-[tool.poetry.group.dev.dependencies]
-autopep8 = "*"
-mypy = ">=1.8"
-myst-parser = ">=2.0.0"
-pdoc = ">=14.0"
-poethepoet = ">=0.24"
-pylint = ">=3.0"
-pytest = "*"
-sphinx = ">=7.1.2,<7.2.0"
-types-colorama = "*"
-
-[tool.poetry.scripts]
-itchcraft = "itchcraft.cli:run"
-
-[tool.poe]
-verbosity = -1
-
-[tool.poe.tasks]
-tasks.cmd = "poe -v"
-tasks.help = "List available tasks"
-cli.script = "itchcraft.cli:run"
-cli.help = "Run command line interface"
-doc.cmd = "sphinx-build -aqEW -b man doc/sphinx build/man"
-doc.help = "Generate documentation"
-hello.script = "itchcraft.cli:run('hello')"
-hello.help = "Run hello"
-html.cmd = "pdoc itchcraft !itchcraft.settings"
-html.help = "Browse HTML documentation"
-linter.cmd = "pylint --enable-all-extensions itchcraft"
-linter.help = "Check for style violations"
-man.cmd = "man build/man/itchcraft.1"
-man.help = "Open manual page"
-tests.cmd = "pytest"
-tests.help = "Run test suite"
-typecheck.cmd = "mypy"
-typecheck.help = "Run static type checker"
-
[tool.pyright]
reportUnsupportedDunderAll = "none"

1 change: 1 addition & 0 deletions debian/patches/series
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
replace-poetry.patch
2 changes: 0 additions & 2 deletions debian/rules
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,6 @@ export PYBUILD_NAME=itchcraft
%:
dh $@ --with python3 --buildsystem=pybuild

override_dh_auto_build: export http_proxy=127.0.0.1:9
override_dh_auto_build: export https_proxy=127.0.0.1:9
override_dh_auto_build:
dh_auto_build
PYTHONPATH=. python3 -m sphinx -NW -b man doc/sphinx build/man

0 comments on commit 4dad929

Please sign in to comment.