Skip to contentSkip to conversation

python-gunicorn: fix build issues

PATCH New Maxime Hadjinlian 2 participants 2 messages Feb 6, 2017

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 python-gunicorn: fix build issues

Fix:

    http://autobuild.buildroot.org/results/b2d/b2d43dd3c52cc9f586009a10a40f97b07548322d/build-end.log

The issue arise from the fact that we compile all *.py files but the _gaiohttp.py file is using Python3 ("yield from") syntax which causes an error.

So we are using Python2, delete this file as it won't ever be imported anyway as it is checked by gunicorn in the __init__.py file of the worker module.

---
 package/python-gunicorn/python-gunicorn.mk | 12 ++++++++++++
 1 file changed, 12 insertions(+)
package/python-gunicorn/python-gunicorn.mk +12 -0
index 426e809730..cfb7da110c 100644
@@ -11,4 +11,16 @@ PYTHON_GUNICORN_SETUP_TYPE = setuptools
 PYTHON_GUNICORN_LICENSE = MIT
 PYTHON_GUNICORN_LICENSE_FILES = LICENSE
 
+# At the end of the build, we try to compile all py files using the host python
+# that has been built.
+# The GAIO HTTP Worker is only compatible with Python3.4.2 and up. So don't try
+# to compile it with python 2.x
+ifeq ($(BR2_PACKAGE_PYTHON),y)
+define PYTHON_GUNICORN_REMOVE_GAIO_WORKER
+	find $(TARGET_DIR)/usr/lib/python$(PYTHON_VERSION_MAJOR)/site-packages/ \
+		-name "_gaiohttp.py" -exec rm -f {} \;
+endef
+PYTHON_GUNICORN_POST_INSTALL_TARGET_HOOKS += PYTHON_GUNICORN_REMOVE_GAIO_WORKER
+endif
+
 $(eval $(python-package))
Signature · 1 line
2.11.0
#1 lore raw

PATCH 1/1 python-gunicorn: fix build issues

Quoted 10 lines
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line

"Maxime" == Maxime Hadjinlian <[email protected]> writes:

Fix:

    http://autobuild.buildroot.org/results/b2d/b2d43dd3c52cc9f586009a10a40f97b07548322d/build-end.log

The issue arise from the fact that we compile all *.py files but the _gaiohttp.py file is using Python3 ("yield from") syntax which causes an error.

So we are using Python2, delete this file as it won't ever be imported

s/So we/So if we/

Quoted 15 lines

anyway as it is checked by gunicorn in the __init__.py file of the worker module.

---
 package/python-gunicorn/python-gunicorn.mk | 12 ++++++++++++
 1 file changed, 12 insertions(+)
package/python-gunicorn/python-gunicorn.mk +0 -0
index 426e809730..cfb7da110c 100644
@@ -11,4 +11,16 @@ PYTHON_GUNICORN_SETUP_TYPE = setuptools
 PYTHON_GUNICORN_LICENSE = MIT
 PYTHON_GUNICORN_LICENSE_FILES = LICENSE

package/python-gunicorn/python-gunicorn.mk PYTHON_GUNICORN_SETUP_TYPE = setuptools · line 22

Quoted 10 lines
package/python-gunicorn/python-gunicorn.mk +9 -0
 
+# At the end of the build, we try to compile all py files using the host python
+# that has been built.
+# The GAIO HTTP Worker is only compatible with Python3.4.2 and up. So don't try
+# to compile it with python 2.x
+ifeq ($(BR2_PACKAGE_PYTHON),y)
+define PYTHON_GUNICORN_REMOVE_GAIO_WORKER
+	find $(TARGET_DIR)/usr/lib/python$(PYTHON_VERSION_MAJOR)/site-packages/ \
+		-name "_gaiohttp.py" -exec rm -f {} \;
+endef

Do we expect this file to move around so we couldn't just use a normal:

   rm -f $(TARGET_DIR)/usr/lib/python$(PYTHON_VERSION_MAJOR)/site-packages/gunicorn/workers/_gaiohttp.py

But ok, that is a detail. Committed with the commit text tweaked a bit, thanks.

Signature · 1 line
Bye, Peter Korsgaard