Skip to content

Commit

Permalink
python-packages: Disable parallel build when host pip is needed
Browse files Browse the repository at this point in the history
This adds PKG_BUILD_PARALLEL:=0 to packages that depend on host Python
packages (HOST_PYTHON3_PACKAGE_BUILD_DEPENDS), because installing
packages with multiple concurrent pip processes can lead to errors or
unexpected results[1].

This also:

* Move HOST_PYTHON3_PACKAGE_BUILD_DEPENDS definitions to before
  python3-package.mk is included

* Update Python folder readme to include PKG_BUILD_PARALLEL:=0

[1]: pypa/pip#2361

Signed-off-by: Jeffery To <[email protected]>
  • Loading branch information
jefferyto authored and blocktrron committed Jul 22, 2020
1 parent 84d4b2f commit e4381f9
Show file tree
Hide file tree
Showing 12 changed files with 33 additions and 20 deletions.
3 changes: 3 additions & 0 deletions lang/python/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -332,8 +332,11 @@ These can be installed via pip and ideally they should only be installed like th

Which is why [for example] if you need python cffi on the host build, it's easier to just add it via:
```
PKG_BUILD_PARALLEL:=0
HOST_PYTHON3_PACKAGE_BUILD_DEPENDS:="cffi==$(PKG_VERSION)"
```
[cffi is one of those packages that needs a host-side package installed].

This works reasonably well in the current OpenWrt build system, as binaries get built for this package and get installed in the staging-dir `$(STAGING_DIR)/usr/lib/pythonX.Y/site-packages`.

