2013-06-06 01:53:30 +02:00
|
|
|
################################################################################
|
2012-11-07 06:01:21 +01:00
|
|
|
#
|
|
|
|
# python3
|
|
|
|
#
|
2013-06-06 01:53:30 +02:00
|
|
|
################################################################################
|
2013-06-06 01:53:25 +02:00
|
|
|
|
2019-10-17 00:38:34 +02:00
|
|
|
PYTHON3_VERSION_MAJOR = 3.8
|
package/python3: bump to version 3.8.2
Bugfix release, fixing a number of issues. For details, see the
announcement:
https://docs.python.org/release/3.8.2/whatsnew/changelog.html#python-3-8-2-final
Adjust the spacing in the hash file and update the hash of the license file
for a change in copyright years:
-2011, 2012, 2013, 2014, 2015, 2016, 2017, 2018, 2019 Python Software Foundation;
+2011, 2012, 2013, 2014, 2015, 2016, 2017, 2018, 2019, 2020 Python Software Foundation;
Signed-off-by: Peter Korsgaard <peter@korsgaard.com>
2020-02-27 09:22:13 +01:00
|
|
|
PYTHON3_VERSION = $(PYTHON3_VERSION_MAJOR).2
|
2014-03-26 23:22:06 +01:00
|
|
|
PYTHON3_SOURCE = Python-$(PYTHON3_VERSION).tar.xz
|
2017-10-14 14:39:59 +02:00
|
|
|
PYTHON3_SITE = https://python.org/ftp/python/$(PYTHON3_VERSION)
|
2017-04-09 10:34:16 +02:00
|
|
|
PYTHON3_LICENSE = Python-2.0, others
|
2014-07-23 20:33:20 +02:00
|
|
|
PYTHON3_LICENSE_FILES = LICENSE
|
2012-11-07 06:01:21 +01:00
|
|
|
|
2017-09-19 00:34:41 +02:00
|
|
|
# This host Python is installed in $(HOST_DIR), as it is needed when
|
|
|
|
# cross-compiling third-party Python modules.
|
2012-11-07 06:01:21 +01:00
|
|
|
|
2017-04-21 17:24:48 +02:00
|
|
|
HOST_PYTHON3_CONF_OPTS += \
|
|
|
|
--without-ensurepip \
|
|
|
|
--without-cxx-main \
|
|
|
|
--disable-sqlite3 \
|
|
|
|
--disable-tk \
|
|
|
|
--with-expat=system \
|
|
|
|
--disable-curses \
|
|
|
|
--disable-codecs-cjk \
|
|
|
|
--disable-nis \
|
|
|
|
--enable-unicodedata \
|
|
|
|
--disable-test-modules \
|
|
|
|
--disable-idle3 \
|
2019-09-20 16:59:39 +02:00
|
|
|
--disable-ossaudiodev
|
2012-11-07 06:01:21 +01:00
|
|
|
|
2014-03-05 00:29:49 +01:00
|
|
|
# Make sure that LD_LIBRARY_PATH overrides -rpath.
|
|
|
|
# This is needed because libpython may be installed at the same time that
|
|
|
|
# python is called.
|
2016-08-31 22:38:29 +02:00
|
|
|
# Make python believe we don't have 'hg', so that it doesn't try to
|
|
|
|
# communicate over the network during the build.
|
2014-03-05 00:29:49 +01:00
|
|
|
HOST_PYTHON3_CONF_ENV += \
|
2016-08-31 22:38:29 +02:00
|
|
|
LDFLAGS="$(HOST_LDFLAGS) -Wl,--enable-new-dtags" \
|
|
|
|
ac_cv_prog_HAS_HG=/bin/false
|
2014-03-05 00:29:49 +01:00
|
|
|
|
.mk files: bulk aligment and whitespace cleanup of assignments
The Buildroot coding style defines one space around make assignments and
does not align the assignment symbols.
This patch does a bulk fix of offending packages. The package
infrastructures (or more in general assignments to calculated variable
names, like $(2)_FOO) are not touched.
Alignment of line continuation characters (\) is kept as-is.
The sed command used to do this replacement is:
find * -name "*.mk" | xargs sed -i \
-e 's#^\([A-Z0-9a-z_]\+\)\s*\([?:+]\?=\)\s*$#\1 \2#'
-e 's#^\([A-Z0-9a-z_]\+\)\s*\([?:+]\?=\)\s*\([^\\]\+\)$#\1 \2 \3#'
-e 's#^\([A-Z0-9a-z_]\+\)\s*\([?:+]\?=\)\s*\([^\\ \t]\+\s*\\\)\s*$#\1 \2 \3#'
-e 's#^\([A-Z0-9a-z_]\+\)\s*\([?:+]\?=\)\(\s*\\\)#\1 \2\3#'
Brief explanation of this command:
^\([A-Z0-9a-z_]\+\) a regular variable at the beginning of the line
\([?:+]\?=\) any assignment character =, :=, ?=, +=
\([^\\]\+\) any string not containing a line continuation
\([^\\ \t]\+\s*\\\) string, optional whitespace, followed by a
line continuation character
\(\s*\\\) optional whitespace, followed by a line
continuation character
Hence, the first subexpression handles empty assignments, the second
handles regular assignments, the third handles regular assignments with
line continuation, and the fourth empty assignments with line
continuation.
This expression was tested on following test text: (initial tab not
included)
FOO = spaces before
FOO = spaces before and after
FOO = tab before
FOO = tab and spaces before
FOO = tab after
FOO = tab and spaces after
FOO = spaces and tab after
FOO = \
FOO = bar \
FOO = bar space \
FOO = \
GENIMAGE_DEPENDENCIES = host-pkgconf libconfuse
FOO += spaces before
FOO ?= spaces before and after
FOO :=
FOO =
FOO =
FOO =
FOO =
$(MAKE1) CROSS_COMPILE=$(TARGET_CROSS) -C
AT91BOOTSTRAP3_DEFCONFIG = \
AXEL_DISABLE_I18N=--i18n=0
After this bulk change, following manual fixups were done:
- fix line continuation alignment in cegui06 and spice (the sed
expression leaves the number of whitespace between the value and line
continuation character intact, but the whitespace before that could have
changed, causing misalignment.
- qt5base was reverted, as this package uses extensive alignment which
actually makes the code more readable.
Finally, the end result was manually reviewed.
Signed-off-by: Thomas De Schampheleire <thomas.de.schampheleire@gmail.com>
Cc: Yann E. Morin <yann.morin.1998@free.fr>
Cc: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
Signed-off-by: Peter Korsgaard <peter@korsgaard.com>
2014-10-07 09:06:03 +02:00
|
|
|
PYTHON3_DEPENDENCIES = host-python3 libffi
|
2012-11-07 06:01:21 +01:00
|
|
|
|
python3: bump to 3.7.0
Other changes include:
- Refreshing all necessary patches for 3.7.0
- Add a hash for the license file.
- Python no longer has it's own internal libffi, as such, host-libffi
is now required to build host-python3, and is added as a
dependency.
- Drop PYTHON3_LIBTOOL_PATCH = NO, since there is no longer any
internal libffi copy that was causing the libtool patching process
to fail.
- A new core module "uuid" is now is added in the Config.in file, and
relies on util-linux's uuid library.
- Also, a new patch: 0030-Fix-cross-compiling-the-uuid-module.patch
is required to fix compiling the uuid module, because the include
directory search path for uuid.h is hardcoded to /usr/include/uuid,
which causes an "unsafe for cross-compilation" error during
compiling if the host pc has uuid headers installed.
- 0031-Add-an-option-to-disable-uuid-module.patch is added to allow
disabling the Python3 UUID module, so that when
BR2_PACKAGE_PYTHON3_UUID is disabled by the UUID library is
present, the uuid Python module is not built, as expected.
- 0032-fix-building-on-older-distributions.patch is added to change
os.replace by os.rename in the update_file.py script to fix
building on older Linux distributions that have older versions of
python that don't include os.replace.
os.rename acts in the same way as os.replace, but is cross-platform
compatible. Because Buildroot is guaranteed to be built in a POSIX
environment, it is safe to change replace to rename.
Tested on CentOS6 and Fedora28, All test results passed:
br-arm-full [1/6]: OK
br-arm-cortex-a9-glibc [2/6]: OK
br-arm-cortex-m4-full [3/6]: SKIPPED
br-x86-64-musl [4/6]: OK
br-arm-full-static [5/6]: SKIPPED
armv5-ctng-linux-gnueabi [6/6]: OK
6 builds, 2 skipped, 0 build failed, 0 legal-info failed
Signed-off-by: Adam Duskett <aduskett@gmail.com>
[Thomas:
- remove PYTHON3_LIBTOOL_PATCH = NO
- improve the solution in patch 0030-Fix-cross-compiling-the-uuid-module
- add patch 0031-Add-an-option-to-disable-uuid-module]
Signed-off-by: Thomas Petazzoni <thomas.petazzoni@bootlin.com>
2018-07-20 18:10:21 +02:00
|
|
|
HOST_PYTHON3_DEPENDENCIES = host-expat host-zlib host-libffi
|
2012-11-07 06:01:21 +01:00
|
|
|
|
2019-09-20 16:59:39 +02:00
|
|
|
ifeq ($(BR2_PACKAGE_HOST_PYTHON3_SSL),y)
|
|
|
|
HOST_PYTHON3_DEPENDENCIES += host-openssl
|
|
|
|
else
|
|
|
|
HOST_PYTHON3_CONF_OPTS += --disable-openssl
|
|
|
|
endif
|
|
|
|
|
2012-11-07 06:01:21 +01:00
|
|
|
PYTHON3_INSTALL_STAGING = YES
|
|
|
|
|
|
|
|
ifeq ($(BR2_PACKAGE_PYTHON3_READLINE),y)
|
|
|
|
PYTHON3_DEPENDENCIES += readline
|
python3: make readline, gzip, bzip2 and xz really optional
The BR2_PACKAGE_PYTHON3_{READLINE,ZLIB,BZIP2,XZ} options were so far
only bringing in the necessary dependencies, relying on the Python
build system to automatically detect them.
However, this means that even if one of those option was disabled, if
their dependency was found, Python would build the corresponding module,
which is really not what the user would expect.
For example, if you have:
BR2_PACKAGE_READLINE=y
# BR2_PACKAGE_PYTHON3_READLINE is not set
Then you would still get the readline Python module built and installed.
This commit fixes that by adding new --{enable,disable} options, and use
them in python3.mk.
Signed-off-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
Reviewed-by: Yegor Yefremov <yegorslists@googlemail.com>
Signed-off-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
2017-03-08 00:00:31 +01:00
|
|
|
else
|
|
|
|
PYTHON3_CONF_OPTS += --disable-readline
|
2012-11-07 06:01:21 +01:00
|
|
|
endif
|
|
|
|
|
|
|
|
ifeq ($(BR2_PACKAGE_PYTHON3_CURSES),y)
|
|
|
|
PYTHON3_DEPENDENCIES += ncurses
|
2013-05-29 10:36:57 +02:00
|
|
|
else
|
2014-09-27 21:32:44 +02:00
|
|
|
PYTHON3_CONF_OPTS += --disable-curses
|
2012-11-07 06:01:21 +01:00
|
|
|
endif
|
|
|
|
|
2014-07-23 20:33:19 +02:00
|
|
|
ifeq ($(BR2_PACKAGE_PYTHON3_DECIMAL),y)
|
|
|
|
PYTHON3_DEPENDENCIES += mpdecimal
|
2014-09-27 21:32:44 +02:00
|
|
|
PYTHON3_CONF_OPTS += --with-libmpdec=system
|
2014-07-23 20:33:19 +02:00
|
|
|
else
|
2014-09-27 21:32:44 +02:00
|
|
|
PYTHON3_CONF_OPTS += --with-libmpdec=none
|
2014-07-23 20:33:19 +02:00
|
|
|
endif
|
|
|
|
|
2012-11-07 06:01:21 +01:00
|
|
|
ifeq ($(BR2_PACKAGE_PYTHON3_PYEXPAT),y)
|
|
|
|
PYTHON3_DEPENDENCIES += expat
|
2014-09-27 21:32:44 +02:00
|
|
|
PYTHON3_CONF_OPTS += --with-expat=system
|
2012-11-07 06:01:21 +01:00
|
|
|
else
|
2014-09-27 21:32:44 +02:00
|
|
|
PYTHON3_CONF_OPTS += --with-expat=none
|
2012-11-07 06:01:21 +01:00
|
|
|
endif
|
|
|
|
|
|
|
|
ifeq ($(BR2_PACKAGE_PYTHON3_SQLITE),y)
|
|
|
|
PYTHON3_DEPENDENCIES += sqlite
|
2013-05-29 10:36:57 +02:00
|
|
|
else
|
2014-09-27 21:32:44 +02:00
|
|
|
PYTHON3_CONF_OPTS += --disable-sqlite3
|
2012-11-07 06:01:21 +01:00
|
|
|
endif
|
|
|
|
|
|
|
|
ifeq ($(BR2_PACKAGE_PYTHON3_SSL),y)
|
2013-05-29 10:36:57 +02:00
|
|
|
PYTHON3_DEPENDENCIES += openssl
|
2017-03-08 00:00:30 +01:00
|
|
|
else
|
|
|
|
PYTHON3_CONF_OPTS += --disable-openssl
|
2013-05-29 10:36:57 +02:00
|
|
|
endif
|
|
|
|
|
|
|
|
ifneq ($(BR2_PACKAGE_PYTHON3_CODECSCJK),y)
|
2014-09-27 21:32:44 +02:00
|
|
|
PYTHON3_CONF_OPTS += --disable-codecs-cjk
|
2013-05-29 10:36:57 +02:00
|
|
|
endif
|
|
|
|
|
|
|
|
ifneq ($(BR2_PACKAGE_PYTHON3_UNICODEDATA),y)
|
2014-09-27 21:32:44 +02:00
|
|
|
PYTHON3_CONF_OPTS += --disable-unicodedata
|
2012-11-07 06:01:21 +01:00
|
|
|
endif
|
|
|
|
|
2018-10-20 14:49:51 +02:00
|
|
|
# Disable auto-detection of uuid.h (util-linux)
|
|
|
|
# which would add _uuid module support, instead
|
|
|
|
# default to the pure python implementation
|
python3: bump to 3.7.0
Other changes include:
- Refreshing all necessary patches for 3.7.0
- Add a hash for the license file.
- Python no longer has it's own internal libffi, as such, host-libffi
is now required to build host-python3, and is added as a
dependency.
- Drop PYTHON3_LIBTOOL_PATCH = NO, since there is no longer any
internal libffi copy that was causing the libtool patching process
to fail.
- A new core module "uuid" is now is added in the Config.in file, and
relies on util-linux's uuid library.
- Also, a new patch: 0030-Fix-cross-compiling-the-uuid-module.patch
is required to fix compiling the uuid module, because the include
directory search path for uuid.h is hardcoded to /usr/include/uuid,
which causes an "unsafe for cross-compilation" error during
compiling if the host pc has uuid headers installed.
- 0031-Add-an-option-to-disable-uuid-module.patch is added to allow
disabling the Python3 UUID module, so that when
BR2_PACKAGE_PYTHON3_UUID is disabled by the UUID library is
present, the uuid Python module is not built, as expected.
- 0032-fix-building-on-older-distributions.patch is added to change
os.replace by os.rename in the update_file.py script to fix
building on older Linux distributions that have older versions of
python that don't include os.replace.
os.rename acts in the same way as os.replace, but is cross-platform
compatible. Because Buildroot is guaranteed to be built in a POSIX
environment, it is safe to change replace to rename.
Tested on CentOS6 and Fedora28, All test results passed:
br-arm-full [1/6]: OK
br-arm-cortex-a9-glibc [2/6]: OK
br-arm-cortex-m4-full [3/6]: SKIPPED
br-x86-64-musl [4/6]: OK
br-arm-full-static [5/6]: SKIPPED
armv5-ctng-linux-gnueabi [6/6]: OK
6 builds, 2 skipped, 0 build failed, 0 legal-info failed
Signed-off-by: Adam Duskett <aduskett@gmail.com>
[Thomas:
- remove PYTHON3_LIBTOOL_PATCH = NO
- improve the solution in patch 0030-Fix-cross-compiling-the-uuid-module
- add patch 0031-Add-an-option-to-disable-uuid-module]
Signed-off-by: Thomas Petazzoni <thomas.petazzoni@bootlin.com>
2018-07-20 18:10:21 +02:00
|
|
|
PYTHON3_CONF_OPTS += --disable-uuid
|
|
|
|
|
2012-11-07 06:01:21 +01:00
|
|
|
ifeq ($(BR2_PACKAGE_PYTHON3_BZIP2),y)
|
2013-05-29 10:36:57 +02:00
|
|
|
PYTHON3_DEPENDENCIES += bzip2
|
python3: make readline, gzip, bzip2 and xz really optional
The BR2_PACKAGE_PYTHON3_{READLINE,ZLIB,BZIP2,XZ} options were so far
only bringing in the necessary dependencies, relying on the Python
build system to automatically detect them.
However, this means that even if one of those option was disabled, if
their dependency was found, Python would build the corresponding module,
which is really not what the user would expect.
For example, if you have:
BR2_PACKAGE_READLINE=y
# BR2_PACKAGE_PYTHON3_READLINE is not set
Then you would still get the readline Python module built and installed.
This commit fixes that by adding new --{enable,disable} options, and use
them in python3.mk.
Signed-off-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
Reviewed-by: Yegor Yefremov <yegorslists@googlemail.com>
Signed-off-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
2017-03-08 00:00:31 +01:00
|
|
|
else
|
|
|
|
PYTHON3_CONF_OPTS += --disable-bzip2
|
2012-11-07 06:01:21 +01:00
|
|
|
endif
|
|
|
|
|
2016-10-09 14:46:16 +02:00
|
|
|
ifeq ($(BR2_PACKAGE_PYTHON3_XZ),y)
|
|
|
|
PYTHON3_DEPENDENCIES += xz
|
python3: make readline, gzip, bzip2 and xz really optional
The BR2_PACKAGE_PYTHON3_{READLINE,ZLIB,BZIP2,XZ} options were so far
only bringing in the necessary dependencies, relying on the Python
build system to automatically detect them.
However, this means that even if one of those option was disabled, if
their dependency was found, Python would build the corresponding module,
which is really not what the user would expect.
For example, if you have:
BR2_PACKAGE_READLINE=y
# BR2_PACKAGE_PYTHON3_READLINE is not set
Then you would still get the readline Python module built and installed.
This commit fixes that by adding new --{enable,disable} options, and use
them in python3.mk.
Signed-off-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
Reviewed-by: Yegor Yefremov <yegorslists@googlemail.com>
Signed-off-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
2017-03-08 00:00:31 +01:00
|
|
|
else
|
|
|
|
PYTHON3_CONF_OPTS += --disable-xz
|
2016-10-09 14:46:16 +02:00
|
|
|
endif
|
|
|
|
|
2012-11-07 06:01:21 +01:00
|
|
|
ifeq ($(BR2_PACKAGE_PYTHON3_ZLIB),y)
|
|
|
|
PYTHON3_DEPENDENCIES += zlib
|
python3: make readline, gzip, bzip2 and xz really optional
The BR2_PACKAGE_PYTHON3_{READLINE,ZLIB,BZIP2,XZ} options were so far
only bringing in the necessary dependencies, relying on the Python
build system to automatically detect them.
However, this means that even if one of those option was disabled, if
their dependency was found, Python would build the corresponding module,
which is really not what the user would expect.
For example, if you have:
BR2_PACKAGE_READLINE=y
# BR2_PACKAGE_PYTHON3_READLINE is not set
Then you would still get the readline Python module built and installed.
This commit fixes that by adding new --{enable,disable} options, and use
them in python3.mk.
Signed-off-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
Reviewed-by: Yegor Yefremov <yegorslists@googlemail.com>
Signed-off-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
2017-03-08 00:00:31 +01:00
|
|
|
else
|
|
|
|
PYTHON3_CONF_OPTS += --disable-zlib
|
2012-11-07 06:01:21 +01:00
|
|
|
endif
|
|
|
|
|
2015-01-10 16:32:48 +01:00
|
|
|
ifeq ($(BR2_PACKAGE_PYTHON3_OSSAUDIODEV),y)
|
|
|
|
PYTHON3_CONF_OPTS += --enable-ossaudiodev
|
|
|
|
else
|
|
|
|
PYTHON3_CONF_OPTS += --disable-ossaudiodev
|
|
|
|
endif
|
|
|
|
|
2016-08-31 22:38:29 +02:00
|
|
|
# Make python believe we don't have 'hg', so that it doesn't try to
|
|
|
|
# communicate over the network during the build.
|
2012-11-07 06:01:21 +01:00
|
|
|
PYTHON3_CONF_ENV += \
|
|
|
|
ac_cv_have_long_long_format=yes \
|
|
|
|
ac_cv_file__dev_ptmx=yes \
|
|
|
|
ac_cv_file__dev_ptc=yes \
|
2016-08-31 22:38:29 +02:00
|
|
|
ac_cv_working_tzset=yes \
|
|
|
|
ac_cv_prog_HAS_HG=/bin/false
|
2012-11-07 06:01:21 +01:00
|
|
|
|
2016-11-09 10:25:08 +01:00
|
|
|
# GCC is always compliant with IEEE754
|
|
|
|
ifeq ($(BR2_ENDIAN),"LITTLE")
|
|
|
|
PYTHON3_CONF_ENV += ac_cv_little_endian_double=yes
|
|
|
|
else
|
|
|
|
PYTHON3_CONF_ENV += ac_cv_big_endian_double=yes
|
|
|
|
endif
|
|
|
|
|
2014-11-13 22:23:23 +01:00
|
|
|
# uClibc is known to have a broken wcsftime() implementation, so tell
|
|
|
|
# Python 3 to fall back to strftime() instead.
|
|
|
|
ifeq ($(BR2_TOOLCHAIN_USES_UCLIBC),y)
|
|
|
|
PYTHON3_CONF_ENV += ac_cv_func_wcsftime=no
|
|
|
|
endif
|
|
|
|
|
2020-04-05 16:28:22 +02:00
|
|
|
ifeq ($(BR2_PACKAGE_GETTEXT_PROVIDES_LIBINTL),y)
|
|
|
|
PYTHON3_DEPENDENCIES += gettext
|
|
|
|
endif
|
|
|
|
|
2014-09-27 21:32:44 +02:00
|
|
|
PYTHON3_CONF_OPTS += \
|
2017-04-21 17:24:48 +02:00
|
|
|
--without-ensurepip \
|
|
|
|
--without-cxx-main \
|
|
|
|
--with-system-ffi \
|
|
|
|
--disable-pydoc \
|
|
|
|
--disable-test-modules \
|
|
|
|
--disable-lib2to3 \
|
|
|
|
--disable-tk \
|
|
|
|
--disable-nis \
|
|
|
|
--disable-idle3 \
|
2016-05-17 23:19:15 +02:00
|
|
|
--disable-pyc-build
|
python3: bump to 3.5.1
The major changes in terms of Buildroot packaging are:
- Due to PEP488, Python no longer generates .pyc (unoptimized) and
.pyo (optimized) byte-code files. Instead, it generates <foo>.pyc,
<foo>.opt-1.pyc and <foo>.opt-2.pyc. Therefore, we removed the
--disable-pyo-build option and kept only the --disable-pyc-build
option, which completely disables building all .pyc files. In
addition, since the optimized .opt-X.pyc files don't work if the
corresponding un-optimized .pyc file is not present, we are for the
moment unconditionally removing the optimized ones (keeping both
the unoptimized and optimized ones doubles the required filesystem
size!). So basically we preserve the behavior we had before this
commit:
BR2_PACKAGE_PYTHON3_PY_ONLY -> only *.py
BR2_PACKAGE_PYTHON3_PYC_ONLY -> only non-optimized *.pyc
BR2_PACKAGE_PYTHON3_PY_PYC -> both the *.py and non-optimized *.pyc
To achieve this, the TARGET_FINALIZE_HOOKS are reworked:
PYTHON3_REMOVE_PY_FILES is responsible for removing *.py files in
the BR2_PACKAGE_PYTHON3_PYC_ONLY case.
PYTHON3_REMOVE_PYC_FILES is responsible for removing *.pyc files
in the BR2_PACKAGE_PYTHON3_PY_ONLY case.
PYTHON3_REMOVE_OPTIMIZED_PYC_FILES is responsible for removing the
optimized *.opt-1.pyc and *.opt-2.pyc files, which is done
unconditionally.
- The PEP3147 disabling patch had to be significantly reworked due to
the code having changed heavily. The code was moved into a
_bootstrap_external.py, which is a "frozen" Python module, i.e a
module generated into a .h file at compile time using the
_freeze_importlib program.
- Due to the above, we now need to regenerate importlib.h at build
time. Unfortunately, for the target Python _freeze_importlib is
built for the target, so we can't run it on the build machine. To
fix this, we copy the _freeze_importlib program from the
host-python in $(HOST_DIR), and then patch the target python to use
it. Since the same solution can be used for 'pgen', we do it, and
avoid having to touch the graminit.{c,h} files.
Signed-off-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
Reviewed-by: Samuel Martin <s.martin49@gmail.com>
Signed-off-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
2016-05-01 22:15:12 +02:00
|
|
|
|
2017-09-19 00:34:41 +02:00
|
|
|
#
|
|
|
|
# Some of CPython's source code is generated using Python interpreter
|
|
|
|
# and some helper tools such as "Programs/_freeze_importlib" or
|
|
|
|
# "Parser/pgen" (look for regen-* targets in Makefile.pre.in for more
|
|
|
|
# info). Normally CPython codebase ships with those files
|
|
|
|
# pre-generated, so just regular "make" with no additional steps
|
|
|
|
# should be sufficient for a succesfull build, however due to
|
|
|
|
# Buildroot's "Add importlib fix for PEP 3147 issue" custom patch we
|
|
|
|
# end up modifying "Lib/importlib/_bootstrap_external.py" which means
|
|
|
|
# we have to do "regen-importlib" step before building CPython
|
|
|
|
# (Importlib is a builtin module that needs to be "frozen"/converted
|
|
|
|
# to a C array of bytecode using "Programs/_freeze_importlib")
|
|
|
|
#
|
|
|
|
# To achive that we add pre-build steps to host-python3 as well as
|
|
|
|
# python3 that execute "regen-importlib" target.
|
|
|
|
#
|
|
|
|
# Unfortunately, for the target Python, "Programs/_freeze_importlib"
|
|
|
|
# is built for the target, while we need to run them at build time. So
|
|
|
|
# when installing host-python3, we copy them to $(HOST_DIR)/bin...
|
|
|
|
#
|
|
|
|
define HOST_PYTHON3_MAKE_REGEN_IMPORTLIB
|
|
|
|
$(HOST_MAKE_ENV) $(PYTHON3_CONF_ENV) $(MAKE) $(HOST_CONFIGURE_OPTS) -C $(@D) regen-importlib
|
2017-07-05 13:14:19 +02:00
|
|
|
cp $(@D)/Programs/_freeze_importlib $(HOST_DIR)/bin/python-freeze-importlib
|
2015-11-14 16:54:30 +01:00
|
|
|
endef
|
|
|
|
|
2017-09-19 00:34:41 +02:00
|
|
|
HOST_PYTHON3_PRE_BUILD_HOOKS += HOST_PYTHON3_MAKE_REGEN_IMPORTLIB
|
|
|
|
#
|
|
|
|
# ... And then, when building the target python we first buid
|
|
|
|
# 'Programs/_freeze_importlib' to force GNU Make to update all of the
|
|
|
|
# prerequisites of 'Programs/_freeze_importlib', then copy our stashed
|
|
|
|
# "host-usable" version over the one that was just build and then
|
|
|
|
# build "regen-importlib" target
|
|
|
|
#
|
|
|
|
define PYTHON3_MAKE_REGEN_IMPORTLIB
|
|
|
|
$(TARGET_MAKE_ENV) $(PYTHON3_CONF_ENV) $(MAKE) $(TARGET_CONFIGURE_OPTS) -C $(@D) Programs/_freeze_importlib
|
|
|
|
cp $(HOST_DIR)/bin/python-freeze-importlib $(@D)/Programs/_freeze_importlib
|
|
|
|
$(TARGET_MAKE_ENV) $(PYTHON3_CONF_ENV) $(MAKE) $(TARGET_CONFIGURE_OPTS) -C $(@D) regen-importlib
|
|
|
|
endef
|
|
|
|
|
|
|
|
PYTHON3_PRE_BUILD_HOOKS += PYTHON3_MAKE_REGEN_IMPORTLIB
|
|
|
|
|
2012-11-07 06:01:21 +01:00
|
|
|
#
|
|
|
|
# Remove useless files. In the config/ directory, only the Makefile
|
|
|
|
# and the pyconfig.h files are needed at runtime.
|
|
|
|
#
|
|
|
|
define PYTHON3_REMOVE_USELESS_FILES
|
2013-06-30 21:29:08 +02:00
|
|
|
rm -f $(TARGET_DIR)/usr/bin/python$(PYTHON3_VERSION_MAJOR)-config
|
|
|
|
rm -f $(TARGET_DIR)/usr/bin/python$(PYTHON3_VERSION_MAJOR)m-config
|
|
|
|
rm -f $(TARGET_DIR)/usr/bin/python3-config
|
2013-07-10 20:39:18 +02:00
|
|
|
rm -f $(TARGET_DIR)/usr/bin/smtpd.py.3
|
2019-08-02 19:43:59 +02:00
|
|
|
for i in `find $(TARGET_DIR)/usr/lib/python$(PYTHON3_VERSION_MAJOR)/config-$(PYTHON3_VERSION_MAJOR)m-*/ \
|
|
|
|
-type f -not -name Makefile` ; do \
|
2012-11-07 06:01:21 +01:00
|
|
|
rm -f $$i ; \
|
|
|
|
done
|
2014-09-30 23:38:57 +02:00
|
|
|
rm -rf $(TARGET_DIR)/usr/lib/python$(PYTHON3_VERSION_MAJOR)/__pycache__/
|
|
|
|
rm -rf $(TARGET_DIR)/usr/lib/python$(PYTHON3_VERSION_MAJOR)/lib-dynload/sysconfigdata/__pycache__
|
|
|
|
rm -rf $(TARGET_DIR)/usr/lib/python$(PYTHON3_VERSION_MAJOR)/collections/__pycache__
|
|
|
|
rm -rf $(TARGET_DIR)/usr/lib/python$(PYTHON3_VERSION_MAJOR)/importlib/__pycache__
|
2012-11-07 06:01:21 +01:00
|
|
|
endef
|
|
|
|
|
|
|
|
PYTHON3_POST_INSTALL_TARGET_HOOKS += PYTHON3_REMOVE_USELESS_FILES
|
|
|
|
|
2014-02-18 21:40:07 +01:00
|
|
|
#
|
|
|
|
# Make sure libpython gets stripped out on target
|
|
|
|
#
|
|
|
|
define PYTHON3_ENSURE_LIBPYTHON_STRIPPED
|
|
|
|
chmod u+w $(TARGET_DIR)/usr/lib/libpython$(PYTHON3_VERSION_MAJOR)*.so
|
|
|
|
endef
|
|
|
|
|
|
|
|
PYTHON3_POST_INSTALL_TARGET_HOOKS += PYTHON3_ENSURE_LIBPYTHON_STRIPPED
|
|
|
|
|
2012-11-07 06:01:21 +01:00
|
|
|
PYTHON3_AUTORECONF = YES
|
|
|
|
|
2013-01-18 05:06:12 +01:00
|
|
|
define PYTHON3_INSTALL_SYMLINK
|
|
|
|
ln -fs python3 $(TARGET_DIR)/usr/bin/python
|
|
|
|
endef
|
|
|
|
|
|
|
|
ifneq ($(BR2_PACKAGE_PYTHON),y)
|
|
|
|
PYTHON3_POST_INSTALL_TARGET_HOOKS += PYTHON3_INSTALL_SYMLINK
|
|
|
|
endif
|
2013-01-18 05:06:14 +01:00
|
|
|
|
2014-03-05 23:04:41 +01:00
|
|
|
# Some packages may have build scripts requiring python3, whatever is the
|
|
|
|
# python version chosen for the target.
|
|
|
|
# Only install the python symlink in the host tree if python3 is enabled
|
|
|
|
# for the target.
|
|
|
|
ifeq ($(BR2_PACKAGE_PYTHON3),y)
|
2014-02-18 21:39:58 +01:00
|
|
|
define HOST_PYTHON3_INSTALL_SYMLINK
|
2017-07-05 13:14:19 +02:00
|
|
|
ln -fs python3 $(HOST_DIR)/bin/python
|
|
|
|
ln -fs python3-config $(HOST_DIR)/bin/python-config
|
2013-01-18 05:06:14 +01:00
|
|
|
endef
|
|
|
|
|
2014-02-18 21:39:58 +01:00
|
|
|
HOST_PYTHON3_POST_INSTALL_HOOKS += HOST_PYTHON3_INSTALL_SYMLINK
|
2014-03-05 23:04:41 +01:00
|
|
|
endif
|
2013-01-18 05:06:14 +01:00
|
|
|
|
2014-02-18 21:40:02 +01:00
|
|
|
# Provided to other packages
|
package/pkg-python: fix for per-package directories
With per-package directory support, Python external modules are
causing a problem: the _sysconfigdata.py module installed by the
Python interpreter contains a number of paths that are relative to the
current package per-package directory, i.e python or python3. For
example:
'BLDSHARED': '/home/thomas/projets/buildroot/output/per-package/python/host/bin/arm-linux-gcc -shared',
'CC': '/home/thomas/projets/buildroot/output/per-package/python/host/bin/arm-linux-gcc',
'CXX': '/home/thomas/projets/buildroot/output/per-package/python/host/bin/arm-linux-g++',
etc.
These paths are problematic, because it means that the wrong compiler
gets used when building external Python modules: instead of using the
compiler from the external Python module per-package host directory,
it uses the one from the 'python' or 'python3' per-package host
directory. Due to this, any native dependency needed by the external
Python module is not found, even though it is properly present in the
current package per-package directory.
Of course, the problem occurs with both target Python modules and host
Python modules.
To fix this, we simply rewrite those paths in _sysconfigdata.py before
building a Python package.
Interestingly, until now, the _sysconfidata.py that was used during
the build was the one from $(TARGET_DIR), which is a bit unusual: it
is more common to use files from $(STAGING_DIR) during the build
process. So this commit changes the PYTHON_PATH and PYTHON3_PATH
variables so that they point to $(STAGING_DIR), which makes the
_sysconfigdata.py fixup in $(STAGING_DIR) effective.
Fixes:
http://autobuild.buildroot.net/results/a24b0555fd4261b50dc3986635c30717d9cbe764/ (python-psycopg2)
http://autobuild.buildroot.net/results/080fa893e1b0e7a8c8a31ac1c98eb8871b97264d/ (python-alsaaudio)
http://autobuild.buildroot.net/results/79bc070f98d6d9d8ef78df12b248cdc7d0e405c3/ (python-lxml)
and many more Python packages that use native code with a native library
Signed-off-by: Thomas Petazzoni <thomas.petazzoni@bootlin.com>
Signed-off-by: Peter Korsgaard <peter@korsgaard.com>
2020-02-18 00:50:47 +01:00
|
|
|
PYTHON3_PATH = $(STAGING_DIR)/usr/lib/python$(PYTHON3_VERSION_MAJOR)/
|
2013-01-18 05:06:14 +01:00
|
|
|
|
2018-09-13 13:56:56 +02:00
|
|
|
# Support for socket.AF_BLUETOOTH
|
|
|
|
ifeq ($(BR2_PACKAGE_BLUEZ5_UTILS_HEADERS),y)
|
|
|
|
PYTHON3_DEPENDENCIES += bluez5_utils-headers
|
|
|
|
endif
|
|
|
|
|
2012-11-07 06:01:21 +01:00
|
|
|
$(eval $(autotools-package))
|
|
|
|
$(eval $(host-autotools-package))
|
2014-09-30 23:39:01 +02:00
|
|
|
|
2016-12-20 14:46:24 +01:00
|
|
|
ifeq ($(BR2_REPRODUCIBLE),y)
|
|
|
|
define PYTHON3_FIX_TIME
|
|
|
|
find $(TARGET_DIR)/usr/lib/python$(PYTHON3_VERSION_MAJOR) -name '*.py' -print0 | \
|
|
|
|
xargs -0 --no-run-if-empty touch -d @$(SOURCE_DATE_EPOCH)
|
|
|
|
endef
|
|
|
|
endif
|
|
|
|
|
2016-05-17 23:19:15 +02:00
|
|
|
define PYTHON3_CREATE_PYC_FILES
|
2016-12-20 14:46:24 +01:00
|
|
|
$(PYTHON3_FIX_TIME)
|
2016-05-17 23:19:15 +02:00
|
|
|
PYTHONPATH="$(PYTHON3_PATH)" \
|
2017-07-05 13:14:19 +02:00
|
|
|
cd $(TARGET_DIR) && $(HOST_DIR)/bin/python$(PYTHON3_VERSION_MAJOR) \
|
2016-12-20 14:46:27 +01:00
|
|
|
$(TOPDIR)/support/scripts/pycompile.py \
|
|
|
|
$(if $(BR2_REPRODUCIBLE),--force) \
|
|
|
|
usr/lib/python$(PYTHON3_VERSION_MAJOR)
|
2016-05-17 23:19:15 +02:00
|
|
|
endef
|
|
|
|
|
|
|
|
ifeq ($(BR2_PACKAGE_PYTHON3_PYC_ONLY)$(BR2_PACKAGE_PYTHON3_PY_PYC),y)
|
2016-06-22 21:07:37 +02:00
|
|
|
PYTHON3_TARGET_FINALIZE_HOOKS += PYTHON3_CREATE_PYC_FILES
|
2016-05-17 23:19:15 +02:00
|
|
|
endif
|
|
|
|
|
2014-09-30 23:39:01 +02:00
|
|
|
ifeq ($(BR2_PACKAGE_PYTHON3_PYC_ONLY),y)
|
python3: bump to 3.5.1
The major changes in terms of Buildroot packaging are:
- Due to PEP488, Python no longer generates .pyc (unoptimized) and
.pyo (optimized) byte-code files. Instead, it generates <foo>.pyc,
<foo>.opt-1.pyc and <foo>.opt-2.pyc. Therefore, we removed the
--disable-pyo-build option and kept only the --disable-pyc-build
option, which completely disables building all .pyc files. In
addition, since the optimized .opt-X.pyc files don't work if the
corresponding un-optimized .pyc file is not present, we are for the
moment unconditionally removing the optimized ones (keeping both
the unoptimized and optimized ones doubles the required filesystem
size!). So basically we preserve the behavior we had before this
commit:
BR2_PACKAGE_PYTHON3_PY_ONLY -> only *.py
BR2_PACKAGE_PYTHON3_PYC_ONLY -> only non-optimized *.pyc
BR2_PACKAGE_PYTHON3_PY_PYC -> both the *.py and non-optimized *.pyc
To achieve this, the TARGET_FINALIZE_HOOKS are reworked:
PYTHON3_REMOVE_PY_FILES is responsible for removing *.py files in
the BR2_PACKAGE_PYTHON3_PYC_ONLY case.
PYTHON3_REMOVE_PYC_FILES is responsible for removing *.pyc files
in the BR2_PACKAGE_PYTHON3_PY_ONLY case.
PYTHON3_REMOVE_OPTIMIZED_PYC_FILES is responsible for removing the
optimized *.opt-1.pyc and *.opt-2.pyc files, which is done
unconditionally.
- The PEP3147 disabling patch had to be significantly reworked due to
the code having changed heavily. The code was moved into a
_bootstrap_external.py, which is a "frozen" Python module, i.e a
module generated into a .h file at compile time using the
_freeze_importlib program.
- Due to the above, we now need to regenerate importlib.h at build
time. Unfortunately, for the target Python _freeze_importlib is
built for the target, so we can't run it on the build machine. To
fix this, we copy the _freeze_importlib program from the
host-python in $(HOST_DIR), and then patch the target python to use
it. Since the same solution can be used for 'pgen', we do it, and
avoid having to touch the graminit.{c,h} files.
Signed-off-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
Reviewed-by: Samuel Martin <s.martin49@gmail.com>
Signed-off-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
2016-05-01 22:15:12 +02:00
|
|
|
define PYTHON3_REMOVE_PY_FILES
|
package/{pkg-generic, python, python3}: add mechanism to exclude .py files from removal
When BR2_PACKAGE_PYTHON{,3}_PYC_ONLY=y, we force remove all .py files
from the system, as they have all been byte-compiled into their .pyc
variants.
However, it turns out that some packages (e.g: OpenCV) do some funky
things with a few .py files: they pass them through Python's
execfile() facility, which only works with .py files and not .pyc
files. It is used by OpenCV for example to read two small
configuration files.
In order to support such use cases, this commit introduces a very
simple mechanism by which packages can exclude some path patterns from
the .py removal: a per-package <pkg>_KEEP_PY_FILES variable that is
collected into a global PYTHON_KEEP_PY_FILES variable, then used by
the python/python3 target-finalize hooks.
This variable is intentionally not documented, this is really a hack
that we ideally would like to see go away, and we'd rather not see its
usage spread too much.
This is necessary to be able to fix bug #12171.
[Peter: check if PYTHON_KEEP_PY_FILES contains non-white space]
Signed-off-by: Thomas Petazzoni <thomas.petazzoni@bootlin.com>
Signed-off-by: Peter Korsgaard <peter@korsgaard.com>
2019-11-29 20:07:05 +01:00
|
|
|
find $(TARGET_DIR)/usr/lib/python$(PYTHON3_VERSION_MAJOR) -name '*.py' \
|
2019-12-01 21:55:37 +01:00
|
|
|
$(if $(strip $(KEEP_PYTHON_PY_FILES)),-not \( $(call finddirclauses,$(TARGET_DIR),$(KEEP_PYTHON_PY_FILES)) \) ) \
|
package/{pkg-generic, python, python3}: add mechanism to exclude .py files from removal
When BR2_PACKAGE_PYTHON{,3}_PYC_ONLY=y, we force remove all .py files
from the system, as they have all been byte-compiled into their .pyc
variants.
However, it turns out that some packages (e.g: OpenCV) do some funky
things with a few .py files: they pass them through Python's
execfile() facility, which only works with .py files and not .pyc
files. It is used by OpenCV for example to read two small
configuration files.
In order to support such use cases, this commit introduces a very
simple mechanism by which packages can exclude some path patterns from
the .py removal: a per-package <pkg>_KEEP_PY_FILES variable that is
collected into a global PYTHON_KEEP_PY_FILES variable, then used by
the python/python3 target-finalize hooks.
This variable is intentionally not documented, this is really a hack
that we ideally would like to see go away, and we'd rather not see its
usage spread too much.
This is necessary to be able to fix bug #12171.
[Peter: check if PYTHON_KEEP_PY_FILES contains non-white space]
Signed-off-by: Thomas Petazzoni <thomas.petazzoni@bootlin.com>
Signed-off-by: Peter Korsgaard <peter@korsgaard.com>
2019-11-29 20:07:05 +01:00
|
|
|
-print0 | \
|
2016-05-17 23:19:13 +02:00
|
|
|
xargs -0 --no-run-if-empty rm -f
|
2014-09-30 23:39:01 +02:00
|
|
|
endef
|
2016-06-22 21:07:37 +02:00
|
|
|
PYTHON3_TARGET_FINALIZE_HOOKS += PYTHON3_REMOVE_PY_FILES
|
2014-09-30 23:39:01 +02:00
|
|
|
endif
|
|
|
|
|
2016-05-17 23:19:15 +02:00
|
|
|
# Normally, *.pyc files should not have been compiled, but just in
|
|
|
|
# case, we make sure we remove all of them.
|
2014-09-30 23:39:01 +02:00
|
|
|
ifeq ($(BR2_PACKAGE_PYTHON3_PY_ONLY),y)
|
python3: bump to 3.5.1
The major changes in terms of Buildroot packaging are:
- Due to PEP488, Python no longer generates .pyc (unoptimized) and
.pyo (optimized) byte-code files. Instead, it generates <foo>.pyc,
<foo>.opt-1.pyc and <foo>.opt-2.pyc. Therefore, we removed the
--disable-pyo-build option and kept only the --disable-pyc-build
option, which completely disables building all .pyc files. In
addition, since the optimized .opt-X.pyc files don't work if the
corresponding un-optimized .pyc file is not present, we are for the
moment unconditionally removing the optimized ones (keeping both
the unoptimized and optimized ones doubles the required filesystem
size!). So basically we preserve the behavior we had before this
commit:
BR2_PACKAGE_PYTHON3_PY_ONLY -> only *.py
BR2_PACKAGE_PYTHON3_PYC_ONLY -> only non-optimized *.pyc
BR2_PACKAGE_PYTHON3_PY_PYC -> both the *.py and non-optimized *.pyc
To achieve this, the TARGET_FINALIZE_HOOKS are reworked:
PYTHON3_REMOVE_PY_FILES is responsible for removing *.py files in
the BR2_PACKAGE_PYTHON3_PYC_ONLY case.
PYTHON3_REMOVE_PYC_FILES is responsible for removing *.pyc files
in the BR2_PACKAGE_PYTHON3_PY_ONLY case.
PYTHON3_REMOVE_OPTIMIZED_PYC_FILES is responsible for removing the
optimized *.opt-1.pyc and *.opt-2.pyc files, which is done
unconditionally.
- The PEP3147 disabling patch had to be significantly reworked due to
the code having changed heavily. The code was moved into a
_bootstrap_external.py, which is a "frozen" Python module, i.e a
module generated into a .h file at compile time using the
_freeze_importlib program.
- Due to the above, we now need to regenerate importlib.h at build
time. Unfortunately, for the target Python _freeze_importlib is
built for the target, so we can't run it on the build machine. To
fix this, we copy the _freeze_importlib program from the
host-python in $(HOST_DIR), and then patch the target python to use
it. Since the same solution can be used for 'pgen', we do it, and
avoid having to touch the graminit.{c,h} files.
Signed-off-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
Reviewed-by: Samuel Martin <s.martin49@gmail.com>
Signed-off-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
2016-05-01 22:15:12 +02:00
|
|
|
define PYTHON3_REMOVE_PYC_FILES
|
2016-05-17 23:19:13 +02:00
|
|
|
find $(TARGET_DIR)/usr/lib/python$(PYTHON3_VERSION_MAJOR) -name '*.pyc' -print0 | \
|
|
|
|
xargs -0 --no-run-if-empty rm -f
|
2014-09-30 23:39:01 +02:00
|
|
|
endef
|
2016-06-22 21:07:37 +02:00
|
|
|
PYTHON3_TARGET_FINALIZE_HOOKS += PYTHON3_REMOVE_PYC_FILES
|
2014-09-30 23:39:01 +02:00
|
|
|
endif
|
|
|
|
|
python3: bump to 3.5.1
The major changes in terms of Buildroot packaging are:
- Due to PEP488, Python no longer generates .pyc (unoptimized) and
.pyo (optimized) byte-code files. Instead, it generates <foo>.pyc,
<foo>.opt-1.pyc and <foo>.opt-2.pyc. Therefore, we removed the
--disable-pyo-build option and kept only the --disable-pyc-build
option, which completely disables building all .pyc files. In
addition, since the optimized .opt-X.pyc files don't work if the
corresponding un-optimized .pyc file is not present, we are for the
moment unconditionally removing the optimized ones (keeping both
the unoptimized and optimized ones doubles the required filesystem
size!). So basically we preserve the behavior we had before this
commit:
BR2_PACKAGE_PYTHON3_PY_ONLY -> only *.py
BR2_PACKAGE_PYTHON3_PYC_ONLY -> only non-optimized *.pyc
BR2_PACKAGE_PYTHON3_PY_PYC -> both the *.py and non-optimized *.pyc
To achieve this, the TARGET_FINALIZE_HOOKS are reworked:
PYTHON3_REMOVE_PY_FILES is responsible for removing *.py files in
the BR2_PACKAGE_PYTHON3_PYC_ONLY case.
PYTHON3_REMOVE_PYC_FILES is responsible for removing *.pyc files
in the BR2_PACKAGE_PYTHON3_PY_ONLY case.
PYTHON3_REMOVE_OPTIMIZED_PYC_FILES is responsible for removing the
optimized *.opt-1.pyc and *.opt-2.pyc files, which is done
unconditionally.
- The PEP3147 disabling patch had to be significantly reworked due to
the code having changed heavily. The code was moved into a
_bootstrap_external.py, which is a "frozen" Python module, i.e a
module generated into a .h file at compile time using the
_freeze_importlib program.
- Due to the above, we now need to regenerate importlib.h at build
time. Unfortunately, for the target Python _freeze_importlib is
built for the target, so we can't run it on the build machine. To
fix this, we copy the _freeze_importlib program from the
host-python in $(HOST_DIR), and then patch the target python to use
it. Since the same solution can be used for 'pgen', we do it, and
avoid having to touch the graminit.{c,h} files.
Signed-off-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
Reviewed-by: Samuel Martin <s.martin49@gmail.com>
Signed-off-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
2016-05-01 22:15:12 +02:00
|
|
|
# In all cases, we don't want to keep the optimized .opt-1.pyc and
|
|
|
|
# .opt-2.pyc files, since they can't work without their non-optimized
|
|
|
|
# variant.
|
|
|
|
define PYTHON3_REMOVE_OPTIMIZED_PYC_FILES
|
2016-05-17 23:19:13 +02:00
|
|
|
find $(TARGET_DIR)/usr/lib/python$(PYTHON3_VERSION_MAJOR) -name '*.opt-1.pyc' -print0 -o -name '*.opt-2.pyc' -print0 | \
|
|
|
|
xargs -0 --no-run-if-empty rm -f
|
python3: bump to 3.5.1
The major changes in terms of Buildroot packaging are:
- Due to PEP488, Python no longer generates .pyc (unoptimized) and
.pyo (optimized) byte-code files. Instead, it generates <foo>.pyc,
<foo>.opt-1.pyc and <foo>.opt-2.pyc. Therefore, we removed the
--disable-pyo-build option and kept only the --disable-pyc-build
option, which completely disables building all .pyc files. In
addition, since the optimized .opt-X.pyc files don't work if the
corresponding un-optimized .pyc file is not present, we are for the
moment unconditionally removing the optimized ones (keeping both
the unoptimized and optimized ones doubles the required filesystem
size!). So basically we preserve the behavior we had before this
commit:
BR2_PACKAGE_PYTHON3_PY_ONLY -> only *.py
BR2_PACKAGE_PYTHON3_PYC_ONLY -> only non-optimized *.pyc
BR2_PACKAGE_PYTHON3_PY_PYC -> both the *.py and non-optimized *.pyc
To achieve this, the TARGET_FINALIZE_HOOKS are reworked:
PYTHON3_REMOVE_PY_FILES is responsible for removing *.py files in
the BR2_PACKAGE_PYTHON3_PYC_ONLY case.
PYTHON3_REMOVE_PYC_FILES is responsible for removing *.pyc files
in the BR2_PACKAGE_PYTHON3_PY_ONLY case.
PYTHON3_REMOVE_OPTIMIZED_PYC_FILES is responsible for removing the
optimized *.opt-1.pyc and *.opt-2.pyc files, which is done
unconditionally.
- The PEP3147 disabling patch had to be significantly reworked due to
the code having changed heavily. The code was moved into a
_bootstrap_external.py, which is a "frozen" Python module, i.e a
module generated into a .h file at compile time using the
_freeze_importlib program.
- Due to the above, we now need to regenerate importlib.h at build
time. Unfortunately, for the target Python _freeze_importlib is
built for the target, so we can't run it on the build machine. To
fix this, we copy the _freeze_importlib program from the
host-python in $(HOST_DIR), and then patch the target python to use
it. Since the same solution can be used for 'pgen', we do it, and
avoid having to touch the graminit.{c,h} files.
Signed-off-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
Reviewed-by: Samuel Martin <s.martin49@gmail.com>
Signed-off-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
2016-05-01 22:15:12 +02:00
|
|
|
endef
|
2016-06-22 21:07:37 +02:00
|
|
|
PYTHON3_TARGET_FINALIZE_HOOKS += PYTHON3_REMOVE_OPTIMIZED_PYC_FILES
|