[Buildroot] [PATCH v2 2/4] python: align the target finalize hooks with python3

Samuel Martin s.martin49 at gmail.com
Sat Apr 30 20:56:56 UTC 2016


Thomas, all,

On Sat, Apr 30, 2016 at 2:47 PM, Thomas Petazzoni
<thomas.petazzoni at free-electrons.com> wrote:
> Since the bump of python3 to 3.5.x, the target finalize hooks
> registered by the python3 have been changed a little bit. For the sake
> of consistency, this commit aligns the target finalize hooks
> registered by the python package so that they look the same as the
> ones used by python3.
>
> Signed-off-by: Thomas Petazzoni <thomas.petazzoni at free-electrons.com>

On this change:
Reviewed-by: Samuel Martin <s.martin49 at gmail.com>

> ---
>  package/python/python.mk | 8 ++++----
>  1 file changed, 4 insertions(+), 4 deletions(-)
>
> diff --git a/package/python/python.mk b/package/python/python.mk
> index 4ecd0d1..819d32b 100644
> --- a/package/python/python.mk
> +++ b/package/python/python.mk
> @@ -218,15 +218,15 @@ $(eval $(autotools-package))
>  $(eval $(host-autotools-package))
>
>  ifeq ($(BR2_PACKAGE_PYTHON_PYC_ONLY),y)
> -define PYTHON_FINALIZE_TARGET
> +define PYTHON_REMOVE_PY_FILES
>         find $(TARGET_DIR)/usr/lib/python$(PYTHON_VERSION_MAJOR) -name '*.py' -print0 | xargs -0 rm -f
>  endef
> +TARGET_FINALIZE_HOOKS += PYTHON_REMOVE_PY_FILES
>  endif
>
>  ifeq ($(BR2_PACKAGE_PYTHON_PY_ONLY),y)
> -define PYTHON_FINALIZE_TARGET
> +define PYTHON_REMOVE_PYC_FILES
>         find $(TARGET_DIR)/usr/lib/python$(PYTHON_VERSION_MAJOR) -name '*.pyc' -print0 | xargs -0 rm -f

However, some packages call compile_all by themselves, so this can
lead to have some remaining *.pyo in
$(TARGET_DIR)/usr/lib/python$(PYTHON_VERSION_MAJOR) (e.g. [1] with
this defconfig [2]).

[1] http://code.bulix.org/l1hybv-98186
[2] http://code.bulix.org/o86r2k-98185

>  endef
> +TARGET_FINALIZE_HOOKS += PYTHON_REMOVE_PYC_FILES
>  endif
> -
> -TARGET_FINALIZE_HOOKS += PYTHON_FINALIZE_TARGET
> --
> 2.6.4
>

Regards,

-- 
Samuel



More information about the buildroot mailing list