`PKG_BUILD_PARALLEL:=0` is necessary because installing packages with multiple concurrent pip processes can lead to [errors or unexpected results](https://github.com/pypa/pip/issues/2361).
3 changes: 2 additions & 1 deletion lang/python/bcrypt/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ include $(TOPDIR)/rules.mk

PKG_NAME:=bcrypt
PKG_VERSION:=3.1.7
PKG_RELEASE:=2
PKG_RELEASE:=3

PYPI_NAME:=$(PKG_NAME)
PKG_HASH:=0b0069c752ec14172c5f78208f1863d7ad6755a6fae6fe76ec2c80d13be41e42
Expand All @@ -16,6 +16,7 @@ PKG_LICENSE:=Apache-2.0
PKG_LICENSE_FILES:=LICENSE

PKG_BUILD_DEPENDS:=libffi/host
PKG_BUILD_PARALLEL:=0
HOST_PYTHON3_PACKAGE_BUILD_DEPENDS:="cffi>=1.1"

include ../pypi.mk
Expand Down
5 changes: 3 additions & 2 deletions lang/python/numpy/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ include $(TOPDIR)/rules.mk

PKG_NAME:=numpy
PKG_VERSION:=1.18.5
PKG_RELEASE:=1
PKG_RELEASE:=2

PYPI_NAME:=$(PKG_NAME)
PKG_HASH:=34e96e9dae65c4839bd80012023aadd6ee2ccb73ce7fdf3074c62f301e63120b
Expand All @@ -20,7 +20,8 @@ PKG_CPE_ID:=cpe:/a:numpy:numpy

# yes, zip... sigh
PYPI_SOURCE_EXT:=zip
HOST_PYTHON3_PACKAGE_BUILD_DEPENDS="Cython==0.29.19"
PKG_BUILD_PARALLEL:=0
HOST_PYTHON3_PACKAGE_BUILD_DEPENDS:="Cython==0.29.19"

include ../pypi.mk
include $(INCLUDE_DIR)/package.mk
Expand Down
3 changes: 2 additions & 1 deletion lang/python/python-cryptography/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ include $(TOPDIR)/rules.mk

PKG_NAME:=python-cryptography
PKG_VERSION:=2.9.2
PKG_RELEASE:=1
PKG_RELEASE:=2

PYPI_NAME:=cryptography
PKG_HASH:=a0c30272fb4ddda5f5ffc1089d7405b7a71b0b0f51993cb4e5dbb4590b2fc229
Expand All @@ -19,6 +19,7 @@ PKG_LICENSE_FILES:=LICENSE.APACHE LICENSE.BSD
PKG_MAINTAINER:=Jeffery To <[email protected]>, Alexandru Ardelean <[email protected]>

PKG_BUILD_DEPENDS:=libffi/host
PKG_BUILD_PARALLEL:=0

HOST_PYTHON3_PACKAGE_BUILD_DEPENDS:="cffi>=1.8,!=1.11.3"

Expand Down
5 changes: 3 additions & 2 deletions lang/python/python-jsonschema/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ include $(TOPDIR)/rules.mk

PKG_NAME:=python-jsonschema
PKG_VERSION:=3.2.0
PKG_RELEASE:=3
PKG_RELEASE:=4

PYPI_NAME:=jsonschema
PKG_HASH:=c8a85b28d377cc7737e46e2d9f2b4f44ee3c0e1deac6bf46ddefc7187d30797a
Expand All @@ -11,7 +11,8 @@ PKG_MAINTAINER:=Javier Marcet <[email protected]>
PKG_LICENSE:=MIT
PKG_LICENSE_FILES:=COPYING

HOST_PYTHON3_PACKAGE_BUILD_DEPENDS=setuptools_scm
PKG_BUILD_PARALLEL:=0
HOST_PYTHON3_PACKAGE_BUILD_DEPENDS:=setuptools_scm

include ../pypi.mk
include $(INCLUDE_DIR)/package.mk
Expand Down
7 changes: 4 additions & 3 deletions lang/python/python-pluggy/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ include $(TOPDIR)/rules.mk

PKG_NAME:=python-pluggy
PKG_VERSION:=0.13.1
PKG_RELEASE:=2
PKG_RELEASE:=3

PYPI_NAME:=pluggy
PKG_HASH:=15b2acde666561e1298d71b523007ed7364de07029219b604cf808bfa1c765b0
Expand All @@ -18,12 +18,13 @@ PKG_MAINTAINER:=Jan Pavlinec <[email protected]>
PKG_LICENSE:=MIT
PKG_LICENSE_FILES:=LICENSE

PKG_BUILD_PARALLEL:=0
HOST_PYTHON3_PACKAGE_BUILD_DEPENDS:=setuptools-scm

include ../pypi.mk
include $(INCLUDE_DIR)/package.mk
include ../python3-package.mk

HOST_PYTHON3_PACKAGE_BUILD_DEPENDS:=setuptools-scm

define Package/python3-pluggy
SUBMENU:=Python
SECTION:=lang
Expand Down
7 changes: 4 additions & 3 deletions lang/python/python-py/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ include $(TOPDIR)/rules.mk

PKG_NAME:=python-py
PKG_VERSION:=1.8.1
PKG_RELEASE:=2
PKG_RELEASE:=3

PYPI_NAME:=py
PKG_HASH:=5e27081401262157467ad6e7f851b7aa402c5852dbcb3dae06768434de5752aa
Expand All @@ -18,12 +18,13 @@ PKG_MAINTAINER:=Jan Pavlinec <[email protected]>
PKG_LICENSE:=MIT
PKG_LICENSE_FILES:=LICENSE

PKG_BUILD_PARALLEL:=0
HOST_PYTHON3_PACKAGE_BUILD_DEPENDS:=setuptools-scm

include ../pypi.mk
include $(INCLUDE_DIR)/package.mk
include ../python3-package.mk

HOST_PYTHON3_PACKAGE_BUILD_DEPENDS:=setuptools-scm

define Package/python3-py
SUBMENU:=Python
SECTION:=lang
Expand Down
3 changes: 2 additions & 1 deletion lang/python/python-pycparser/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ include $(TOPDIR)/rules.mk

PKG_NAME:=python-pycparser
PKG_VERSION:=2.20
PKG_RELEASE:=2
PKG_RELEASE:=3

PYPI_NAME:=pycparser
PKG_HASH:=2d475327684562c3a96cc71adf7dc8c4f0565175cf86b6d7a404ff4c771f15f0
Expand All @@ -18,6 +18,7 @@ PKG_LICENSE:=BSD-3-Clause
PKG_LICENSE_FILES:=LICENSE
PKG_MAINTAINER:=Jeffery To <[email protected]>

PKG_BUILD_PARALLEL:=0
HOST_PYTHON3_PACKAGE_BUILD_DEPENDS:="ply==3.10"

include ../pypi.mk
Expand Down
3 changes: 2 additions & 1 deletion lang/python/python-pynacl/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ include $(TOPDIR)/rules.mk

PKG_NAME:=python-pynacl
PKG_VERSION:=1.4.0
PKG_RELEASE:=2
PKG_RELEASE:=3

PYPI_NAME:=PyNaCl
PKG_HASH:=54e9a2c849c742006516ad56a88f5c74bf2ce92c9f67435187c3c5953b346505
Expand All @@ -12,6 +12,7 @@ PKG_LICENSE:=Apache-2.0
PKG_LICENSE_FILES:=LICENSE

PKG_BUILD_DEPENDS:=libffi/host
PKG_BUILD_PARALLEL:=0

HOST_PYTHON3_PACKAGE_BUILD_DEPENDS:="cffi>=1.4.1"

Expand Down
3 changes: 2 additions & 1 deletion lang/python/python-pytest/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ include $(TOPDIR)/rules.mk

PKG_NAME:=python-pytest
PKG_VERSION:=5.4.2
PKG_RELEASE:=1
PKG_RELEASE:=2

PYPI_NAME:=pytest
PKG_HASH:=eb2b5e935f6a019317e455b6da83dd8650ac9ffd2ee73a7b657a30873d67a698
Expand All @@ -18,6 +18,7 @@ PKG_MAINTAINER:=Jan Pavlinec <[email protected]>
PKG_LICENSE:=MIT
PKG_LICENSE_FILES:=LICENSE

PKG_BUILD_PARALLEL:=0
HOST_PYTHON3_PACKAGE_BUILD_DEPENDS:=setuptools-scm

include ../pypi.mk
Expand Down
7 changes: 4 additions & 3 deletions lang/python/python-zipp/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ include $(TOPDIR)/rules.mk

PKG_NAME:=python-zipp
PKG_VERSION:=3.1.0
PKG_RELEASE:=2
PKG_RELEASE:=3

PYPI_NAME:=zipp
PKG_HASH:=c599e4d75c98f6798c509911d08a22e6c021d074469042177c8c86fb92eefd96
Expand All @@ -11,6 +11,9 @@ PKG_MAINTAINER:=Jan Pavlinec <[email protected]>
PKG_LICENSE:=MIT
PKG_LICENSE_FILES:=LICENSE

PKG_BUILD_PARALLEL:=0
HOST_PYTHON3_PACKAGE_BUILD_DEPENDS:="setuptools_scm[toml] >= 3.4.1"

include ../pypi.mk
include $(INCLUDE_DIR)/package.mk
include ../python3-package.mk
Expand All @@ -24,8 +27,6 @@ define Package/python3-zipp
DEPENDS:=+python3-light
endef

HOST_PYTHON3_PACKAGE_BUILD_DEPENDS:="setuptools_scm[toml] >= 3.4.1"

define Package/python3-zipp/description
Backport of pathlib-compatible object wrapper for zip files
endef
Expand Down
4 changes: 2 additions & 2 deletions net/seafile-seahub/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ include $(TOPDIR)/rules.mk

PKG_NAME:=seafile-seahub
PKG_VERSION:=7.1.4
PKG_RELEASE:=1
PKG_RELEASE:=2

PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz
PKG_SOURCE_URL:=https://codeload.github.com/haiwen/seahub/tar.gz/v$(PKG_VERSION)-server?
Expand All @@ -23,7 +23,7 @@ PKG_BUILD_DIR:=$(BUILD_DIR)/seahub-$(PKG_VERSION)-server

HOST_PYTHON3_PACKAGE_BUILD_DEPENDS:="Django~=1.11"

PKG_BUILD_PARALLEL:=1
PKG_BUILD_PARALLEL:=0
PYTHON3_PKG_BUILD:=0

include $(INCLUDE_DIR)/package.mk
Expand Down

0 comments on commit e4381f9

Please sign in to comment.