Skip to content

Commit 2867a2b

Browse files
committed
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
1 parent bb772ee commit 2867a2b

4 files changed

Lines changed: 57 additions & 1 deletion

File tree

setup.py renamed to contrib/setup.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,7 @@
11
#!/usr/bin/env python3
2+
# -----------------------------------------------------------------------------
3+
# Legacy build script for older distributions that can't use pyproject.toml yet
4+
# -----------------------------------------------------------------------------
25
# Osmopython: test utilities for osmocom programs
36
# Copyright (C) 2013 Katerina Barone-Adesi kat.obsc@gmail.com
47

debian/control

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,11 @@ Source: osmo-python-tests
22
Section: python
33
Priority: optional
44
Maintainer: Osmocom team <openbsc@lists.osmocom.org>
5-
Build-Depends: debhelper (>= 10), dh-python, python3, python3-setuptools
5+
Build-Depends:
6+
debhelper (>= 10),
7+
pybuild-plugin-pyproject | dh-python,
8+
python3,
9+
python3-setuptools,
610
Standards-Version: 3.9.8
711
Homepage: https://gitea.osmocom.org/cellular-infrastructure/osmo-python-tests
812
Vcs-Git: https://gitea.osmocom.org/cellular-infrastructure/osmo-python-tests

debian/rules

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,3 +2,17 @@
22

33
%:
44
dh $@ --with python3 --buildsystem=pybuild
5+
6+
# Remove this section and setup.py after python3-setuptools in all debian
7+
# releases we support is >= 70
8+
override_dh_auto_clean:
9+
set -x; \
10+
SETUPTOOLS_VER="$$(dpkg-query \
11+
--showformat='$${Version}' \
12+
--show python3-setuptools)"; \
13+
if dpkg --compare-versions "$$SETUPTOOLS_VER" lt 70.0.0; then \
14+
rm -f pyproject.toml; \
15+
install -Dm755 contrib/setup.py setup.py; \
16+
fi
17+
18+
dh_auto_clean

pyproject.toml

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
# When modifying this file, consider adjusting contrib/setup.py for old distros
2+
3+
[project]
4+
name = "osmopython"
5+
description = "Osmocom testing scripts"
6+
license = "AGPL-3.0-or-later"
7+
dynamic = ["version"]
8+
authors = [
9+
{name = "Osmocom team", email = "openbsc@lists.osmocom.org"},
10+
{name = "Katerina Barone-Adesi", email = "kat.obsc@gmail.com"},
11+
]
12+
13+
[build-system]
14+
requires = ["setuptools", "wheel"]
15+
build-backend = "setuptools.build_meta"
16+
17+
[tool.setuptools]
18+
script-files = [
19+
"scripts/osmodumpdoc.py",
20+
"scripts/osmotestvty.py",
21+
"scripts/osmotestconfig.py",
22+
"scripts/osmo_ctrl.py",
23+
"scripts/osmo_rate_ctr2csv.py",
24+
"scripts/osmo_trap2cgi.py",
25+
"scripts/osmo_interact_vty.py",
26+
"scripts/osmo_interact_ctrl.py",
27+
"scripts/osmo_verify_transcript_vty.py",
28+
"scripts/osmo_verify_transcript_ctrl.py",
29+
]
30+
31+
[tool.setuptools.packages.find]
32+
include = ["osmopy*"]
33+
34+
[tool.setuptools.dynamic]
35+
version = {attr = "osmopy.__version__"}

0 commit comments

Comments
 (0)