Recent Ubuntu versions (24.04+) disallow pip by default when
installing packages. The recommended approach is to use a virtualenv
instead.
Because of this, "make pip" is failing on such versions.

To prepare CI container migration to Ubuntu 24.04, use a virtualenv
in the make_pip script.

Note: This has been reported on [1]

[1] https://source.denx.de/u-boot/custodians/u-boot-dm/-/issues/37

Signed-off-by: Mattijs Korpershoek <mkorpersh...@kernel.org>
---
This has been tested in docker on ubuntu:24.04 after running:
$ apt install python3 python3-virtualenv

with:
$ ./scripts/make_pip.sh u_boot_pylib "-n"

And shows:
Successfully built u_boot_pylib-0.0.6.tar.gz and 
u_boot_pylib-0.0.6-py3-none-any.whl

Also tested with "$ make pip".
---
 scripts/make_pip.sh | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/scripts/make_pip.sh b/scripts/make_pip.sh
index d2639ffd6e43..f7135938b13c 100755
--- a/scripts/make_pip.sh
+++ b/scripts/make_pip.sh
@@ -106,6 +106,10 @@ fi
 mkdir ${dir}/tests
 cd ${dir}
 
+# Use virtualenv
+virtualenv .venv
+source .venv/bin/activate
+
 # Make sure the tools are up to date
 python3 -m pip install --upgrade build
 python3 -m pip install --upgrade twine
@@ -122,6 +126,8 @@ if [ -n "${upload}" ]; then
        echo "Completed upload of ${tool}"
 fi
 
+# Finish using virtualenv
+deactivate
 rm -rf "${dir}"
 
 echo -e "done\n\n"

---
base-commit: 34820924edbc4ec7803eb89d9852f4b870fa760a
change-id: 20250408-ubuntu-24-04-0dce32b95770

Best regards,
-- 
Mattijs Korpershoek <mkorpersh...@kernel.org>

Reply via email to