Skip to contentSkip to conversation

python-kivy: new package

PATCH New Joseph Kogut 2 participants 2 messages Jun 26, 2019 – Aug 3, 2019

lore
Share & tools
lore
#0 lore raw

PATCH v6 1/1 python-kivy: new package

---

Changes v5 -> v6:
- Bump to version 1.11.1
- Enable building with OpenGL ES and SDL2 window provider

Changes v4 -> v5:
- Explicitly disable unavailable optional features
- Fix DEVELOPERS

Changes v3 -> v4:
- Remove dependency on glibc (tested on aarch64 w/ musl and X11 window provider, sdl2 still segfaults)
- Fix dependency on xlib_libX11 and xlib_libXrender

Changes v2 -> v3:
- Bump version to 1.10.1
- Remove upstreamed patch to remove getconf dependency
- Split config comments for OpenGL and glibc deps
- check-packages fixes

Changes v1 -> v2:
- Remove unnecessary build dependencies (suggested by Yegor)
- Require toolchain w/ glibc, as Kivy builds with others, but seems to segfault with (at least) musl.

 DEVELOPERS                           |  1 +
 package/Config.in                    |  1 +
 package/python-kivy/Config.in        | 26 ++++++++++++
 package/python-kivy/python-kivy.hash |  4 ++
 package/python-kivy/python-kivy.mk   | 62 ++++++++++++++++++++++++++++
 5 files changed, 94 insertions(+)
 create mode 100644 package/python-kivy/Config.in
 create mode 100644 package/python-kivy/python-kivy.hash
 create mode 100644 package/python-kivy/python-kivy.mk
DEVELOPERS +1 -0
index ce3fcb2de8..279f4fe5a4 100644
@@ -1219,6 +1219,7 @@ F:	package/gconf/
 F:	package/libnss/
 F:	package/llvm/
 F:	package/python-cython/
+F:	package/python-kivy/
 F:	package/python-raven/
 F:	package/python-schedule/
 F:	package/python-sentry-sdk/
package/Config.in +1 -0
index bc529e0b56..1a2223a366 100644
@@ -927,6 +927,7 @@ menu "External python modules"
 	source "package/python-jsonschema/Config.in"
 	source "package/python-json-schema-validator/Config.in"
 	source "package/python-keyring/Config.in"
+	source "package/python-kivy/Config.in"
 	source "package/python-libconfig/Config.in"
 	source "package/python-libusb1/Config.in"
 	source "package/python-lmdb/Config.in"
package/python-kivy/Config.in new file +26 -0
new file mode 100644
index 0000000000..521c69e389
@@ -0,0 +1,26 @@
+config BR2_PACKAGE_KIVY_USE_GLES
+	bool
+	default y
+	depends on !BR2_PACKAGE_HAS_LIBGL && BR2_PACKAGE_HAS_LIBGLES
+
+config BR2_PACKAGE_PYTHON_KIVY
+	bool "python-kivy"
+	depends on BR2_PACKAGE_HAS_LIBGL || BR2_PACKAGE_HAS_LIBGLES
+	select BR2_PACKAGE_HOST_PYTHON_CYTHON
+	select BR2_PACKAGE_LIBPNG # runtime
+	select BR2_PACKAGE_MTDEV # runtime
+	select BR2_PACKAGE_PYTHON_DOCUTILS # runtime
+	select BR2_PACKAGE_PYTHON_PYGMENTS # runtime
+	select BR2_PACKAGE_SDL2 if BR2_PACKAGE_KIVY_USE_GLES
+	select BR2_PACKAGE_SDL2_IMAGE if BR2_PACKAGE_KIVY_USE_GLES
+	select BR2_PACKAGE_SDL2_MIXER if BR2_PACKAGE_KIVY_USE_GLES
+	select BR2_PACKAGE_SDL2_TTF if BR2_PACKAGE_KIVY_USE_GLES
+	select BR2_PACKAGE_SDL2_OPENGLES if BR2_PACKAGE_KIVY_USE_GLES # runtime
+	help
+	  A software library for rapid development of
+	  hardware-accelerated multitouch applications.
+
+	  http://kivy.org
+
+comment "python-kivy needs an OpenGL or OpenGL ES provider"
+	depends on !(BR2_PACKAGE_HAS_LIBGL || BR2_PACKAGE_HAS_LIBGLES)
package/python-kivy/python-kivy.hash new file +4 -0
new file mode 100644
index 0000000000..5ea435ad94
@@ -0,0 +1,4 @@
+# sha256 locally computed
+sha256	8fad63cf6abaf72220b899d776b87327f22c8898d45dbe9635c9ff919ec4de93  python-kivy-1.11.1.tar.gz
+# License file, locally calculated
+sha256	282b3d8735ef6cbdcf8cc480947d50e0aea4ad1cc931d41f3f6a6bc23956f2d6  LICENSE
package/python-kivy/python-kivy.mk new file +62 -0

