🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Thread View: linux.debian.maint.python
4 messages
4 total messages Started by Ben Finney Sat, 24 Oct 2026 03:50
Setuptools incorrectly overrides ‘packages.find.exclude’, causes ‘dh_python3’ to complain “[…] includes a common build directory...
#45
Author: Ben Finney
Date: Sat, 24 Oct 2026 03:50
84 lines
7101 bytes
--NY8nOlxCLBLMu0lC
Content-Type: text/plain; charset=utf-8
Content-Disposition: inline
Content-Transfer-Encoding: quoted-printable

Howdy all,

Recently, =E2=80=98dh_python3=E2=80=99 detects a =E2=80=9Ccommon build dire=
ctory name=E2=80=9D in the
built package, and then exits with error. Example:

=3D=3D=3D=3D=3D
   dh_python3 -O--buildsystem=3Dpybuild
E: dh_python3 fs:312: [yourpackage] includes a common build directory name =
'test' as a module. Likely due to a mis-configured build system installing =
things it shouldn't.
=3D=3D=3D=3D=3D

This is a good check. But why does that directory get installed?

The =E2=80=9Cmis-configured build system installing things it shouldn't=E2=
=80=9D might
in some cases be Setuptools, ignoring an explicit =E2=80=9Cexclude=E2=80=9D=
 directive.

This years-old issue in Setuptools explores the problem
=E2=80=9C[BUG] options.packages.find.exclude not taking effect when include=
_package_data =3D True=E2=80=9D
<URL: https://github.com/pypa/setuptools/issues/3260>.

The developer responses are along the line of =E2=80=9Cthat's intentional=
=E2=80=9D
without much to offer in resolving the issue. Then this issue comment
<URL: https://github.com/pypa/setuptools/issues/3260#issuecomment-464288980=
1>
gives a (very verbose!) explanation of what's going on.

In brief: Setuptools is, not for the first time, muddling two things
into one. A specification to *include* a directory in the built SDist
(e.g. =E2=80=9Cinclude the test suite directory =E2=80=98test=E2=80=99=E2=
=80=9D), is being incorrectly
interpreted to *override* an explicit =E2=80=9Cexclude this from the built
wheel=E2=80=9D.

The =E2=80=98packages.find.exclude=E2=80=99 directive is, in some condition=
s, ignored.
The directory, explicitly specified to be excluded from the wheel, ends
up in the wheel anyway and gets installed, where =E2=80=98dh_python3=E2=80=
=99 finds it
and (correctly) complains it shouldn't be there.

That lengthy issue comment also offers some options to work around the
bug. Which of them, or what other workaround, can we expect to work in
Debian packages?

--
 \         =E2=80=9CFaith may be defined briefly as an illogical belief in =
