Merge ~ahasenack/ubuntu/+source/mod-wsgi:noble-mod-wsgi-python-3.12-ftbfs into ubuntu/+source/mod-wsgi:ubuntu/devel

Proposed by Andreas Hasenack
Status: Merged
Approved by: git-ubuntu bot
Approved revision: not available
Merged at revision: 4486a9ea12da58abc54e4602ceaea2e635ecafeb
Proposed branch: ~ahasenack/ubuntu/+source/mod-wsgi:noble-mod-wsgi-python-3.12-ftbfs
Merge into: ubuntu/+source/mod-wsgi:ubuntu/devel
Diff against target: 126 lines (+94/-1)
4 files modified
debian/changelog (+7/-0)
debian/control (+2/-1)
debian/patches/no-more-distutils.patch (+84/-0)
debian/patches/series (+1/-0)
Reviewer Review Type Date Requested Status
git-ubuntu bot Approve
Bryce Harrington (community) Approve
Canonical Server Reporter Pending
Review via email: mp+456701@code.launchpad.net

Description of the change

Fix build with python 3.12 which dropped the distutils module.

Upstream committed other changes to support 3.12, mainly in their own github test suite configuration, tox, setup.py, but we don't run those, and I opted to pick the simpler patch that works. At some point debian will update to version 5.0.0, which has all of this included, I suppose.

Also note I didn't pick the ./configure changes from the upstream patch, since ./configure is regenerated from configure.ac during package build.

PPA with proposed enabled, showing a good build with python 3.12: https://launchpad.net/~ahasenack/+archive/ubuntu/python312-dropped-distutils/+packages

