diff mbox series

[1/1] package/python-attrs: remove _next_gen.py on python2

Message ID 20210923183751.361386-1-asafka7@gmail.com
State Superseded
Headers show
Series [1/1] package/python-attrs: remove _next_gen.py on python2 | expand

Commit Message

Asaf Kahlon Sept. 23, 2021, 6:37 p.m. UTC
The _next_gen.py file contains python 3.6+ API and it's not
useable with python 2.
In addition, this file is imported on __init__.py only after
checking the version of python is above 3.6, so we can safely
remove it.

Fixes:
 - http://autobuild.buildroot.net/results/5774c6237b72b6f5e005bb5b229c078235ff2741/

Signed-off-by: Asaf Kahlon <asafka7@gmail.com>
---
 package/python-attrs/python-attrs.mk | 9 +++++++++
 1 file changed, 9 insertions(+)

Comments

Arnout Vandecappelle Sept. 23, 2021, 7:39 p.m. UTC | #1
On 23/09/2021 20:37, Asaf Kahlon wrote:
> The _next_gen.py file contains python 3.6+ API and it's not
> useable with python 2.
> In addition, this file is imported on __init__.py only after
> checking the version of python is above 3.6, so we can safely
> remove it.

  Although this solution is OK, I expect it's only a matter of time before attrs 
drops python2 support anyway. So I'd bite the bullet and simply make it depend 
on python3.

  We're anyway not going to keep python2 around for too long any more, so 
progressively dropping python2 support in packages seems like a good idea.

  Regards,
  Arnout

> 
> Fixes:
>   - http://autobuild.buildroot.net/results/5774c6237b72b6f5e005bb5b229c078235ff2741/
> 
> Signed-off-by: Asaf Kahlon <asafka7@gmail.com>
> ---
>   package/python-attrs/python-attrs.mk | 9 +++++++++
>   1 file changed, 9 insertions(+)
> 
> diff --git a/package/python-attrs/python-attrs.mk b/package/python-attrs/python-attrs.mk
> index b99a98501c..f23cabd998 100644
> --- a/package/python-attrs/python-attrs.mk
> +++ b/package/python-attrs/python-attrs.mk
> @@ -11,4 +11,13 @@ PYTHON_ATTRS_SETUP_TYPE = setuptools
>   PYTHON_ATTRS_LICENSE = MIT
>   PYTHON_ATTRS_LICENSE_FILES = LICENSE
>   
> +# _next_gen is usable only on python 3.6+ and it's not imported
> +# on __init__.py in case lower version of python is used.
> +ifeq ($(BR2_PACKAGE_PYTHON),y)
> +define PYTHON_ATTRS_REMOVE_NEXT_GEN
> +        $(RM) $(@D)/src/attr/_next_gen.py
> +endef
> +PYTHON_ATTRS_POST_PATCH_HOOKS += PYTHON_ATTRS_REMOVE_NEXT_GEN
> +endif
> +
>   $(eval $(python-package))
>
Romain Naour Sept. 23, 2021, 8:54 p.m. UTC | #2
Hello Asaf,

On 23/09/2021 20:37, Asaf Kahlon wrote:
> The _next_gen.py file contains python 3.6+ API and it's not
> useable with python 2.
> In addition, this file is imported on __init__.py only after
> checking the version of python is above 3.6, so we can safely
> remove it.
> 
> Fixes:
>  - http://autobuild.buildroot.net/results/5774c6237b72b6f5e005bb5b229c078235ff2741/
> 

It fixes tests.package.test_python_attrs.TestPythonPy2Attrs
https://gitlab.com/kubu93/buildroot/-/jobs/1614446939

Tested-by: Romain Naour <romain.naour@gmail.com>

Best regards,
Romain


> Signed-off-by: Asaf Kahlon <asafka7@gmail.com>
> ---
>  package/python-attrs/python-attrs.mk | 9 +++++++++
>  1 file changed, 9 insertions(+)
> 
> diff --git a/package/python-attrs/python-attrs.mk b/package/python-attrs/python-attrs.mk
> index b99a98501c..f23cabd998 100644
> --- a/package/python-attrs/python-attrs.mk
> +++ b/package/python-attrs/python-attrs.mk
> @@ -11,4 +11,13 @@ PYTHON_ATTRS_SETUP_TYPE = setuptools
>  PYTHON_ATTRS_LICENSE = MIT
>  PYTHON_ATTRS_LICENSE_FILES = LICENSE
>  
> +# _next_gen is usable only on python 3.6+ and it's not imported
> +# on __init__.py in case lower version of python is used.
> +ifeq ($(BR2_PACKAGE_PYTHON),y)
> +define PYTHON_ATTRS_REMOVE_NEXT_GEN
> +        $(RM) $(@D)/src/attr/_next_gen.py
> +endef
> +PYTHON_ATTRS_POST_PATCH_HOOKS += PYTHON_ATTRS_REMOVE_NEXT_GEN
> +endif
> +
>  $(eval $(python-package))
>
diff mbox series

Patch

diff --git a/package/python-attrs/python-attrs.mk b/package/python-attrs/python-attrs.mk
index b99a98501c..f23cabd998 100644
--- a/package/python-attrs/python-attrs.mk
+++ b/package/python-attrs/python-attrs.mk
@@ -11,4 +11,13 @@  PYTHON_ATTRS_SETUP_TYPE = setuptools
 PYTHON_ATTRS_LICENSE = MIT
 PYTHON_ATTRS_LICENSE_FILES = LICENSE
 
+# _next_gen is usable only on python 3.6+ and it's not imported
+# on __init__.py in case lower version of python is used.
+ifeq ($(BR2_PACKAGE_PYTHON),y)
+define PYTHON_ATTRS_REMOVE_NEXT_GEN
+        $(RM) $(@D)/src/attr/_next_gen.py
+endef
+PYTHON_ATTRS_POST_PATCH_HOOKS += PYTHON_ATTRS_REMOVE_NEXT_GEN
+endif
+
 $(eval $(python-package))