Openembedded Core Discussions
 help / color / mirror / Atom feed
From: Andrew Geissler <geissonator@gmail.com>
To: openembedded-core@lists.openembedded.org
Cc: Andrew Geissler <geissonator@gmail.com>,
	alejandro.enedino.hernandez-samaniego@xilinx.com
Subject: [PATCH 2/2] python/python3: Add option to remove test files
Date: Wed, 12 Sep 2018 13:40:25 -0700	[thread overview]
Message-ID: <1536784825-4476-2-git-send-email-geissonator@gmail.com> (raw)
In-Reply-To: <1536784825-4476-1-git-send-email-geissonator@gmail.com>

A quick search in the python package shows the following test
directories being included in the python image:
./Python-2.7.14/Lib/bsddb/test
./Python-2.7.14/Lib/sqlite3/test
./Python-2.7.14/Lib/ctypes/test
./Python-2.7.14/Lib/unittest/test
./Python-2.7.14/Lib/lib-tk/test
./Python-2.7.14/Lib/email/test

In some distributions, the extra space taken up by these test files
is very valuable.

The default is to still include the test files.

Signed-off-by: Andrew Geissler <geissonator@gmail.com>
---
 meta/recipes-devtools/python/python3_3.5.5.bb | 9 +++++++++
 meta/recipes-devtools/python/python_2.7.15.bb | 9 +++++++++
 2 files changed, 18 insertions(+)

diff --git a/meta/recipes-devtools/python/python3_3.5.5.bb b/meta/recipes-devtools/python/python3_3.5.5.bb
index c919a97..5d1397a 100644
--- a/meta/recipes-devtools/python/python3_3.5.5.bb
+++ b/meta/recipes-devtools/python/python3_3.5.5.bb
@@ -160,6 +160,11 @@ EOF
 	fi
 }
 
+# Some packages include test/ directories and files. Provide option
+# to not include them.
+
+INCLUDE_TESTS ?= "1"
+
 do_install() {
 	# make install needs the original Makefile, or otherwise the inclues would
 	# go to ${D}${STAGING...}/...
@@ -189,6 +194,10 @@ do_install() {
 	fi
 
 	oe_multilib_header python${PYTHON_BINABI}/pyconfig.h
+
+    if [ "${INCLUDE_TESTS}" -ne "1" ]; then
+        find ${D}${libdir}/python${PYTHON_MAJMIN} -name test -exec rm -rf {} +;
+    fi
 }
 
 do_install_append_class-nativesdk () {
diff --git a/meta/recipes-devtools/python/python_2.7.15.bb b/meta/recipes-devtools/python/python_2.7.15.bb
index 82b65d2..1839624 100644
--- a/meta/recipes-devtools/python/python_2.7.15.bb
+++ b/meta/recipes-devtools/python/python_2.7.15.bb
@@ -90,6 +90,11 @@ do_compile() {
 		OPT="${CFLAGS}"
 }
 
+# Some packages include test/ directories and files. Provide option
+# to not include them.
+
+INCLUDE_TESTS ?= "1"
+
 do_install() {
 	# make install needs the original Makefile, or otherwise the inclues would
 	# go to ${D}${STAGING...}/...
@@ -127,6 +132,10 @@ do_install() {
     if [ -z "${@bb.utils.filter('PACKAGECONFIG', 'bdb', d)}" ]; then
         rm -rf ${D}/${libdir}/python${PYTHON_MAJMIN}/bsddb
     fi
+
+    if [ "${INCLUDE_TESTS}" -ne "1" ]; then
+        find ${D}${libdir}/python${PYTHON_MAJMIN} -name test -exec rm -rf {} +;
+    fi
 }
 
 do_install_append_class-nativesdk () {
-- 
2.7.4



  reply	other threads:[~2018-09-12 20:40 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-09-12 20:40 [PATCH 1/2] python/python3: Remove trailing white spaces Andrew Geissler
2018-09-12 20:40 ` Andrew Geissler [this message]
2018-09-12 21:10   ` [PATCH 2/2] python/python3: Add option to remove test files Burton, Ross
2018-09-13  0:46     ` Andrew Geissler
2018-09-13  9:32       ` Burton, Ross

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1536784825-4476-2-git-send-email-geissonator@gmail.com \
    --to=geissonator@gmail.com \
    --cc=alejandro.enedino.hernandez-samaniego@xilinx.com \
    --cc=openembedded-core@lists.openembedded.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox