[M] Change in ...osmo-python-tests[master]: Modernize python packaging
osmith has submitted this change. ( https://gerrit.osmocom.org/c/python/osmo-python-tests/+/43074?usp=email ) Change subject: Modernize python packaging ...................................................................... Modernize python packaging When building the debian package, we get the following deprecation warning. Modernize the python packaging to fix it, before it stops working altogether. Keep the old setup.py in contrib so we can still build for older debian releases. Fix for: SetuptoolsDeprecationWarning: setup.py install is deprecated. !! ******************************************************************************** Please avoid running ``setup.py`` directly. Instead, use pypa/build, pypa/installer or other standards-based tools. See https://blog.ganssle.io/articles/2021/10/setup-py-deprecated.html for details. ******************************************************************************** !! Depends: docker-playground I9bb5d13897dbf1be9855c4eba29c6b3a2c35729c Change-Id: I186544163ab02834c33f1363f3a06cd380898f56 --- R contrib/setup.py M debian/control M debian/rules A pyproject.toml 4 files changed, 57 insertions(+), 1 deletion(-) Approvals: fixeria: Looks good to me, but someone else must approve Jenkins Builder: Verified daniel: Looks good to me, approved diff --git a/setup.py b/contrib/setup.py old mode 100755 new mode 100644 similarity index 86% rename from setup.py rename to contrib/setup.py index 3818dd7..dd56f04 --- a/setup.py +++ b/contrib/setup.py @@ -1,4 +1,7 @@ #!/usr/bin/env python3 +# ----------------------------------------------------------------------------- +# Legacy build script for older distributions that can't use pyproject.toml yet +# ----------------------------------------------------------------------------- # Osmopython: test utilities for osmocom programs # Copyright (C) 2013 Katerina Barone-Adesi kat.obsc@gmail.com diff --git a/debian/control b/debian/control index a1a272a..4b9295a 100644 --- a/debian/control +++ b/debian/control @@ -2,7 +2,11 @@ Section: python Priority: optional Maintainer: Osmocom team <openbsc@lists.osmocom.org> -Build-Depends: debhelper (>= 10), dh-python, python3, python3-setuptools +Build-Depends: + debhelper (>= 10), + pybuild-plugin-pyproject | dh-python, + python3, + python3-setuptools, Standards-Version: 3.9.8 Homepage: https://gitea.osmocom.org/cellular-infrastructure/osmo-python-tests Vcs-Git: https://gitea.osmocom.org/cellular-infrastructure/osmo-python-tests diff --git a/debian/rules b/debian/rules index 641186e..378d4cc 100755 --- a/debian/rules +++ b/debian/rules @@ -2,3 +2,17 @@ %: dh $@ --with python3 --buildsystem=pybuild + +# Remove this section and setup.py after python3-setuptools in all debian +# releases we support is >= 70 +override_dh_auto_clean: + set -x; \ + SETUPTOOLS_VER="$$(dpkg-query \ + --showformat='$${Version}' \ + --show python3-setuptools)"; \ + if dpkg --compare-versions "$$SETUPTOOLS_VER" lt 70.0.0; then \ + rm -f pyproject.toml; \ + install -Dm755 contrib/setup.py setup.py; \ + fi + + dh_auto_clean diff --git a/pyproject.toml b/pyproject.toml new file mode 100644 index 0000000..7c8c498 --- /dev/null +++ b/pyproject.toml @@ -0,0 +1,35 @@ +# When modifying this file, consider adjusting contrib/setup.py for old distros + +[project] +name = "osmopython" +description = "Osmocom testing scripts" +license = "AGPL-3.0-or-later" +dynamic = ["version"] +authors = [ + {name = "Osmocom team", email = "openbsc@lists.osmocom.org"}, + {name = "Katerina Barone-Adesi", email = "kat.obsc@gmail.com"}, +] + +[build-system] +requires = ["setuptools", "wheel"] +build-backend = "setuptools.build_meta" + +[tool.setuptools] +script-files = [ + "scripts/osmodumpdoc.py", + "scripts/osmotestvty.py", + "scripts/osmotestconfig.py", + "scripts/osmo_ctrl.py", + "scripts/osmo_rate_ctr2csv.py", + "scripts/osmo_trap2cgi.py", + "scripts/osmo_interact_vty.py", + "scripts/osmo_interact_ctrl.py", + "scripts/osmo_verify_transcript_vty.py", + "scripts/osmo_verify_transcript_ctrl.py", +] + +[tool.setuptools.packages.find] +include = ["osmopy*"] + +[tool.setuptools.dynamic] +version = {attr = "osmopy.__version__"} -- To view, visit https://gerrit.osmocom.org/c/python/osmo-python-tests/+/43074?usp=email To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings?usp=email Gerrit-MessageType: merged Gerrit-Project: python/osmo-python-tests Gerrit-Branch: master Gerrit-Change-Id: I186544163ab02834c33f1363f3a06cd380898f56 Gerrit-Change-Number: 43074 Gerrit-PatchSet: 1 Gerrit-Owner: osmith <osmith@sysmocom.de> Gerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: daniel <dwillmann@sysmocom.de> Gerrit-Reviewer: fixeria <vyanitskiy@sysmocom.de> Gerrit-Reviewer: osmith <osmith@sysmocom.de>
participants (1)
-
osmith