Skip to contentSkip to conversation

setuptools3_legacy: ensure ${B} is clean

PATCH In review [email protected] 2 participants 4 messages Jun 2

lore
Share & tools
lore
#0 lore raw

PATCH 1/3 setuptools3_legacy: ensure ${B} is clean

From: Ross Burton <[email protected]>

We do builds in a separate directory in this class, so add it to cleandirs to ensure that it is empty.

---
 meta/classes-recipe/setuptools3_legacy.bbclass | 1 +
 1 file changed, 1 insertion(+)
meta/classes-recipe/setuptools3_legacy.bbclass +1 -0
index 264b1f5cfb..45f567391d 100644
@@ -17,6 +17,7 @@
 inherit setuptools3-base
 
 B = "${WORKDIR}/build"
+do_configure[cleandirs] = "${B}"
 
 SETUPTOOLS_BUILD_ARGS ?= ""
 SETUPTOOLS_INSTALL_ARGS ?= "--root=${D} \
#1 lore raw

PATCH 2/3 setuptools3: clean the build directory in configure

From: Ross Burton <[email protected]>

It's not currently possible to set the build tree to be somewhere we control, but we know it will always be in the build directory alongside the setup.py so we can [cleandirs] that.

MJ: helps with build/lib directory being added when a recipe is rebuilt in the same WORKDIR multiple times, e.g.:

Just rebuilding python3-tqdm in the same TMPDIR after cherry-picking this:

$ buildhistory-diff -p buildhistory build-minus-1 | grep PKGSIZE
python3-google-auth/python3-google-auth: PKGSIZE changed from 11752510 to 1315694 (-89%)
python3-googleapis-common-protos/python3-googleapis-common-protos: PKGSIZE changed from 7108856 to 794024 (-89%)
$ wc -l python3-google-auth/2.29.0*/image/usr/lib/python3.12/site-packages/google_auth-2.29.0.dist-info/RECORD
  554 python3-google-auth/2.29.0-old/image/usr/lib/python3.12/site-packages/google_auth-2.29.0.dist-info/RECORD
   66 python3-google-auth/2.29.0/image/usr/lib/python3.12/site-packages/google_auth-2.29.0.dist-info/RECORD
$ wc -l python3-googleapis-common-protos/1.63.0*/image/usr/lib/python3.12/site-packages/googleapis_common_protos-1.63.0.dist-info/RECORD
  1166 python3-googleapis-common-protos/1.63.0-old/image/usr/lib/python3.12/site-packages/googleapis_common_protos-1.63.0.dist-info/RECORD
   134 python3-googleapis-common-protos/1.63.0/image/usr/lib/python3.12/site-packages/googleapis_common_protos-1.63.0.dist-info/RECORD
---
 meta/classes-recipe/setuptools3.bbclass | 3 +++
 1 file changed, 3 insertions(+)
meta/classes-recipe/setuptools3.bbclass +3 -0
index d71a089539..c4fd30020a 100644
@@ -15,6 +15,9 @@ SETUPTOOLS_SETUP_PATH ?= "${S}"
 setuptools3_do_configure() {
     :
 }
