summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJoshua Watt <jpewhacker@gmail.com>2019-06-21 08:35:54 -0500
committerRichard Purdie <richard.purdie@linuxfoundation.org>2019-11-18 14:42:13 +0000
commit0cec92605874183ab94c60e44b2b56956bde122c (patch)
treebda3f8f03b590c907565140fb30d6a4788db1859
parent099d62754c4a9658d07800d7744162f2fbc0c8bf (diff)
downloadpoky-0cec92605874183ab94c60e44b2b56956bde122c.tar.gz
python3: Reformat sysconfig
Reformats the sysconfig file when packaging. This file is output by using the python pprint function. This function will wrap long lines at 80 characters by default, and will even split strings at whitespace boundaries to do so, e.g.: 'A': 'B is really' ' long' This causes a problem for reproducibility however because there might be lines of differing lengths depending on the build path. These non-reproducible paths are removed, but their effect on string wrapping from pprint remains. To correct this, reformat the entire sysconfig file by re-printing using pprint with an (effectively) unlimited line length. (From OE-Core rev: 01e4409e81c3d037fcba82fbcb3273dd1118490b) Signed-off-by: Joshua Watt <JPEWhacker@gmail.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org> Signed-off-by: Armin Kuster <akuster808@gmail.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
-rw-r--r--meta/recipes-devtools/python/python3/reformat_sysconfig.py21
-rw-r--r--meta/recipes-devtools/python/python3_3.7.4.bb7
2 files changed, 28 insertions, 0 deletions
diff --git a/meta/recipes-devtools/python/python3/reformat_sysconfig.py b/meta/recipes-devtools/python/python3/reformat_sysconfig.py
new file mode 100644
index 0000000000..c4164313e8
--- /dev/null
+++ b/meta/recipes-devtools/python/python3/reformat_sysconfig.py
@@ -0,0 +1,21 @@
1#! /usr/bin/env python3
2#
3# SPDX-License-Identifier: MIT
4#
5# Copyright 2019 by Garmin Ltd. or its subsidiaries
6#
7# A script to reformat python sysconfig
8
9import sys
10import pprint
11l = {}
12g = {}
13with open(sys.argv[1], 'r') as f:
14 exec(f.read(), g, l)
15
16with open(sys.argv[1], 'w') as f:
17 for k in sorted(l.keys()):
18 f.write('%s = ' % k)
19 pprint.pprint(l[k], stream=f, width=sys.maxsize)
20 f.write('\n')
21
diff --git a/meta/recipes-devtools/python/python3_3.7.4.bb b/meta/recipes-devtools/python/python3_3.7.4.bb
index c5a5db1dc3..e9ec6048de 100644
--- a/meta/recipes-devtools/python/python3_3.7.4.bb
+++ b/meta/recipes-devtools/python/python3_3.7.4.bb
@@ -25,6 +25,7 @@ SRC_URI = "http://www.python.org/ftp/python/${PV}/Python-${PV}.tar.xz \
25 file://0001-Makefile-fix-Issue36464-parallel-build-race-problem.patch \ 25 file://0001-Makefile-fix-Issue36464-parallel-build-race-problem.patch \
26 file://0001-bpo-36852-proper-detection-of-mips-architecture-for-.patch \ 26 file://0001-bpo-36852-proper-detection-of-mips-architecture-for-.patch \
27 file://crosspythonpath.patch \ 27 file://crosspythonpath.patch \
28 file://reformat_sysconfig.py \
28 " 29 "
29 30
30SRC_URI_append_class-native = " \ 31SRC_URI_append_class-native = " \
@@ -157,6 +158,12 @@ py_package_preprocess () {
157 ${PKGD}/${libdir}/python${PYTHON_MAJMIN}/_sysconfigdata*.py \ 158 ${PKGD}/${libdir}/python${PYTHON_MAJMIN}/_sysconfigdata*.py \
158 ${PKGD}/${bindir}/python${PYTHON_BINABI}-config 159 ${PKGD}/${bindir}/python${PYTHON_BINABI}-config
159 160
161 # Reformat _sysconfigdata after modifying it so that it remains
162 # reproducible
163 for c in ${PKGD}/${libdir}/python${PYTHON_MAJMIN}/_sysconfigdata*.py; do
164 python3 ${WORKDIR}/reformat_sysconfig.py $c
165 done
166
160 # Recompile _sysconfigdata after modifying it 167 # Recompile _sysconfigdata after modifying it
161 cd ${PKGD} 168 cd ${PKGD}
162 sysconfigfile=`find . -name _sysconfigdata_*.py` 169 sysconfigfile=`find . -name _sysconfigdata_*.py`