62 lines not on this page · raw message

--
2.22.0

#1 lore raw

PATCH v6 1/1 python-kivy: new package

Hello Joseph,

Thanks for this new version!

Quoted 1 line · On Wed, 26 Jun 2019 14:18:25 -0700 Joseph Kogut <[email protected]> wrote:

First of all, it doesn't build here. The following defconfig:

BR2_arm=y
BR2_TOOLCHAIN_EXTERNAL=y
BR2_TOOLCHAIN_EXTERNAL_CUSTOM=y
BR2_TOOLCHAIN_EXTERNAL_DOWNLOAD=y BR2_TOOLCHAIN_EXTERNAL_URL="http://autobuild.buildroot.org/toolchains/tarballs/br-arm-full-2019.05.1.tar.bz2" BR2_TOOLCHAIN_EXTERNAL_GCC_4_9=y
BR2_TOOLCHAIN_EXTERNAL_HEADERS_4_14=y
BR2_TOOLCHAIN_EXTERNAL_LOCALE=y
# BR2_TOOLCHAIN_EXTERNAL_HAS_THREADS_DEBUG is not set
BR2_TOOLCHAIN_EXTERNAL_CXX=y
BR2_INIT_NONE=y
BR2_SYSTEM_BIN_SH_NONE=y
# BR2_PACKAGE_BUSYBOX is not set
BR2_PACKAGE_RPI_USERLAND=y
BR2_PACKAGE_PYTHON3=y
BR2_PACKAGE_PYTHON_KIVY=y
# BR2_TARGET_ROOTFS_TAR is not set

gives the following errors:

Quoted 1 line
Quoted 1 line
Quoted 1 line

python-kivy 1.11.1 Building

