Skip to content

Commit

Permalink
homeassistant: Migrate to ujson & numpy using pip (#5096)
Browse files Browse the repository at this point in the history
* homeassistant: Migrate ujson to using pip through setuptools-scm

* wheel.mk: Add missing @ to avoid printing code output

* python310: Adjust howto for numpy

* bazarr: Fix numpy gcc handling

* homeassistant: Migrate to pip numpy
  • Loading branch information
th0ma7 authored Jan 25, 2022
1 parent 0698267 commit 4dc6b1a
Show file tree
Hide file tree
Showing 14 changed files with 90 additions and 139 deletions.
27 changes: 0 additions & 27 deletions cross/numpy/Makefile

This file was deleted.

Empty file removed cross/numpy/PLIST
Empty file.
3 changes: 0 additions & 3 deletions cross/numpy/digests

This file was deleted.

This file was deleted.

2 changes: 2 additions & 0 deletions cross/python310/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -137,6 +137,8 @@ python310_post_install: $(WORK_DIR)/python-cc.mk
. $(WORK_DIR)/crossenv/bin/activate && $(RUN) python get-pip.py "pip==21.3.1"
. $(WORK_DIR)/crossenv/bin/activate && $(RUN) build-pip install "setuptools==60.2.0"
. $(WORK_DIR)/crossenv/bin/activate && $(RUN) pip install "setuptools==60.2.0"
. $(WORK_DIR)/crossenv/bin/activate && $(RUN) build-pip install "setuptools-scm==6.4.2"
. $(WORK_DIR)/crossenv/bin/activate && $(RUN) pip install "setuptools-scm==6.4.2"
. $(WORK_DIR)/crossenv/bin/activate && $(RUN) build-pip install "wheel==0.37.1"
. $(WORK_DIR)/crossenv/bin/activate && $(RUN) pip install "wheel==0.37.1"
. $(WORK_DIR)/crossenv/bin/activate && $(RUN) build-pip install "cffi==1.15.0"
Expand Down
14 changes: 0 additions & 14 deletions cross/ujson/Makefile

This file was deleted.

Empty file removed cross/ujson/PLIST
Empty file.
3 changes: 0 additions & 3 deletions cross/ujson/digests

This file was deleted.

2 changes: 1 addition & 1 deletion mk/spksrc.wheel.mk
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ build_wheel_target: SHELL:=/bin/bash
build_wheel_target: $(PRE_WHEEL_TARGET)
ifneq ($(strip $(WHEELS)),)
$(foreach e,$(shell cat $(WORK_DIR)/python-cc.mk),$(eval $(e)))
$(MSG) "Cross-compiling wheels" ; \
@$(MSG) "Cross-compiling wheels" ; \
localPIP=$(PIP) ; \
if [ -s "$(CROSSENV)" ] ; then \
$(MSG) "Python crossenv found: [$(CROSSENV)]" ; \
Expand Down
14 changes: 8 additions & 6 deletions spk/bazarr/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -33,18 +33,20 @@ ADMIN_PORT = $(SERVICE_PORT)

WHEELS = src/requirements-crossenv.txt src/requirements-pure.txt

# [numpy] gcc-4.6.4 failed with exit status 1
# [numpy]
# gcc-4.6.4 failed with exit status 1
# https://github.com/numpy/numpy/issues/20664
UNSUPPORTED_ARCHS = $(ARMv5_ARCHS)

include ../../mk/spksrc.common.mk
include ../../mk/spksrc.spk.mk

# [numpy] Fix wheel building with older compilers
ifeq ($(call version_lt, ${TCVERSION}, 7.0),1)
# [numpy]
# Fix wheel building with older compilers
ifeq ($(call version_lt, $(TC_GCC), 5.0),1)
WHEELS_CPPFLAGS = [numpy] -std=c++0x
# workaround for compiler bug:
# https://github.com/numpy/numpy/issues/13622
ifeq ($(findstring $(ARCH),$(ARMv8_ARCHS)),$(ARCH))
WHEELS_CFLAGS = [numpy] -O0
endif
endif

include ../../mk/spksrc.spk.mk
68 changes: 39 additions & 29 deletions spk/homeassistant/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -7,23 +7,41 @@ SPK_DEPENDS = "python310"

BUILD_DEPENDS = cross/python310

MAINTAINER = hgy59
DESCRIPTION = "Home Assistant is an open-source home automation platform running on Python 3. Track and control all devices at home and automate control."
DISPLAY_NAME = Home Assistant Core
CHANGELOG = "Update homeassistant to 2021.9.7.<br/>Only arch specific python modules are included in the package. Other modules are downloaded at installation time."
STARTABLE = yes

HOMEPAGE = https://www.home-assistant.io/
LICENSE = Apache-2.0

WIZARDS_DIR = src/wizard

SERVICE_USER = auto
SERVICE_SETUP = src/service-setup.sh
SERVICE_PORT = 8123
SERVICE_PORT_TITLE = $(DISPLAY_NAME)
ADMIN_PORT = $(SERVICE_PORT)

USE_ALTERNATE_TMPDIR = 1

POST_STRIP_TARGET = homeassistant_extra_install

# Include cross compiled wheels only, the package installer downloads pure python wheels at installation time.
WHEELS = src/requirements-crossenv.txt src/requirements-pure.txt src/requirements-abi3.txt

# [gevent]
DEPENDS += cross/libev cross/c-ares
ENV += GEVENTSETUP_EMBED_CARES=FALSE
ENV += GEVENTSETUP_EMBED_LIBEV=FALSE

# for iqvia
DEPENDS += cross/numpy

# [python-libnmap]
DEPENDS += cross/nmap

# [DTLSSocket] Required for postinst [tradfri]
DEPENDS += cross/dtlssocket

# [flunearyou]
DEPENDS += cross/ujson

# [PyYAML]
DEPENDS += cross/libyaml

Expand All @@ -44,32 +62,24 @@ WHEELS_BUILD_ARGS += --enable-freetype
WHEELS_BUILD_ARGS += --enable-jpeg
WHEELS_BUILD_ARGS += --enable-zlib

# Include cross compiled wheels only, the package installer downloads pure python wheels at installation time.
WHEELS = src/requirements-crossenv.txt src/requirements-pure.txt src/requirements-abi3.txt

MAINTAINER = hgy59
DESCRIPTION = "Home Assistant is an open-source home automation platform running on Python 3. Track and control all devices at home and automate control."
DISPLAY_NAME = Home Assistant Core
CHANGELOG = "Update homeassistant to 2021.9.7.<br/>Only arch specific python modules are included in the package. Other modules are downloaded at installation time."
STARTABLE = yes

HOMEPAGE = https://www.home-assistant.io/
LICENSE = Apache-2.0

WIZARDS_DIR = src/wizard

SERVICE_USER = auto
SERVICE_SETUP = src/service-setup.sh
SERVICE_PORT = 8123
SERVICE_PORT_TITLE = $(DISPLAY_NAME)
ADMIN_PORT = $(SERVICE_PORT)

USE_ALTERNATE_TMPDIR = 1

POST_STRIP_TARGET = homeassistant_extra_install
# [numpy]
# gcc-4.6.4 failed with exit status 1
# https://github.com/numpy/numpy/issues/20664
UNSUPPORTED_ARCHS = $(ARMv5_ARCHS)

include ../../mk/spksrc.spk.mk

# [numpy]
# Fix wheel building with older compilers
ifeq ($(call version_lt, $(TC_GCC), 5.0),1)
WHEELS_CPPFLAGS = [numpy] -std=c++0x
# workaround for compiler bug:
# https://github.com/numpy/numpy/issues/13622
ifeq ($(findstring $(ARCH),$(ARMv8_ARCHS)),$(ARCH))
WHEELS_CFLAGS = [numpy] -O0
endif
endif

.PHONY: homeassistant_extra_install
homeassistant_extra_install:
@install -m 755 -d $(STAGING_DIR)/share
Expand Down
3 changes: 2 additions & 1 deletion spk/homeassistant/src/requirements-crossenv.txt
Original file line number Diff line number Diff line change
Expand Up @@ -23,14 +23,15 @@ cryptography==3.3.2
# httpx==0.19.0
# idna==3.3 ==> pure
# jinja2==3.0.3 ==> pure
# numpy==1.21.4 # requires to be built as cross/numpy
numpy==1.21.4
# PyJWT==1.7.1 ==> pure
PyNaCl==1.4.0
## pip>=8.0.3,<20.3
# python-slugify==4.0.1
PyYAML==5.4.1
# requests==2.26.0 ==> pure
# ruamel.yaml==0.15.100 ==> pure
ujson==4.2.0
# voluptuous==0.12.1
# voluptuous-serialize==2.4.0
yarl==1.6.3
Expand Down
67 changes: 34 additions & 33 deletions spk/python310/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,31 @@ SPK_ICON = src/python3.png
DEPENDS = cross/$(SPK_NAME)
DEPENDS += cross/pip

MAINTAINER = SynoCommunity
DESCRIPTION = Python Programming Language.
DESCRIPTION_FRE = Langage de programmation Python.
DESCRIPTION_SPN = Lenguaje de programación Python.
STARTABLE = no
DISPLAY_NAME = Python 3.10
CHANGELOG = "1. Update to python 3.10.1"

HOMEPAGE = https://www.python.org
LICENSE = PSF

SERVICE_SETUP = src/service-setup.sh

ENV += PYTHON_OPTIMIZE=1
PYTHON_LIB_DIR = lib/python$(SPK_VERS_MAJOR_MINOR)

POST_STRIP_TARGET = python310_extra_install

SPK_USR_LOCAL_LINKS = bin:bin/python3.10

WHEELS = src/requirements-crossenv.txt src/requirements-pure.txt src/requirements-abi3.txt

# Force building pure-python wheels
# WHEELS_PURE_PYTHON_PACKAGING_ENABLE = 1

##
## All configurations below are optional and
## are provided to demonstrate how to build
Expand Down Expand Up @@ -51,48 +76,24 @@ DEPENDS += cross/pip
# ENV += MYSQLCLIENT_CFLAGS="$(CFLAGS) -I$(STAGING_INSTALL_PREFIX)/include/mysql -I$(STAGING_INSTALL_PREFIX)/include/mariadb -I$(STAGING_INSTALL_PREFIX)/$(PYTHON_INC_DIR)"
# ENV += MYSQLCLIENT_LDFLAGS="$(LDFLAGS)"

include ../../mk/spksrc.common.mk

# [numpy] gcc-4.6.4 failed with exit status 1
# [numpy]
# gcc-4.6.4 failed with exit status 1
# https://github.com/numpy/numpy/issues/20664
# UNSUPPORTED_ARCHS = $(ARMv5_ARCHS)

# [numpy] Fix wheel building with older compilers
# ifeq ($(call version_lt, ${TCVERSION}, 7.0),1)
include ../../mk/spksrc.spk.mk

# [numpy]
# Fix wheel building with older compilers
# ifeq ($(call version_lt, $(TC_GCC), 5.0),1)
# WHEELS_CPPFLAGS = [numpy] -std=c++0x
# workaround for compiler bug:
# https://github.com/numpy/numpy/issues/13622
# ifeq ($(findstring $(ARCH),$(ARMv8_ARCHS)),$(ARCH))
# WHEELS_CFLAGS = [numpy] -O0
# endif
# endif

# Force building pure-python wheels
# WHEELS_PURE_PYTHON_PACKAGING_ENABLE = 1

WHEELS = src/requirements-crossenv.txt src/requirements-pure.txt src/requirements-abi3.txt

MAINTAINER = SynoCommunity
DESCRIPTION = Python Programming Language.
DESCRIPTION_FRE = Langage de programmation Python.
DESCRIPTION_SPN = Lenguaje de programación Python.
STARTABLE = no
DISPLAY_NAME = Python 3.10
CHANGELOG = "1. Update to python 3.10.1"

HOMEPAGE = https://www.python.org
LICENSE = PSF

SERVICE_SETUP = src/service-setup.sh

ENV += PYTHON_OPTIMIZE=1

PYTHON_LIB_DIR = lib/python$(SPK_VERS_MAJOR_MINOR)

POST_STRIP_TARGET = python310_extra_install

SPK_USR_LOCAL_LINKS = bin:bin/python3.10

include ../../mk/spksrc.spk.mk

.PHONY: python310_extra_install
python310_extra_install:
rm -f $(STAGING_DIR)/$(PYTHON_LIB_DIR)/config/libpython*.a
Expand Down
4 changes: 4 additions & 0 deletions spk/python310/src/requirements-crossenv.txt
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,10 @@
# WHEELS_BUILD_ARGS = [Pillow] build_ext --disable-platform-guessing
# Pillow==9.0.0

# ujson:
# - Require setuptools-scm in cross/python310 crossenv
# ujson==5.1.0

# numpy:
# - Require Cython in cross/python310 crossenv
# - DSM6 require WHEELS_CFLAGS=-std=c++0x
Expand Down

0 comments on commit 4dc6b1a

Please sign in to comment.