From 9d876738b2569aaf25caa7fcef02e4041f12890f Mon Sep 17 00:00:00 2001 From: Alexandru Ardelean Date: Wed, 4 Jan 2017 11:42:34 +0200 Subject: [PATCH 1/5] python: remove argument for `--with-system-ffi` configure arg (based on python3) And apparently `--with-system-ffi` does not take any arguments. But it's only in Python 3.6 that a check was added for that. After checking, Python 2.7 does not take any args either for `--with-system-ffi` ; so, remove it [for the case when this change may get backported]. Signed-off-by: Alexandru Ardelean --- lang/python/Makefile | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lang/python/Makefile b/lang/python/Makefile index 4b677423c..dedf82787 100644 --- a/lang/python/Makefile +++ b/lang/python/Makefile @@ -127,7 +127,7 @@ CONFIGURE_ARGS+= \ --enable-shared \ --without-cxx-main \ --with-threads \ - --with-system-ffi="$(STAGING_DIR)/usr" \ + --with-system-ffi \ --without-pymalloc \ $(ENABLE_IPV6) \ CONFIG_SITE="$(PKG_BUILD_DIR)/config.site" \ @@ -227,7 +227,7 @@ HOST_CONFIGURE_ARGS+= \ --prefix=$(HOST_PYTHON_DIR) \ --exec-prefix=$(HOST_PYTHON_DIR) \ --with-system-expat=$(STAGING_DIR_HOSTPKG) \ - --with-system-ffi=$(STAGING_DIR_HOSTPKG) \ + --with-system-ffi \ CONFIG_SITE= \ CFLAGS="$(HOST_CFLAGS)" From 165cd9f96ab684d30f58e985d2feca59c070d56f Mon Sep 17 00:00:00 2001 From: Alexandru Ardelean Date: Wed, 4 Jan 2017 11:39:00 +0200 Subject: [PATCH 2/5] python: update PYTHON_FOR_BUILD (based on python3) PYTHON_FOR_BUILD is used to build the target python. Nomally Python scripts detect fine the Python host interpreter to use for building the Python target interpreter. But, let's not leave it up to chance anymore. Signed-off-by: Alexandru Ardelean --- lang/python/Makefile | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/lang/python/Makefile b/lang/python/Makefile index dedf82787..c1c8f79af 100644 --- a/lang/python/Makefile +++ b/lang/python/Makefile @@ -122,6 +122,13 @@ ifeq ($(CONFIG_IPV6),y) ENABLE_IPV6 += --enable-ipv6 endif +PYTHON_FOR_BUILD:= \ + _PYTHON_PROJECT_BASE=$(PKG_BUILD_DIR) \ + _PYTHON_HOST_PLATFORM=linux2 \ + PYTHONPATH="$(PKG_BUILD_DIR)/Lib:$(PKG_BUILD_DIR)/build/lib.linux2-$(PYTHON_VERSION)" \ + _PYTHON_SYSCONFIGDATA_NAME=_sysconfigdata \ + $(HOST_PYTHON_BIN) + CONFIGURE_ARGS+= \ --sysconfdir=/etc \ --enable-shared \ @@ -129,6 +136,7 @@ CONFIGURE_ARGS+= \ --with-threads \ --with-system-ffi \ --without-pymalloc \ + PYTHON_FOR_BUILD="$(PYTHON_FOR_BUILD)" \ $(ENABLE_IPV6) \ CONFIG_SITE="$(PKG_BUILD_DIR)/config.site" \ OPT="$(TARGET_CFLAGS)" From bb2f8fa8ed9ea2b4ae8ab0a59ea67c913c8c4d60 Mon Sep 17 00:00:00 2001 From: Alexandru Ardelean Date: Wed, 4 Jan 2017 11:41:48 +0200 Subject: [PATCH 3/5] python-dev: add python-lib2to3 as dependency Signed-off-by: Alexandru Ardelean --- lang/python/files/python-package-dev.mk | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lang/python/files/python-package-dev.mk b/lang/python/files/python-package-dev.mk index 6a2b942f4..647f649f7 100644 --- a/lang/python/files/python-package-dev.mk +++ b/lang/python/files/python-package-dev.mk @@ -8,7 +8,7 @@ define Package/python-dev $(call Package/python/Default) TITLE:=Python $(PYTHON_VERSION) development files - DEPENDS:=+python + DEPENDS:=+python +python-lib2to3 endef define PyPackage/python-dev/install From 6d9137048bb8494dd306b54b34134c8302a2cd56 Mon Sep 17 00:00:00 2001 From: Alexandru Ardelean Date: Wed, 4 Jan 2017 11:25:47 +0200 Subject: [PATCH 4/5] python: simplify/unify default build rules for python packages Most python packages use the same build rules & vars. So, adding them in python-package.mk. Also, preparing for using VARIANTs for python/python3 packages. Signed-off-by: Alexandru Ardelean --- lang/python/files/python-host.mk | 16 +++++++++++++ lang/python/files/python-package.mk | 35 ++++++++++++++++------------- 2 files changed, 35 insertions(+), 16 deletions(-) diff --git a/lang/python/files/python-host.mk b/lang/python/files/python-host.mk index dc0c0c049..7833a0c73 100644 --- a/lang/python/files/python-host.mk +++ b/lang/python/files/python-host.mk @@ -77,4 +77,20 @@ define Build/Compile/HostPyMod $(3)) endef +define HostPy/Compile/Default + $(call Build/Compile/HostPyMod,,\ + install --root="$(HOST_BUILD_PREFIX)" --prefix="" \ + --single-version-externally-managed \ + ) +endef + +ifeq ($(BUILD_VARIANT),python) +define Host/Compile + $(call HostPy/Compile/Default) +endef + +define Host/Install +endef +endif # python + endif # __python_host_mk_inc diff --git a/lang/python/files/python-package.mk b/lang/python/files/python-package.mk index 2a2e371c3..d0818a64c 100644 --- a/lang/python/files/python-package.mk +++ b/lang/python/files/python-package.mk @@ -41,6 +41,15 @@ define PyPackage endef endif + ifndef PyPackage/$(1)/install + define PyPackage/$(1)/install + if [ -d $(PKG_INSTALL_DIR)/usr/bin ]; then \ + $(INSTALL_DIR) $$(1)/usr/bin \ + $(CP) $(PKG_INSTALL_DIR)/usr/bin/* $$(1)/usr/bin/ + fi + endef + endif + $(call shexport,PyPackage/$(1)/filespec) define Package/$(1)/install @@ -115,21 +124,15 @@ define Build/Compile/PyMod find $(PKG_INSTALL_DIR) -name "*\.pyc" -o -name "*\.pyo" -o -name "*\.exe" | xargs rm -f endef -define PyMod/Default - define Build/Compile - $$(call Build/Compile/PyMod,,install --prefix=/usr --root=$(PKG_INSTALL_DIR)) - endef - - define Package/$(PKG_NAME)/install - $(INSTALL_DIR) $$(1)$(PYTHON_PKG_DIR) $$(1)/usr/bin - if [ -d $(PKG_INSTALL_DIR)/usr/bin ]; then find $(PKG_INSTALL_DIR)/usr/bin -mindepth 1 -maxdepth 1 -type f -exec $(CP) \{\} $$(1)/usr/bin/ \; ; fi - find $(PKG_INSTALL_DIR)$(PYTHON_PKG_DIR) -mindepth 1 -maxdepth 1 \( -type f -o -type d \) -exec $(CP) \{\} $$(1)$(PYTHON_PKG_DIR)/ \; - endef - - define Build/InstallDev - $(INSTALL_DIR) $$(1)/usr/bin $$(1)$(PYTHON_PKG_DIR) - if [ -d $(PKG_INSTALL_DIR)/usr/bin ]; then find $(PKG_INSTALL_DIR)/usr/bin -mindepth 1 -maxdepth 1 -type f -exec $(CP) \{\} $$(1)/usr/bin/ \; ; fi - find $(PKG_INSTALL_DIR)$(PYTHON_PKG_DIR) -mindepth 1 -maxdepth 1 \( -type f -o -type d \) -exec $(CP) \{\} $$(1)$(PYTHON_PKG_DIR)/ \; - endef +define PyBuild/Compile/Default + $(call Build/Compile/PyMod,, \ + install --prefix="/usr" --root="$(PKG_INSTALL_DIR)" \ + --single-version-externally-managed \ + ) endef +ifeq ($(BUILD_VARIANT),python) +define Build/Compile + $(call PyBuild/Compile/Default) +endef +endif # python From f04641d3d190f58be5aececbcf1335d3077e8111 Mon Sep 17 00:00:00 2001 From: Alexandru Ardelean Date: Wed, 4 Jan 2017 14:03:31 +0200 Subject: [PATCH 5/5] python: upgrade to version 2.7.13 Signed-off-by: Alexandru Ardelean --- lang/python/Makefile | 5 +++-- lang/python/files/python-version.mk | 2 +- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/lang/python/Makefile b/lang/python/Makefile index c1c8f79af..b803b8c65 100644 --- a/lang/python/Makefile +++ b/lang/python/Makefile @@ -12,11 +12,12 @@ include ./files/python-version.mk PKG_NAME:=python PKG_VERSION:=$(PYTHON_VERSION).$(PYTHON_VERSION_MICRO) -PKG_RELEASE:=2 +PKG_RELEASE:=1 PKG_SOURCE:=Python-$(PKG_VERSION).tar.xz PKG_SOURCE_URL:=https://www.python.org/ftp/python/$(PKG_VERSION) -PKG_MD5SUM:=57dffcee9cee8bb2ab5f82af1d8e9a69 +PKG_MD5SUM:=53b43534153bb2a0363f08bae8b9d990 +PKG_HASH:=35d543986882f78261f97787fd3e06274bfa6df29fac9b4a94f73930ff98f731 PKG_LICENSE:=PSF PKG_LICENSE_FILES:=LICENSE Modules/_ctypes/libffi_msvc/LICENSE Modules/_ctypes/darwin/LICENSE Modules/_ctypes/libffi/LICENSE Modules/_ctypes/libffi_osx/LICENSE Tools/pybench/LICENSE diff --git a/lang/python/files/python-version.mk b/lang/python/files/python-version.mk index 6905c3d68..847eaf5c7 100644 --- a/lang/python/files/python-version.mk +++ b/lang/python/files/python-version.mk @@ -6,5 +6,5 @@ # PYTHON_VERSION:=2.7 -PYTHON_VERSION_MICRO:=12 +PYTHON_VERSION_MICRO:=13