(cd /home/thomas/projets/buildroot/output/build/python-kivy-1.11.1//; PATH="/home/thomas/projets/buildroot/output/host/bin:/home/thomas/projets/buildroot/output/host/sbin:/home/thomas/sys/bin/:/usr/libexec/python3-sphinx:/usr/share/Modules/bin:/usr/lib64/ccache:/usr/local/bin:/usr/local/sbin:/usr/bin:/usr/sbin:/home/thomas/.rvm/bin:/home/thomas/sys/bin:/home/thomas/.gem/ruby/2.1.0/bin:/home/thomas/.rvm/bin:/home/thomas/.local/bin" CC="/home/thomas/projets/buildroot/output/host/bin/arm-linux-gcc" CFLAGS="-D_LARGEFILE_SOURCE -D_LARGEFILE64_SOURCE -D_FILE_OFFSET_BITS=64 -Os " LDFLAGS="" LDSHARED="/home/thomas/projets/buildroot/output/host/bin/arm-linux-gcc -shared" PYTHONPATH="/home/thomas/projets/buildroot/output/target/usr/lib/python3.7/" PYTHONNOUSERSITE=1 _PYTHON_SYSCONFIGDATA_NAME="_sysconfigdata_m_linux_arm-linux-gnueabi" _python_sysroot=/home/thomas/projets/buildroot/output/host/arm-buildroot-linux-uclibcgnueabi/sysroot _python_prefix=/usr _python_exec_prefix=/usr USE_OPENGL_ES2=1 USE_OPENGL_MOCK=1 USE_GSTREAMER=0 USE_EGL=1 USE_SDL2=1 KIVY_SDL2_PATH=/home/thomas/projets/buildroot/output/host/arm-buildroot-linux-uclibcgnueabi/sysroot/usr/include/SDL2 USE_WAYLAND=0 USE_X11=0 /home/thomas/projets/buildroot/output/host/bin/python setup.py build --executable=/usr/bin/python ) Using setuptools
Environ change use_egl -> True
Environ change use_opengl_es2 -> True
Environ change use_opengl_mock -> True
Environ change use_sdl2 -> True
Environ change use_x11 -> False
Environ change use_wayland -> False
Environ change use_gstreamer -> False
Using this graphics system: OpenGL ES 2
SDL2 found via pkg-config
SDL2: found SDL header at /home/thomas/projets/buildroot/output/host/arm-buildroot-linux-uclibcgnueabi/sysroot/usr/include/SDL2/SDL.h
SDL2: found SDL_mixer header at /home/thomas/projets/buildroot/output/host/arm-buildroot-linux-uclibcgnueabi/sysroot/usr/include/SDL2/SDL_mixer.h
SDL2: found SDL_ttf header at /home/thomas/projets/buildroot/output/host/arm-buildroot-linux-uclibcgnueabi/sysroot/usr/include/SDL2/SDL_ttf.h
SDL2: found SDL_image header at /home/thomas/projets/buildroot/output/host/arm-buildroot-linux-uclibcgnueabi/sysroot/usr/include/SDL2/SDL_image.h
WARNING: A problem occurred while running pkg-config --libs --cflags pangoft2 (code 1)

b"Package pangoft2 was not found in the pkg-config search path.\nPerhaps you should add the directory containing `pangoft2.pc'\nto the PKG_CONFIG_PATH environment variable\nPackage 'pangoft2', required by 'virtual:world', not found\n"

ERROR: Dependency for context.pyx not resolved: config.pxi
ERROR: Dependency for compiler.pyx not resolved: config.pxi
ERROR: Dependency for context_instructions.pyx not resolved: config.pxi
ERROR: Dependency for fbo.pyx not resolved: config.pxi
ERROR: Dependency for gl_instructions.pyx not resolved: config.pxi
ERROR: Dependency for instructions.pyx not resolved: config.pxi
ERROR: Dependency for opengl.pyx not resolved: config.pxi
ERROR: Dependency for opengl_utils.pyx not resolved: config.pxi
ERROR: Dependency for shader.pyx not resolved: config.pxi
ERROR: Dependency for stencil_instructions.pyx not resolved: config.pxi
ERROR: Dependency for scissor_instructions.pyx not resolved: config.pxi
ERROR: Dependency for texture.pyx not resolved: config.pxi
ERROR: Dependency for vbo.pyx not resolved: config.pxi
ERROR: Dependency for vertex.pyx not resolved: config.pxi
ERROR: Dependency for vertex_instructions.pyx not resolved: config.pxi
ERROR: Dependency for cgl.pyx not resolved: config.pxi
ERROR: Dependency for cgl_mock.pyx not resolved: config.pxi
ERROR: Dependency for cgl_gl.pyx not resolved: config.pxi
ERROR: Dependency for cgl_glew.pyx not resolved: config.pxi
ERROR: Dependency for cgl_sdl2.pyx not resolved: config.pxi
ERROR: Dependency for svg.pyx not resolved: config.pxi
Download error on https://pypi.org/simple/cython/: unknown url type: https -- Some packages may not be found! Download error on https://pypi.org/simple/: unknown url type: https -- Some packages may not be found! No local packages or working download links found for cython!=0.27,!=0.27.2,<=0.29.10,>=0.24 Traceback (most recent call last):
File "setup.py", line 1206, in <module>

     'tuio': ['oscpy']

File "/home/thomas/projets/buildroot/output/host/lib/python3.7/site-packages/setuptools/__init__.py", line 144, in setup
_install_setup_requires(attrs)
File "/home/thomas/projets/buildroot/output/host/lib/python3.7/site-packages/setuptools/__init__.py", line 139, in _install_setup_requires
dist.fetch_build_eggs(dist.setup_requires)
File "/home/thomas/projets/buildroot/output/host/lib/python3.7/site-packages/setuptools/dist.py", line 717, in fetch_build_eggs
replace_conflicting=True,
File "/home/thomas/projets/buildroot/output/host/lib/python3.7/site-packages/pkg_resources/__init__.py", line 782, in resolve
replace_conflicting=replace_conflicting
File "/home/thomas/projets/buildroot/output/host/lib/python3.7/site-packages/pkg_resources/__init__.py", line 1065, in best_match
return self.obtain(req, installer)
File "/home/thomas/projets/buildroot/output/host/lib/python3.7/site-packages/pkg_resources/__init__.py", line 1077, in obtain
return installer(requirement)
File "/home/thomas/projets/buildroot/output/host/lib/python3.7/site-packages/setuptools/dist.py", line 784, in fetch_build_egg
return cmd.easy_install(req)
File "/home/thomas/projets/buildroot/output/host/lib/python3.7/site-packages/setuptools/command/easy_install.py", line 673, in easy_install
raise DistutilsError(msg)
distutils.errors.DistutilsError: Could not find suitable distribution for Requirement.parse('cython!=0.27,!=0.27.2,<=0.29.10,>=0.24')
make[1]: *** [package/pkg-generic.mk:241: /home/thomas/projets/buildroot/output/build/python-kivy-1.11.1/.stamp_built] Error 1
make: *** [Makefile:84: _all] Error 2

There are two things that strike out here:

- It seems to need pango.

- It seems like it tries to download some stuff, which is really bad, it shouldn't download anything.

See below for some more review comments.

package/python-kivy/Config.in line 4

Quoted 10 lines
package/python-kivy/Config.in new file +4 -0
new file mode 100644
index 0000000000..521c69e389
@@ -0,0 +1,26 @@
+config BR2_PACKAGE_KIVY_USE_GLES
+	bool
+	default y
+	depends on !BR2_PACKAGE_HAS_LIBGL && BR2_PACKAGE_HAS_LIBGLES

This config option is probably not needed, see below.

Quoted 4 lines
package/python-kivy/Config.in new file +4 -0
+
+config BR2_PACKAGE_PYTHON_KIVY
+	bool "python-kivy"
+	depends on BR2_PACKAGE_HAS_LIBGL || BR2_PACKAGE_HAS_LIBGLES

package/python-kivy/Config.in line 18

Quoted 10 lines
package/python-kivy/Config.in new file +10 -0
+	select BR2_PACKAGE_HOST_PYTHON_CYTHON
+	select BR2_PACKAGE_LIBPNG # runtime
+	select BR2_PACKAGE_MTDEV # runtime
+	select BR2_PACKAGE_PYTHON_DOCUTILS # runtime
+	select BR2_PACKAGE_PYTHON_PYGMENTS # runtime
+	select BR2_PACKAGE_SDL2 if BR2_PACKAGE_KIVY_USE_GLES
+	select BR2_PACKAGE_SDL2_IMAGE if BR2_PACKAGE_KIVY_USE_GLES
+	select BR2_PACKAGE_SDL2_MIXER if BR2_PACKAGE_KIVY_USE_GLES
+	select BR2_PACKAGE_SDL2_TTF if BR2_PACKAGE_KIVY_USE_GLES
+	select BR2_PACKAGE_SDL2_OPENGLES if BR2_PACKAGE_KIVY_USE_GLES # runtime

Here you can simply do:

select BR2_PACKAGE_SDL2 if !BR2_PACKAGE_HAS_LIBGL

and ditto for all other options. This way BR2_PACKAGE_KIVY_USE_GLES is not needed.

Quoted 8 lines
package/python-kivy/python-kivy.mk new file +2 -0
new file mode 100644
index 0000000000..deefa8fd07
@@ -0,0 +1,62 @@
+################################################################################
+#

package/python-kivy/python-kivy.mk line 12

Quoted 10 lines
package/python-kivy/python-kivy.mk new file +10 -0
+# python-kivy
+#
+################################################################################
+
+PYTHON_KIVY_VERSION = 1.11.1
+PYTHON_KIVY_SITE = $(call github,kivy,kivy,$(PYTHON_KIVY_VERSION))
+PYTHON_KIVY_SETUP_TYPE = distutils
+PYTHON_KIVY_LICENSE = MIT
+PYTHON_KIVY_LICENSE_FILES = LICENSE
+PYTHON_KIVY_DEPENDENCIES = host-python-cython libgl

I thought you could use libgl or libgles, but here you unconditionally depend on libgl, that doesn't look good.

Also, the below dependencies look a bit messy, I think there should be a clear GL / GLES conditional:

ifeq ($(BR2_PACKAGE_HAS_LIBGL),y)
PYTHON_KIVY_DEPENDENCIES += libgl
PYTHON_KIVY_ENV += USE_SDL=0
ifeq ($(BR2_PACKAGE_XLIB_LIBX11)$(BR2_PACKAGE_XLIB_LIBXRENDER),yy) PYTHON_KIVY_DEPENDENCIES += xlib_libX11 xlib_libXrender PYTHON_KIVY_ENV += USE_X11=1
else
PYTHON_KIVY_ENV += USE_X11=0
endif
else ifeq ($(BR2_PACKAGE_HAS_LIBGLES),y) PYTHON_KIVY_DEPENDENCIES += libgles sdl2 sdl2_image sdl2_mixer sdl2_ttf

PYTHON_KIVY_ENV += \
	USE_OPENGL_ES2=1 \
	USE_OPENGL_MOCK=1 \
	USE_SDL=1 \
	KIVY_SDL2_PATH=$(STAGING_DIR)/usr/include/SDL2

endif

package/python-kivy/python-kivy.mk line 60

Quoted 5 lines
package/python-kivy/python-kivy.mk new file +5 -0
+define PYTHON_KIVY_REMOVE_EXAMPLES
+	rm -rf $(TARGET_DIR)/usr/share/kivy-examples
+endef
+
+PYTHON_KIVY_POST_INSTALL_TARGET_HOOKS += PYTHON_KIVY_REMOVE_EXAMPLES

Maybe for a package like this it makes sense to have a sub-option to keep the examples on the target.

Could you have a look at the above issues, and send an updated patch ?

Thanks!

Thomas

Signature · 3 lines
Thomas Petazzoni, CTO, Bootlin
Embedded Linux and Kernel engineering
https://bootlin.com