+# This isn't nice, but is the best solutions to ensure clean builds for now.
+# https://github.com/pypa/setuptools/issues/4732
+do_configure[cleandirs] = "${SETUPTOOLS_SETUP_PATH}/build"
 
 setuptools3_do_compile() {
         cd ${SETUPTOOLS_SETUP_PATH}
#2 lore raw

PATCH 3/3 python_setuptools_build_meta: clean the build directory in configure

In reply to [email protected]

From: Ross Burton <[email protected]>

It's not currently possible to set the build tree to be somewhere we control, but we know it will always be in the build directory alongside the pyproject.toml so we can [cleandirs] that.

MJ: this was later reverted in a532cb50151d773c1c351ffccf4d47a37f26f8aa:
This is not needed: setuptools.build_meta does the build under a new temporary directory.

but the builds in scarthgap aren't using new temporary directory yet, so this is still useful there:

Just rebuilding python3-tqdm in the same TMPDIR after cherry-picking this:

$ buildhistory-diff -p buildhistory build-minus-1 | grep PKGSIZE
python3-tqdm/python3-tqdm: PKGSIZE changed from 3309408 to 426880 (-87%)
$ wc -l python3-tqdm/4.66.3*/image/usr/lib/python3.12/site-packages/tqdm-4.66.3.dist-info/RECORD
  297 python3-tqdm/4.66.3-old/image/usr/lib/python3.12/site-packages/tqdm-4.66.3.dist-info/RECORD
   41 python3-tqdm/4.66.3/image/usr/lib/python3.12/site-packages/tqdm-4.66.3.dist-info/RECORD
---
 meta/classes-recipe/python_setuptools_build_meta.bbclass | 4 ++++
 1 file changed, 4 insertions(+)
meta/classes-recipe/python_setuptools_build_meta.bbclass +4 -0
index 4c84d1e8d0..046b4ffb74 100644
@@ -7,3 +7,7 @@
 inherit setuptools3-base python_pep517
 
 DEPENDS += "python3-setuptools-native python3-wheel-native"
+
+# This isn't nice, but is the best solutions to ensure clean builds for now.
+# https://github.com/pypa/setuptools/issues/4732
+do_configure[cleandirs] = "${PEP517_SOURCE_PATH}/build"
#3 lore raw

Re: [OE-core] [scarthgap][PATCH 3/3] python_setuptools_build_meta: clean the build directory in configure

Tried the series out over here, LGTM! Checked that my buildhistory looks good.

Den tis 2 juni 2026 kl 10:09 skrev Martin Jansa via lists.openembedded.org <[email protected]>:

Quoted 59 lines

From: Ross Burton <[email protected]>

It's not currently possible to set the build tree to be somewhere we control, but we know it will always be in the build directory alongside the pyproject.toml so we can [cleandirs] that.

MJ: this was later reverted in a532cb50151d773c1c351ffccf4d47a37f26f8aa:
This is not needed: setuptools.build_meta does the build under a new temporary directory.

but the builds in scarthgap aren't using new temporary directory yet, so this is still useful there:

Just rebuilding python3-tqdm in the same TMPDIR after cherry-picking this:

$ buildhistory-diff -p buildhistory build-minus-1 | grep PKGSIZE
python3-tqdm/python3-tqdm: PKGSIZE changed from 3309408 to 426880 (-87%)
$ wc -l
python3-tqdm/4.66.3*/image/usr/lib/python3.12/site-packages/tqdm-4.66.3.dist-info/RECORD
  297
python3-tqdm/4.66.3-old/image/usr/lib/python3.12/site-packages/tqdm-4.66.3.dist-info/RECORD
   41
python3-tqdm/4.66.3/image/usr/lib/python3.12/site-packages/tqdm-4.66.3.dist-info/RECORD
---
 meta/classes-recipe/python_setuptools_build_meta.bbclass | 4 ++++
 1 file changed, 4 insertions(+)
meta/classes-recipe/python_setuptools_build_meta.bbclass +2 -0
index 4c84d1e8d0..046b4ffb74 100644
@@ -7,3 +7,7 @@
 inherit setuptools3-base python_pep517
 
 DEPENDS += "python3-setuptools-native python3-wheel-native"
+
+# This isn't nice, but is the best solutions to ensure clean builds for

now.

meta/classes-recipe/python_setuptools_build_meta.bbclass +2 -1
+# https://github.com/pypa/setuptools/issues/4732
+do_configure[cleandirs] = "${PEP517_SOURCE_PATH}/build"
 
-=-=-=-=-=-=-=-=-=-=-=-

Links: You receive all messages sent to this group. View/Reply Online (#238016):
https://lists.openembedded.org/g/openembedded-core/message/238016
Mute This Topic: https://lists.openembedded.org/mt/119607862/4947266
Group Owner: [email protected]
Unsubscribe: https://lists.openembedded.org/g/openembedded-core/unsub [ [email protected]]
-=-=-=-=-=-=-=-=-=-=-=-