Buildroot Archive on lore.kernel.org
 help / color / mirror / Atom feed
* [Buildroot] [PATCH 1/2] target-finalize: generate all *.pyc
@ 2015-03-09 16:24 Samuel Martin
  2015-03-09 16:24 ` [Buildroot] [PATCH 2/2] package/samba4: remove SAMBA4_BUILD_PYC_FILES hook Samuel Martin
                   ` (2 more replies)
  0 siblings, 3 replies; 9+ messages in thread
From: Samuel Martin @ 2015-03-09 16:24 UTC (permalink / raw)
  To: buildroot

This patch generates all *.pyc files from *.py located in
<target>/usr/python*/site-packages, before stripping the rootfs.

This prevents modules from packages that do not compile the *.py
files from disappearing.

Reported-by: Yegor Yefremov <yegorslists@googlemail.com>
Cc: Yegor Yefremov <yegorslists@googlemail.com>
Signed-off-by: Samuel Martin <s.martin49@gmail.com>
---
 Makefile | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/Makefile b/Makefile
index af043a3..ec0b923 100644
--- a/Makefile
+++ b/Makefile
@@ -564,6 +564,11 @@ $(TARGETS_ROOTFS): target-finalize
 
 target-finalize: $(TARGETS)
 	@$(call MESSAGE,"Finalizing target directory")
+ifneq ($(BR2_PACKAGE_PYTHON)$(BR2_PACKAGE_PYTHON3),)
+	PYTHONPATH="$(PYTHON_PATH)" \
+		$(HOST_DIR)/usr/bin/python -c "import compileall; \
+			compileall.compile_dir('$(TARGET_DIR)/usr/lib/python$(PYTHON_VERSION_MAJOR)/site-packages')"
+endif
 	$(foreach hook,$(TARGET_FINALIZE_HOOKS),$($(hook))$(sep))
 	rm -rf $(TARGET_DIR)/usr/include $(TARGET_DIR)/usr/share/aclocal \
 		$(TARGET_DIR)/usr/lib/pkgconfig $(TARGET_DIR)/usr/share/pkgconfig \
-- 
2.1.0

^ permalink raw reply related	[flat|nested] 9+ messages in thread

end of thread, other threads:[~2015-08-05  6:26 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-03-09 16:24 [Buildroot] [PATCH 1/2] target-finalize: generate all *.pyc Samuel Martin
2015-03-09 16:24 ` [Buildroot] [PATCH 2/2] package/samba4: remove SAMBA4_BUILD_PYC_FILES hook Samuel Martin
2015-03-09 16:37 ` [Buildroot] [PATCH 1/2] target-finalize: generate all *.pyc Yegor Yefremov
2015-03-09 17:54 ` Thomas Petazzoni
2015-03-09 21:30   ` Samuel Martin
2015-03-09 21:44     ` Thomas Petazzoni
2015-03-09 21:42   ` Arnout Vandecappelle
2015-03-09 21:46     ` Thomas Petazzoni
2015-08-05  6:26       ` Yegor Yefremov

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox