python3: don't generate the .pyc files
PATCH 1/1 python3: don't generate the .pyc files
From: Mingli Yu <[email protected]>
Don't generate the .pyc files to reduce the package size.
--- ...1-Makefile.pre.in-don-t-byte-compile.patch | 55 +++++++++++++++++++ meta/recipes-devtools/python/python3_3.9.2.bb | 8 +-- 2 files changed, 56 insertions(+), 7 deletions(-) create mode 100644 meta/recipes-devtools/python/python3/0001-Makefile.pre.in-don-t-byte-compile.patch
meta/recipes-devtools/python/python3/0001-Makefile.pre.in-don-t-byte-compile.patch new file +55 -0
@@ -0,0 +1,55 @@ +From 35a61f9eb5360b28c7209ebf152673a7f30fcae5 Mon Sep 17 00:00:00 2001 +From: Mingli Yu <[email protected]> +Date: Fri, 12 Mar 2021 04:30:10 +0000 +Subject: [PATCH] Makefile.pre.in: don't byte-compile python files + +Don't generate the .pyc files. + +Upstream-Status: Inappropriate [configuration related] + +Signed-off-by: Mingli Yu <[email protected]> +--- + Makefile.pre.in | 27 --------------------------- + 1 file changed, 27 deletions(-) + +diff --git a/Makefile.pre.in b/Makefile.pre.in +index 399dfa6..dfeb280 100644 +--- a/Makefile.pre.in ++++ b/Makefile.pre.in +@@ -1528,33 +1528,6 @@ libinstall: build_all $(srcdir)/Modules/xxmodule.c + $(INSTALL_DATA) $(srcdir)/Modules/xxmodule.c \ + $(DESTDIR)$(LIBDEST)/distutils/tests ; \ + fi +- -PYTHONPATH=$(DESTDIR)$(LIBDEST) $(RUNSHARED) \ +- $(PYTHON_FOR_BUILD) -Wi $(DESTDIR)$(LIBDEST)/compileall.py \ +- -d $(LIBDEST) -f \ +- -x 'bad_coding|badsyntax|site-packages|lib2to3/tests/data' \ +- $(DESTDIR)$(LIBDEST) +- -PYTHONPATH=$(DESTDIR)$(LIBDEST) $(RUNSHARED) \ +- $(PYTHON_FOR_BUILD) -Wi -O $(DESTDIR)$(LIBDEST)/compileall.py \ +- -d $(LIBDEST) -f \ +- -x 'bad_coding|badsyntax|site-packages|lib2to3/tests/data' \ +- $(DESTDIR)$(LIBDEST) +- -PYTHONPATH=$(DESTDIR)$(LIBDEST) $(RUNSHARED) \ +- $(PYTHON_FOR_BUILD) -Wi -OO $(DESTDIR)$(LIBDEST)/compileall.py \ +- -d $(LIBDEST) -f \ +- -x 'bad_coding|badsyntax|site-packages|lib2to3/tests/data' \ +- $(DESTDIR)$(LIBDEST) +- -PYTHONPATH=$(DESTDIR)$(LIBDEST) $(RUNSHARED) \ +- $(PYTHON_FOR_BUILD) -Wi $(DESTDIR)$(LIBDEST)/compileall.py \ +- -d $(LIBDEST)/site-packages -f \ +- -x badsyntax $(DESTDIR)$(LIBDEST)/site-packages +- -PYTHONPATH=$(DESTDIR)$(LIBDEST) $(RUNSHARED) \ +- $(PYTHON_FOR_BUILD) -Wi -O $(DESTDIR)$(LIBDEST)/compileall.py \ +- -d $(LIBDEST)/site-packages -f \ +- -x badsyntax $(DESTDIR)$(LIBDEST)/site-packages +- -PYTHONPATH=$(DESTDIR)$(LIBDEST) $(RUNSHARED) \ +- $(PYTHON_FOR_BUILD) -Wi -OO $(DESTDIR)$(LIBDEST)/compileall.py \ +- -d $(LIBDEST)/site-packages -f \ +- -x badsyntax $(DESTDIR)$(LIBDEST)/site-packages + -PYTHONPATH=$(DESTDIR)$(LIBDEST) $(RUNSHARED) \ + $(PYTHON_FOR_BUILD) -m lib2to3.pgen2.driver $(DESTDIR)$(LIBDEST)/lib2to3/Grammar.txt + -PYTHONPATH=$(DESTDIR)$(LIBDEST) $(RUNSHARED) \ +-- +2.29.2 +
meta/recipes-devtools/python/python3_3.9.2.bb +1 -7
@@ -30,6 +30,7 @@ SRC_URI = "http://www.python.org/ftp/python/${PV}/Python-${PV}.tar.xz \ file://0001-Makefile-do-not-compile-.pyc-in-parallel.patch \ file://0020-configure.ac-setup.py-do-not-add-a-curses-include-pa.patch \ file://0001-Lib-sysconfig.py-use-libdir-values-from-configuratio.patch \ + file://0001-Makefile.pre.in-don-t-byte-compile.patch \ " SRC_URI_append_class-native = " \
@@ -168,13 +169,6 @@ do_install_append() { -e "/^ 'INCLUDEPY'/s,/usr/include,${STAGING_INCDIR},g" \ ${D}${libdir}/python-sysconfigdata/_sysconfigdata.py - # Unfortunately the following pyc files are non-deterministc due to 'frozenset' - # being written without strict ordering, even with PYTHONHASHSEED = 0 - # Upstream is discussing ways to solve the issue properly, until then let's - # just not install the problematic files. - # More info: http://benno.id.au/blog/2013/01/15/python-determinism - rm ${D}${libdir}/python${PYTHON_MAJMIN}/test/__pycache__/test_range.cpython* - rm ${D}${libdir}/python${PYTHON_MAJMIN}/test/__pycache__/test_xml_etree.cpython* } do_install_append_class-nativesdk () {
Signature · 1 line
2.29.2
Apologies, I do not think this is appropriate. We generally follow what the upstream does, and some people might want to package .pyc files to avoid generating them on target.
If you do not want .pyc, make a .bbappend that deletes them in do_install_append().
Alex
Quoted 130 lines · Mingli
From: Mingli Yu <[email protected]>
Don't generate the .pyc files to reduce the package size.
Signed-off-by Mingli Yu <[email protected]>--- ...1-Makefile.pre.in-don-t-byte-compile.patch | 55 +++++++++++++++++++ meta/recipes-devtools/python/python3_3.9.2.bb | 8 +-- 2 files changed, 56 insertions(+), 7 deletions(-) create mode 100644
meta/recipes-devtools/python/python3/0001-Makefile.pre.in-don-t-byte-compile.patchdiff --git
a/meta/recipes-devtools/python/python3/0001-Makefile.pre.in-don-t-byte-compile.patchb/meta/recipes-devtools/python/python3/0001-Makefile.pre.in-don-t-byte-compile.patchnew file mode 100644
index 0000000000..17e904f703
---/dev/null
+++b/meta/recipes-devtools/python/python3/0001-Makefile.pre.in-don-t-byte-compile.patchmeta/recipes-devtools/python/python3/0001-Makefile.pre.in-don-t-byte-compile.patch new file +19
-0@@ -0,0 +1,55 @@ +From 35a61f9eb5360b28c7209ebf152673a7f30fcae5 Mon Sep 17 00:00:00 2001 +From: Mingli Yu <[email protected]> +Date: Fri, 12 Mar 2021 04:30:10 +0000 +Subject: [PATCH] Makefile.pre.in: don't byte-compile python files + +Don't generate the .pyc files. + +Upstream-Status: Inappropriate [configuration related] + +Signed-off-by: Mingli Yu <[email protected]> +--- + Makefile.pre.in | 27 --------------------------- + 1 file changed, 27 deletions(-) + +diff --git a/Makefile.pre.in b/Makefile.pre.in +index 399dfa6..dfeb280 100644 +--- a/Makefile.pre.in ++++ b/Makefile.pre.in +@@ -1528,33 +1528,6 @@ libinstall: build_all$(srcdir)/Modules/xxmodule.c
meta/recipes-devtools/python/python3/0001-Makefile.pre.in-don-t-byte-compile.patch new file +5
-0+ $(INSTALL_DATA) $(srcdir)/Modules/xxmodule.c \ + $(DESTDIR)$(LIBDEST)/distutils/tests ; \ + fi +- -PYTHONPATH=$(DESTDIR)$(LIBDEST) $(RUNSHARED) \ +- $(PYTHON_FOR_BUILD) -Wi $(DESTDIR)$(LIBDEST)/compileall.py\
+- -d $(LIBDEST) -f \ +- -x 'bad_coding|badsyntax|site-packages|lib2to3/tests/data' \ +- $(DESTDIR)$(LIBDEST) +- -PYTHONPATH=$(DESTDIR)$(LIBDEST) $(RUNSHARED) \ +- $(PYTHON_FOR_BUILD) -Wi -O $(DESTDIR)$(LIBDEST)/compileall.py \ +- -d $(LIBDEST) -f \ +- -x 'bad_coding|badsyntax|site-packages|lib2to3/tests/data' \ +- $(DESTDIR)$(LIBDEST) +- -PYTHONPATH=$(DESTDIR)$(LIBDEST) $(RUNSHARED) \ +- $(PYTHON_FOR_BUILD) -Wi -OO $(DESTDIR)$(LIBDEST)/compileall.py \ +- -d $(LIBDEST) -f \ +- -x 'bad_coding|badsyntax|site-packages|lib2to3/tests/data' \ +- $(DESTDIR)$(LIBDEST) +- -PYTHONPATH=$(DESTDIR)$(LIBDEST) $(RUNSHARED) \ +- $(PYTHON_FOR_BUILD) -Wi $(DESTDIR)$(LIBDEST)/compileall.py \ +- -d $(LIBDEST)/site-packages -f \ +- -x badsyntax $(DESTDIR)$(LIBDEST)/site-packages +- -PYTHONPATH=$(DESTDIR)$(LIBDEST) $(RUNSHARED) \ +- $(PYTHON_FOR_BUILD) -Wi -O $(DESTDIR)$(LIBDEST)/compileall.py \ +- -d $(LIBDEST)/site-packages -f \ +- -x badsyntax $(DESTDIR)$(LIBDEST)/site-packages +- -PYTHONPATH=$(DESTDIR)$(LIBDEST) $(RUNSHARED) \ +- $(PYTHON_FOR_BUILD) -Wi -OO $(DESTDIR)$(LIBDEST)/compileall.py \ +- -d $(LIBDEST)/site-packages -f \ +- -x badsyntax $(DESTDIR)$(LIBDEST)/site-packages(quoted diff) +2
-0+ -PYTHONPATH=$(DESTDIR)$(LIBDEST) $(RUNSHARED) \ + $(PYTHON_FOR_BUILD) -m lib2to3.pgen2.driver$(DESTDIR)$(LIBDEST)/lib2to3/Grammar.txt
meta/recipes-devtools/python/python3/0001-Makefile.pre.in-don-t-byte-compile.patch new file +4
-0+ -PYTHONPATH=$(DESTDIR)$(LIBDEST) $(RUNSHARED) \ +-- +2.29.2 +meta/recipes-devtools/python/python3_3.9.2.bb +1
-0@@ -30,6 +30,7 @@ SRC_URI = " http://www.python.org/ftp/python/${PV}/Python-${PV}.tar.xz \ file://0001-Makefile-do-not-compile-.pyc-in-parallel.patch \ file://0020-configure.ac-setup.py-do-not-add-a-curses-include-pa.patch \ file://0001-Lib-sysconfig.py-use-libdir-values-from-configuratio.patch \ + file://0001-Makefile.pre.in-don-t-byte-compile.patch \"SRC_URI_append_class-native = " \
meta/recipes-devtools/python/python3_3.9.2.bb +0
-1@@ -168,13 +169,6 @@ do_install_append() { -e "/^ 'INCLUDEPY'/s,/usr/include,${STAGING_INCDIR},g" \ ${D}${libdir}/python-sysconfigdata/_sysconfigdata.py - # Unfortunately the following pyc files are non-deterministc dueto 'frozenset'
- # being written without strict ordering, even with PYTHONHASHSEED
= 0
- # Upstream is discussing ways to solve the issue properly, until
then let'smeta/recipes-devtools/python/python3_3.9.2.bb +0
-2- # just not install the problematic files. - # More info:http://benno.id.au/blog/2013/01/15/python-determinism
- rm
${D}${libdir}/python${PYTHON_MAJMIN}/test/__pycache__/test_range.cpython*
- rm
${D}${libdir}/python${PYTHON_MAJMIN}/test/__pycache__/test_xml_etree.cpython*
}do_install_append_class-nativesdk () {
--
2.29.2