From fe1fea4740d68a380c7de344cceaaedcb1895aa3 Mon Sep 17 00:00:00 2001 From: Jan Kardell Date: Thu, 10 Sep 2026 11:14:37 +0200 Subject: [PATCH 1/2] python: add optional remove operator to filespec install script Add -? operator to filespec, to delete a file if present, and do not fail if not present. Rationale: sometimes it's hard to know if the file really exists, e.g. when writing a default filespec. Signed-off-by: Jan Kardell --- lang/python/python-package-install.sh | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/lang/python/python-package-install.sh b/lang/python/python-package-install.sh index 4e7fb7af5b9cf3..aec7ac9f136910 100644 --- a/lang/python/python-package-install.sh +++ b/lang/python/python-package-install.sh @@ -97,6 +97,16 @@ while IFS='|' read -r cmd path file_mode dir_mode; do rm -fR -- "$dest"/$path ;; + -\?) + log "Optionally removing: \"$path\"" + + if ! path_exists "$dest" "$path"; then + log "\"$dest/$path\" not found" + else + rm -fR -- "$dest"/$path + fi + ;; + =) log "Setting recursive permissions \"${file_mode:-(none)}\"/\"${dir_mode:-(none)}\" on \"$path\"" From 0faafd4c7756ca938ff20627ecbdecaf91a359c5 Mon Sep 17 00:00:00 2001 From: Jan Kardell Date: Thu, 10 Sep 2026 11:21:16 +0200 Subject: [PATCH 2/2] python: remove the .dist-info files by default The .dist-info files are not actually used, and take up some unnecessary space on space constricted devices. Signed-off-by: Jan Kardell --- lang/python/python3-package.mk | 1 + 1 file changed, 1 insertion(+) diff --git a/lang/python/python3-package.mk b/lang/python/python3-package.mk index 0f45bdc3cc5a94..f6feba89429be2 100644 --- a/lang/python/python3-package.mk +++ b/lang/python/python3-package.mk @@ -125,6 +125,7 @@ endef define Py3Package/filespec/Default +|$(PYTHON3_PKG_DIR) +-?|$(PYTHON3_PKG_DIR)/*.dist-info endef # $(1) => package name