Skip to contentSkip to conversation

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

PATCH In review Asaf Kahlon 4 participants 5 messages Sep 23, 2021 – Oct 3, 2021

lore
Share & tools
lore
#0 lore raw

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

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/

---
 package/python-attrs/python-attrs.mk | 9 +++++++++
 1 file changed, 9 insertions(+)
package/python-attrs/python-attrs.mk +9 -0
index b99a98501c..f23cabd998 100644
@@ -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))
Signature · 6 lines
2.30.2

_______________________________________________
buildroot mailing list
[email protected]
https://lists.buildroot.org/mailman/listinfo/buildroot
#1 lore raw

PATCH 1/1 package/python-packaging: depend on python3

The latest version of this package requires python 3.6+.

Fixes:
- http://autobuild.buildroot.net/results/217157f4dd9fd56d0a13d47e6373f4c478f26757/

---
 package/python-packaging/Config.in | 1 +
 1 file changed, 1 insertion(+)
package/python-packaging/Config.in +1 -0
index 12170df84e..74d5205e8d 100644
@@ -1,5 +1,6 @@
 config BR2_PACKAGE_PYTHON_PACKAGING
 	bool "python-packaging"
+	depends on BR2_PACKAGE_PYTHON3
 	select BR2_PACKAGE_PYTHON_PYPARSING # runtime
 	help
 	  Core utilities for Python packages.
Signature · 6 lines
2.30.2

_______________________________________________
buildroot mailing list
[email protected]
https://lists.buildroot.org/mailman/listinfo/buildroot
#2 lore raw

Re: [Buildroot] [PATCH 1/1] package/python-packaging: depend on python3

Asaf, All,

On 2021-09-23 21:37 +0300, Asaf Kahlon spake thusly:

Quoted 6 lines

The latest version of this package requires python 3.6+.

Fixes:
- http://autobuild.buildroot.net/results/217157f4dd9fd56d0a13d47e6373f4c478f26757/

I added a blurb that the only reverse dependency, pytest, already needs python3, and applied to master, thanks.

Regards,
Yann E. MORIN.

Quoted 22 lines
---
 package/python-packaging/Config.in | 1 +
 1 file changed, 1 insertion(+)
package/python-packaging/Config.in +1 -0
index 12170df84e..74d5205e8d 100644
@@ -1,5 +1,6 @@
 config BR2_PACKAGE_PYTHON_PACKAGING
 	bool "python-packaging"
+	depends on BR2_PACKAGE_PYTHON3
 	select BR2_PACKAGE_PYTHON_PYPARSING # runtime
 	help
 	  Core utilities for Python packages.
Signature · 6 lines
2.30.2

_______________________________________________
buildroot mailing list
[email protected]
https://lists.buildroot.org/mailman/listinfo/buildroot
Signature · 10 lines
.-----------------.--------------------.------------------.--------------------.
|  Yann E. MORIN  | Real-Time Embedded | /"\ ASCII RIBBON | Erics' conspiracy: |
| +33 662 376 056 | Software  Designer | \ / CAMPAIGN     |  ___               |
| +33 561 099 427 `------------.-------:  X  AGAINST      |  \e/  There is no  |
| http://ymorin.is-a-geek.org/ | _/*\_ | / \ HTML MAIL    |   v   conspiracy.  |
'------------------------------^-------^------------------^--------------------'
_______________________________________________
buildroot mailing list
[email protected]
https://lists.buildroot.org/mailman/listinfo/buildroot
#3 lore raw
In reply to Asaf Kahlon
Quoted 5 lines · Asaf Kahlon

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

Quoted 18 lines

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

---
  package/python-attrs/python-attrs.mk | 9 +++++++++
  1 file changed, 9 insertions(+)
package/python-attrs/python-attrs.mk +0 -0
index b99a98501c..f23cabd998 100644
@@ -11,4 +11,13 @@ PYTHON_ATTRS_SETUP_TYPE = setuptools
  PYTHON_ATTRS_LICENSE = MIT
  PYTHON_ATTRS_LICENSE_FILES = LICENSE
 

package/python-attrs/python-attrs.mk PYTHON_ATTRS_SETUP_TYPE = setuptools · line 23

Quoted 10 lines
package/python-attrs/python-attrs.mk +9 -0
+# _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))

_______________________________________________
buildroot mailing list
[email protected]
https://lists.buildroot.org/mailman/listinfo/buildroot

Tested-by on v1 1/1
#4 lore raw
In reply to Asaf Kahlon

Hello Asaf,

Quoted 9 lines · Asaf Kahlon

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

Best regards,
Romain

Quoted 14 lines
---
 package/python-attrs/python-attrs.mk | 9 +++++++++
 1 file changed, 9 insertions(+)
package/python-attrs/python-attrs.mk +0 -0
index b99a98501c..f23cabd998 100644
@@ -11,4 +11,13 @@ PYTHON_ATTRS_SETUP_TYPE = setuptools
 PYTHON_ATTRS_LICENSE = MIT
 PYTHON_ATTRS_LICENSE_FILES = LICENSE
 

package/python-attrs/python-attrs.mk PYTHON_ATTRS_SETUP_TYPE = setuptools · line 23

Quoted 10 lines
package/python-attrs/python-attrs.mk +9 -0
+# _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))

_______________________________________________
buildroot mailing list
[email protected]
https://lists.buildroot.org/mailman/listinfo/buildroot