From b9d88065f519583841602170a0f2827fb5ce02f3 Mon Sep 17 00:00:00 2001 From: Alexandru Ardelean Date: Fri, 19 May 2017 17:16:38 +0300 Subject: [PATCH 1/3] python,python3: allow python packages to override Package//install rule Python packages try to enforce their own. For some cases this may not be desired. Signed-off-by: Alexandru Ardelean --- lang/python/python/files/python-package.mk | 2 ++ lang/python/python3/files/python3-package.mk | 2 ++ 2 files changed, 4 insertions(+) diff --git a/lang/python/python/files/python-package.mk b/lang/python/python/files/python-package.mk index e9ec85c6f..0805fc9c2 100644 --- a/lang/python/python/files/python-package.mk +++ b/lang/python/python/files/python-package.mk @@ -61,6 +61,7 @@ define PyPackage endef endif + ifndef Package/$(1)/install $(call shexport,PyPackage/$(1)/filespec) define Package/$(1)/install @@ -85,6 +86,7 @@ define PyPackage define Package/$(1)-src/install $$(call Package/$(1)/install,$$(1),sources) endef + endif # Package/$(1)/install endef $(call include_mk, python-host.mk) diff --git a/lang/python/python3/files/python3-package.mk b/lang/python/python3/files/python3-package.mk index a28689aba..36a030c02 100644 --- a/lang/python/python3/files/python3-package.mk +++ b/lang/python/python3/files/python3-package.mk @@ -61,6 +61,7 @@ define Py3Package endef endif + ifndef Package/$(1)/install $(call shexport,Py3Package/$(1)/filespec) define Package/$(1)/install @@ -85,6 +86,7 @@ define Py3Package define Package/$(1)-src/install $$(call Package/$(1)/install,$$(1),sources) endef + endif # Package/$(1)/install endef $(call include_mk, python3-host.mk) From a4691a289c00f93f126df4c5d3fe68c3fb0ef72a Mon Sep 17 00:00:00 2001 From: Alexandru Ardelean Date: Fri, 19 May 2017 17:18:33 +0300 Subject: [PATCH 2/3] python3: remove __pycache__ folders pip & setuptools python3-pip & python3-setuptools have slightly different installation mechanisms. We need to remove the __pycache__ folders. Seems they're generated. This also reduces the size of the python3-pip & python3-setuptools packages. Signed-off-by: Alexandru Ardelean --- lang/python/python3/files/python3-package-pip.mk | 1 + lang/python/python3/files/python3-package-setuptools.mk | 1 + 2 files changed, 2 insertions(+) diff --git a/lang/python/python3/files/python3-package-pip.mk b/lang/python/python3/files/python3-package-pip.mk index 0bd54aac8..b20a10f79 100644 --- a/lang/python/python3/files/python3-package-pip.mk +++ b/lang/python/python3/files/python3-package-pip.mk @@ -20,6 +20,7 @@ define Py3Package/python3-pip/install $(CP) \ $(PKG_BUILD_DIR)/install-pip/lib/python$(PYTHON3_VERSION)/site-packages/pip \ $(1)/usr/lib/python$(PYTHON3_VERSION)/site-packages/ + find $(1)/usr/lib/python$(PYTHON3_VERSION)/site-packages/ -name __pycache__ | xargs rm -rf endef $(eval $(call Py3BasePackage,python3-pip, \ diff --git a/lang/python/python3/files/python3-package-setuptools.mk b/lang/python/python3/files/python3-package-setuptools.mk index 52d56e9ed..9a646334f 100644 --- a/lang/python/python3/files/python3-package-setuptools.mk +++ b/lang/python/python3/files/python3-package-setuptools.mk @@ -23,6 +23,7 @@ define Py3Package/python3-setuptools/install $(PKG_BUILD_DIR)/install-setuptools/lib/python$(PYTHON3_VERSION)/site-packages/setuptools \ $(PKG_BUILD_DIR)/install-setuptools/lib/python$(PYTHON3_VERSION)/site-packages/easy_install.py \ $(1)/usr/lib/python$(PYTHON3_VERSION)/site-packages + find $(1)/usr/lib/python$(PYTHON3_VERSION)/site-packages/ -name __pycache__ | xargs rm -rf endef $(eval $(call Py3BasePackage,python3-setuptools, \ From 0d54d05b6d42c45f31c80c8679188d0d4d15de2d Mon Sep 17 00:00:00 2001 From: Alexandru Ardelean Date: Fri, 19 May 2017 17:20:04 +0300 Subject: [PATCH 3/3] python3-pip: override Package/python3-pip/install rule This is in essence fixes pip3. That means pip3 will ship without Python byte-codes for a while, until I'll find a better way to fix it. I couldn't think of a not-very hack-ish way of doing it. The only draw-back of this, will be that pip3 will run a bit slower ; but that should be ok for a while. Signed-off-by: Alexandru Ardelean --- lang/python/python3/Makefile | 2 +- lang/python/python3/files/python3-package-pip.mk | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/lang/python/python3/Makefile b/lang/python/python3/Makefile index 584dcbb5f..97c0f6efe 100644 --- a/lang/python/python3/Makefile +++ b/lang/python/python3/Makefile @@ -14,7 +14,7 @@ PYTHON_VERSION:=$(PYTHON3_VERSION) PYTHON_VERSION_MICRO:=$(PYTHON3_VERSION_MICRO) PKG_NAME:=python3 -PKG_RELEASE:=1 +PKG_RELEASE:=2 PKG_VERSION:=$(PYTHON_VERSION).$(PYTHON_VERSION_MICRO) PKG_SOURCE:=Python-$(PKG_VERSION).tar.xz diff --git a/lang/python/python3/files/python3-package-pip.mk b/lang/python/python3/files/python3-package-pip.mk index b20a10f79..43e05f1c7 100644 --- a/lang/python/python3/files/python3-package-pip.mk +++ b/lang/python/python3/files/python3-package-pip.mk @@ -12,7 +12,7 @@ $(call Package/python3/Default) DEPENDS:=+python3 +python3-setuptools +python-pip-conf endef -define Py3Package/python3-pip/install +define Package/python3-pip/install $(INSTALL_DIR) $(1)/usr/bin $(1)/usr/lib/python$(PYTHON3_VERSION)/site-packages # Adjust shebang to proper python location on target sed "1s/.*/#\!\/usr\/bin\/python$(PYTHON3_VERSION)/" -i $(PKG_BUILD_DIR)/install-pip/bin/*