jaymzh / pius

PGP Individual User Signer
Other
97 stars 25 forks source link

Distutils / setup.py deprecation #146

Open baldurmen opened 1 year ago

baldurmen commented 1 year ago

Hello,

This project uses the Python distutils module in setup.py.

In Python 3.10 and 3.11, distutils has been formally marked as deprecated. Code that imports distutils will no longer work from Python 3.12.

As such, it's very likely Debian (I'm the current maintainer for pius) won't be able to build this package when the 3.12 transition happens (sometime in late 2023 probably?).

It would probably be a good idea to migrate away from setup.py to a PEP517-compatible build system, using pyproject.toml. Here's the relevant documentation if you want to go with setuptools (there are a lot of other good options, I'm myself partial to flit...)

You can see an example of a migration to pyproject.toml with setuptools that I did here: https://github.com/jaseg/python-mpv/pull/241

baldurmen commented 1 month ago

It's getting harder and harder to make the current build workflow work in Debian. I started working on a pyproject.toml file, but it seems like it needs more than just dumping a new file and removing setup.py to work:

[build-system]
requires = ["setuptools"]
build-backend = "setuptools.build_meta"

[project]
name = "pius"
dynamic = "version"
description = "PIUS: The PGP Individual UID Signer"
readme = "README.md"
authors = [{name = "Phil Dibowitz", email = "phil@ipom.com"}]
license = {file = "COPYING"}
classifiers = [
    "License :: OSI Approved :: GNU General Public License v2 (GPLv2)",
]
[project.urls]
homepage = "https://github.com/jaymzh/pius"

[project.scripts]
pius = "pius:main"
pius-keyring-mgr = "pius-keyring-mgr:main"
pius-report = "pius-report:main"

[tool.setuptools.dynamic]
version = {attr = "libpius.constants.VERSION"}

A few things:

  1. This fails because of how the Python scripts are named. pius-keyring-mgr and pius-report should be renamed to pius_keyring_mgr and pius_report.
  2. Data files outside of the package are not supported anymore, so you'll have to drop including the doc and the man page in the Python wheel. See https://setuptools.pypa.io/en/latest/userguide/datafiles.html for more details
  3. Same goes for pius-party-worksheet. Since there's no Python entrypoint (it's a Perl script), it cannot be put in /usr/bin as it used to be.

Data files not being included anymore aren't really a problem in my opinion, since putting them at the right place on people's system is the work of Distros.

I don't use pius a lot anymore and renaming files in a Debian-specific patch is enough trouble that I stopped there. If someone else wants to pick this up and finish the work, it would be nice.