DEP8: green
Results: (from http://autopkgtest.ubuntu.com/results/autopkgtest-noble-ahasenack-python312-dropped-distutils/?format=plain)
  mod-wsgi @ amd64:
    01.12.23 19:04:58 Log 🗒️ ✅ Triggers: mod-wsgi/4.9.4-1ubuntu1~ppa2

https://autopkgtest.ubuntu.com/results/autopkgtest-noble-ahasenack-python312-dropped-distutils/noble/amd64/m/mod-wsgi/20231201_190458_0e266@/log.gz

Salsa MP: https://salsa.debian.org/python-team/packages/mod-wsgi/-/merge_requests/1 (which I also linked to from the debian bug https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=1055566)

To post a comment you must log in.
Revision history for this message
Bryce Harrington (bryce) wrote :

Confirmed the package in the PPA builds, however the build log shows that distutils still is installed, with no mention of setuptools:

     python3-dev (= 3.11.4-5ubuntu1),
     python3-distutils (= 3.11.5-1),
     python3-lib2to3 (= 3.11.5-1),

This isn't mentioned in d/control, however after uninstalling python3-distutils and running `install-build-deps .` on the source package dir, it does try to pull it in:

    The following NEW packages will be installed:
      apache2-dev libapr1-dev libaprutil1-dev libpython3-all-dev libpython3-dev libpython3.11-dev libsctp-dev libsctp1
      python3-all python3-all-dev python3-dev python3-distutils python3-lib2to3 python3.11-dev
    0 upgraded, 14 newly installed, 0 to remove and 287 not upgraded.

Notice though that this is with python3.11. I manually installed python3.12, but my system still builds with python3.12, although it does give an interesting error:

    Unpacking python3-all-dev (3.11.4-5) ...
    Setting up python3-distutils (3.11.5-1) ...
    python3.12: can't get files for byte-compilation
    Setting up python3-all (3.11.4-5) ...

Anyway, I can't point to an actual problem so will give a +1. The changes themselves LGTM, and suspect the problem is more just that the python transition is still ongoing.

review: Approve
Revision history for this message
git-ubuntu bot (git-ubuntu-bot) wrote :

Approvers: ahasenack, bryce
Uploaders: ahasenack, bryce
MP auto-approved

review: Approve
Revision history for this message
Andreas Hasenack (ahasenack) wrote :

python3-distutils 3.11.5-1 has an empty 3.12 directory:

(...)
/usr/lib/python3.11/distutils/util.py
/usr/lib/python3.11/distutils/versionpredicate.py
/usr/lib/python3.12

I would also wait for the transition to be complete.

Thanks for the review, uploading:

Uploading mod-wsgi_4.9.4-1ubuntu1.dsc
Uploading mod-wsgi_4.9.4-1ubuntu1.debian.tar.xz
Uploading mod-wsgi_4.9.4-1ubuntu1_source.buildinfo
Uploading mod-wsgi_4.9.4-1ubuntu1_source.changes

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1diff --git a/debian/changelog b/debian/changelog
2index 4d7e070..119c076 100644
3--- a/debian/changelog
4+++ b/debian/changelog
5@@ -1,3 +1,10 @@
6+mod-wsgi (4.9.4-1ubuntu1) noble; urgency=medium
7+
8+ * d/p/no-more-distutils.patch: Migrate from distutils to setuptools +
9+ sysconfig since python 3.12 dropped distutils (LP: #2045416)
10+
11+ -- Andreas Hasenack <andreas@canonical.com> Fri, 01 Dec 2023 13:33:53 -0300
12+
13 mod-wsgi (4.9.4-1build2) noble; urgency=medium
14
15 * No-change rebuild with Python 3.12 as supported version
16diff --git a/debian/control b/debian/control
17index e7781af..32f4024 100644
18--- a/debian/control
19+++ b/debian/control
20@@ -1,7 +1,8 @@
21 Source: mod-wsgi
22 Section: httpd
23 Priority: optional
24-Maintainer: Debian Python Team <team+python@tracker.debian.org>
25+Maintainer: Ubuntu Developers <ubuntu-devel-discuss@lists.ubuntu.com>
26+XSBC-Original-Maintainer: Debian Python Team <team+python@tracker.debian.org>
27 Uploaders: Emmanuel Arias <eamanu@yaerobi.com>,
28 Build-Depends: apache2-dev (>= 2.4),
29 debhelper-compat (= 13),
30diff --git a/debian/patches/no-more-distutils.patch b/debian/patches/no-more-distutils.patch
31new file mode 100644
32index 0000000..3c73cb0
33--- /dev/null
34+++ b/debian/patches/no-more-distutils.patch
35@@ -0,0 +1,84 @@
36+commit 70bed479cb0270ecc5faebcdcad40bc27b866f4f
37+Author: Jared Deckard <jared@shademaps.com>
38+Date: Fri Sep 22 11:19:37 2023 -0500
39+
40+ Migrate from distutils to setuptools + sysconfig
41+
42+Bug-Debian: https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=1055566
43+Bug-Ubuntu: https://bugs.launchpad.net/ubuntu/+source/mod-wsgi/+bug/2045416
44+Origin: upstream, https://github.com/GrahamDumpleton/mod_wsgi/commit/70bed479cb0270ecc5faebcdcad40bc27b866f4f
45+Applied-Upstream: 5.0.0
46+Last-Update: 2023-12-01
47+
48+diff --git a/configure.ac b/configure.ac
49+index 25962bc..44f4718 100644
50+--- a/configure.ac
51++++ b/configure.ac
52+@@ -141,9 +141,8 @@ PYTHONLIBDIR=`${PYTHON} -c 'from sys import stdout; \
53+ import sysconfig; \
54+ stdout.write(sysconfig.get_config_var("LIBDIR"))'`
55+ PYTHONCFGDIR=`${PYTHON} -c 'from sys import stdout; \
56+- import distutils.sysconfig; \
57+- stdout.write(distutils.sysconfig.get_python_lib(plat_specific=1, \
58+- standard_lib=1) +"/config")'`
59++ import sysconfig; \
60++ stdout.write(sysconfig.get_path("platstdlib") +"/config")'`
61+ PYTHONFRAMEWORKDIR=`${PYTHON} -c 'from sys import stdout; \
62+ import sysconfig; \
63+ stdout.write(sysconfig.get_config_var("PYTHONFRAMEWORKDIR"))'`
64+diff --git a/setup.py b/setup.py
65+index e0c8c84..4169375 100644
66+--- a/setup.py
67++++ b/setup.py
68+@@ -15,9 +15,9 @@ except ImportError:
69+ from urllib import urlretrieve
70+
71+ from setuptools import setup
72+-from distutils.core import Extension
73+-from distutils.sysconfig import get_config_var as get_python_config
74+-from distutils.sysconfig import get_python_lib
75++from setuptools.extension import Extension
76++from sysconfig import get_config_var as get_python_config
77++from sysconfig import get_path as get_python_lib
78+
79+ # First work out what all the available source code files are that should
80+ # be compiled.
81+@@ -293,7 +293,7 @@ else:
82+
83+ PYTHON_LIBDIR = get_python_config('LIBDIR')
84+ APXS_LIBDIR = get_apxs_config('LIBDIR')
85+- PYTHON_CFGDIR = get_python_lib(plat_specific=1, standard_lib=1) + '/config'
86++ PYTHON_CFGDIR = get_python_lib('platstdlib') + '/config'
87+
88+ if PYTHON_LDVERSION and PYTHON_LDVERSION != PYTHON_VERSION:
89+ PYTHON_CFGDIR = '%s-%s' % (PYTHON_CFGDIR, PYTHON_LDVERSION)
90+@@ -402,7 +402,7 @@ if os.name != 'nt':
91+ not get_python_config('PYTHONFRAMEWORK')):
92+ print(SHARED_LIBRARY_WARNING)
93+
94+-# Now finally run distutils.
95++# Now finally run setuptools.
96+
97+ package_name = 'mod_wsgi'
98+ long_description = open('README.rst').read()
99+diff --git a/src/server/__init__.py b/src/server/__init__.py
100+index 33f0fad..f2d8632 100644
101+--- a/src/server/__init__.py
102++++ b/src/server/__init__.py
103+@@ -35,7 +35,6 @@ _py_dylib = ''
104+
105+ try:
106+ import sysconfig
107+- import distutils.sysconfig
108+
109+ _py_soabi = sysconfig.get_config_var('SOABI')
110+
111+@@ -63,7 +62,7 @@ if not os.path.exists(MOD_WSGI_SO) and _py_soabi:
112+ MOD_WSGI_SO = posixpath.join(posixpath.dirname(__file__), MOD_WSGI_SO)
113+
114+ if not os.path.exists(MOD_WSGI_SO) and os.name == 'nt':
115+- MOD_WSGI_SO = 'mod_wsgi%s' % distutils.sysconfig.get_config_var('EXT_SUFFIX')
116++ MOD_WSGI_SO = 'mod_wsgi%s' % sysconfig.get_config_var('EXT_SUFFIX')
117+ MOD_WSGI_SO = os.path.join(os.path.dirname(__file__), MOD_WSGI_SO)
118+ MOD_WSGI_SO = MOD_WSGI_SO.replace('\\', '/')
119+
120diff --git a/debian/patches/series b/debian/patches/series
121new file mode 100644
122index 0000000..d66684d
123--- /dev/null
124+++ b/debian/patches/series
125@@ -0,0 +1 @@
126+no-more-distutils.patch

Subscribers

People subscribed via source and target branches