the |
  `\                  occurrence of the improbable.=E2=80=9D =E2=80=94Henry=
 L. Mencken |
_o__)                                                                  |
Ben Finney

--NY8nOlxCLBLMu0lC
Content-Type: application/pgp-signature; name=signature.asc

-----BEGIN PGP SIGNATURE-----

iQIzBAABCAAdFiEEXfQ3Ydd+6BMR2Ur+B+hY8vqvVjgFAmrcKKQACgkQB+hY8vqv
VjgNzQ/+PT/sWPEgeYyuxdkl/o0/Lbk0IHGDFexmj/SifHQpGJIjhDFXO8y0PC1X
un1blfCBqTxKKRL/ze9FRnGbTAsvqfpm+2/2e+bpghIHGcETxMXqMvM0KS+2tTp2
lCIFiOSCwfszl9hZG2SjaZ1V8q2FqVQk+u56W3t46yZZHzlSAJZeNANiKi6m0UwY
0Eu+Up1287Suv3zlKqibn5EBn4xUgktNehmbat06fKsK4zoHxcvsvUplOML97vQ4
8fbX5WnpKN2w09LPI5d2aWtPY0z6iPRF7S254O4AgilZSrqUSM0Z2pIowRrneZH+
eo3YqwIAKQoQIRZXnxA1ATQrrfoEiiJjU7CaV/Qx7Am0CtgUjjM4czL8REdYMAj9
rzjzMR348bTzlg1RGff2yZ1bzle1LRcpZeZ8oKwpQ4T0S5g0Lnn1xQIwIyCi8yW/
7Ys50pWHW+eI+cBACXbB9t9nKwWFPTG+OjdWtt/l0YfDVxphesQp0j1kerClawwK
Q4RUBnukXXy25A++fPy/vggpAaljd10Z+9LCmyeSGNffxv2vA9GT90pHZQ8O80qE
mHePVNDmRPy7CzmPvT0tRRfq2zo8GA1KMqW2UI4Z4/IXN47RDL6C4aDnUFoa/vlD
lmjb/td9gi/XhhvcSSwFavPCfc1N+mqhuE7bWdWtFaVhzeWw1bw=
=4SpO
-----END PGP SIGNATURE-----

--NY8nOlxCLBLMu0lC--
Re: Setuptools incorrectly overrides ‘packages.find.exclude’, causes ‘dh_python3’ to complain “[…] includes a common build direc...
#47
Author: Colin Watson
Date: Sun, 25 Oct 2026 21:30
26 lines
3186 bytes
On Sat, Oct 24, 2026 at 02:40:20PM +1100, Ben Finney wrote:
>Recently, ‘dh_python3’ detects a “common build directory name” in the
>built package, and then exits with error. Example:
>
>=====
>   dh_python3 -O--buildsystem=pybuild
>E: dh_python3 fs:312: [yourpackage] includes a common build directory name 'test' as a module. Likely due to a mis-configured build system installing things it shouldn't.
>=====
>
>This is a good check. But why does that directory get installed?
[...]
>That lengthy issue comment also offers some options to work around the
>bug. Which of them, or what other workaround, can we expect to work in
>Debian packages?

In my experience, using "include" rather than "exclude" is almost always 
the correct fix.  "exclude" goes wrong as soon as anything else is 
present in the build tree that looks vaguely like a Python package; I 
commonly see it accidentally including such directories as "build", 
"debian", and "docs".

I've generally had good luck upstreaming patches to use "include" 
instead.

-- 
Colin Watson (he/him)                              [cjwatson@debian.org]
Re: Setuptools incorrectly overrides ‘packages.find.exclude’, causes ‘dh_python3’ to complain “[…] includes a common build dire...
#48
Author: Ben Finney
Date: Sun, 25 Oct 2026 22:50
16 lines
2791 bytes
Colin Watson <cjwatson@debian.org> writes:

> I've generally had good luck upstreaming patches to use "include"
> instead.

Thank you.

The amount of blind groping for a workaround is distressing. Do we know
what progress has been made with motivating the Setuptools developer
community to address this fault?

-- 
 \            “Choose mnemonic identifiers. If you can't remember what |
  `\                mnemonic means, you've got a problem.” —Larry Wall |
_o__)                                                                  |
Ben Finney
Re: Setuptools incorrectly overrides ‘packages.find.exclude’, causes ‘dh_python3’ to complain “[…] includes a common build direc...
#53
Author: Colin Watson
Date: Mon, 02 Nov 2026 12:30
15 lines
2573 bytes
On Mon, Oct 26, 2026 at 09:42:53AM +1100, Ben Finney wrote:
>Colin Watson <cjwatson@debian.org> writes:
>> I've generally had good luck upstreaming patches to use "include"
>> instead.
>
>Thank you.
>
>The amount of blind groping for a workaround is distressing. Do we know
>what progress has been made with motivating the Setuptools developer
>community to address this fault?

No idea, sorry!

-- 
Colin Watson (he/him)                              [cjwatson@debian.org]
Thread Navigation

This is a paginated view of messages in the thread with full content displayed inline.

Messages are displayed in chronological order, with the original post highlighted in green.

Use pagination controls to navigate through all messages in large threads.

Back to All Threads