Article View: linux.debian.maint.python
Article #45Setuptools incorrectly overrides ‘packages.find.exclude’, causes ‘dh_python3’ to complain “[…] includes a common build directory...
From: Ben Finney
Date: Sat, 24 Oct 2026 03:50
Date: Sat, 24 Oct 2026 03:50
84 lines
7101 bytes
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--
Technical Details
Message-ID:
<NRAVz-7wuE-1@gated-at.bofh.it>Path:
mbox-mo1.pugleaf.net!archive.usenet.blueworldhosting.com!usenet.blueworldhosting.com!diablo1.usenet.blueworldhosting.com!news.corradoroberto.it!bofh.it!news.nic.it!robomodShow Full Headers
Complete Article Headers
Path: mbox-mo1.pugleaf.net!archive.usenet.blueworldhosting.com!usenet.blueworldhosting.com!diablo1.usenet.blueworldhosting.com!news.corradoroberto.it!bofh.it!news.nic.it!robomod
From: Ben Finney <bignose@debian.org>
Newsgroups: linux.debian.maint.python
Subject: Setuptools incorrectly overrides ‘packages.find.exclude’, causes ‘dh_python3’ to complain “[…] includes a common build directory name”
Date: Sat, 24 Oct 2026 05:50:01 +0200
Message-ID: <NRAVz-7wuE-1@gated-at.bofh.it>
X-Original-To: debian-python@lists.debian.org
X-Mailbox-Line: From debian-python-request@lists.debian.org Sat Oct 24 03:46:36 2026
Old-Return-Path: <ben@benfinney.id.au>
X-Amavis-Spam-Status: No, score=-1.65 tagged_above=-10000 required=5.3
tests=[BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1,
HEADER_FROM_DIFFERENT_DOMAINS=0.25] autolearn=no autolearn_force=no
X-Policyd-Weight: using cached result; rate: -5.5
X-Greylist: delayed 349 seconds by postgrey-1.37 at bendel; Sat, 24 Oct 2026 03:46:23 UTC
X-Me-Sender: <xms:qijcamqYJi6-XOkvVw5TLO2irJKs_mhmtcztHWcIlsw7dTPS82tv9A>
<xme:qijcark1tmfPhci3S8W7fMajnZTlCQwEWQWR2AOrSis0YIQ9c-Kt3pmT1gDtmwoHQ
5-HEYNAY3YDh1SABo_SPX2p1O7YCSi3hVPao9qD8x-URtkISWMZWGg>
X-Me-Received: <xmr:qijcag2Bh02KLQxbtpTKrNr65l9zdQdraX-dPNrlyLLwlWanMYaaKiJ6KDnbhA>
X-Me-Proxy-Cause: dmFkZTFywL1AQr4e4XRHsYAL1FwQ09pg/oL5dg+m526DibwRNRVmPQocW39ziBORu1aegC
9jpetSqXy32iZNFxz1w5aNEropitqRdHu5Gy8lCy5G8jsrJrXgn2mmVagRsbQbF+Rr2oXk
E1Qcj7QZ1Ub3uanZHUOCazExwvCd4Yxoqc841jhhTlFZvzpOrpWU3TMsYRDwqkriPmCC30
g+pmBcHLB2b71Hz+ekdWAHDlJYz0kKXuXLUU4D8zBmQ9jIxf6kCBon8qhTUS5L8k6A3jVC
dBmrW5iImfLZJ9EBzaH82sem0YCCVw+cnce5cb7tyTRuP0v2EV6Fa8l5u4wyM/e61Ca7YB
47JMsQRDX7rYtDO6WFBr5+fbcgtZpBEIPVvCpWiHOfXQZAnPmMj+EuJ1pD4q9Rnyi57QwX
nD5NibTpu9A3+TjHC9UYSo2IX8KNcgj7mig3ttQas6Er7i0rJ2MA5KmydCfDUB7VFv3nxb
xpkJVBT7YGhcftIoIWJZL5bPALEjgUn59KXeUIUuxvamGGHbUnHFmZSDMO+MXPHPfwckGT
QfbfUKCnBg2vIjfoKjFylYVwzPicTQppypzVnquvfoSMoQhrhzwwZOo93g/HtJv/LjDbc/
yDFugyhjiOgL/Gw3NizNWwni2dhRDmlgjWsx9IltJDelCWO55ZD90UkMaXwg
X-Me-Proxy: <xmx:qijcarAhFWc9jRmQu94fMVbS9K-gi8WE83P_VNG4-3wasBKdkmTLKQ>
<xmx:qijcalxtqC-1gyab9jzcCWvjOBJ_QmEyXTlJcSTFla3RPLXAvp-0Mg>
<xmx:qijcahklcvc14GKkmRfO01v7BzbsQdIGrhKU9j1314hKoGKiP7dXGQ>
<xmx:qijcaiFL-dgFDTBamQdjyWDcj0wcBLgL1x6clmTuSWdL-wO2LW4DVw>
<xmx:qijcapVCpBQGP4qUPafsVloHeh3L79Hs1jdkWSnYdY57SeTVR1lY0A>
<xmx:qijcahkAz48XU3LWBLfTQpHyPEA71F0CZ_9lptgwc3Cl5lO4dmj8AtuWL_Js>
Feedback-ID: i8f8042cb:Fastmail
Mail-Followup-To: Ben Finney <bignose@debian.org>,
debian-python@lists.debian.org
MIME-Version: 1.0
Content-Type: multipart/signed; micalg=pgp-sha256;
protocol="application/pgp-signature"; boundary="NY8nOlxCLBLMu0lC"
Content-Disposition: inline
Openpgp: id=B8B24C06AC128405;url="https://www.benfinney.id.au/contact/bfinney-pubkey.asc";preference=sign
X-Openpgp-Public-Key-ID: 0xB8B24C06AC128405
X-Openpgp-Public-Key-Fingerprint: 517C F14B B2F3 98B0 CB35 4855 B8B2 4C06
AC12 8405
X-Openpgp-Public-Key-URL: https://www.benfinney.id.au/contact/bfinney-pubkey.asc
X-Mailing-List: <debian-python@lists.debian.org> archive/latest/24151
List-ID: <debian-python.lists.debian.org>
List-URL: <https://lists.debian.org/debian-python/>
List-Archive: https://lists.debian.org/msgid-search/atwolcobEap0cH0K@benfinney.id.au
Approved: robomod@news.nic.it
Lines: 84
Organization: linux.* mail to news gateway
Sender: robomod@news.nic.it
X-Original-Date: Sat, 24 Oct 2026 14:40:20 +1100
X-Original-Message-ID: <atwolcobEap0cH0K@benfinney.id.au>