From 8054747a4932c1bff14d842cbe2e2e8d90b061a7 Mon Sep 17 00:00:00 2001 From: Alexandru Ardelean Date: Tue, 8 Dec 2015 09:45:40 +0200 Subject: [PATCH 1/3] python: remove newline function; it's also in OpenWRT core Signed-off-by: Alexandru Ardelean --- lang/python/Makefile | 6 ------ 1 file changed, 6 deletions(-) diff --git a/lang/python/Makefile b/lang/python/Makefile index d37e04dc2..e930eed8d 100644 --- a/lang/python/Makefile +++ b/lang/python/Makefile @@ -75,12 +75,6 @@ define Package/python-light/description into separate packages. endef -# Define newline here, since it's not defined in OpenWRT -define newline - - -endef - PYTHON_LIB_FILES_DEL:= PYTHON_PACKAGES:= define PyBasePackage From c55641331e892b8bf4a7a8ae4883a85c713704af Mon Sep 17 00:00:00 2001 From: Alexandru Ardelean Date: Fri, 11 Dec 2015 12:01:21 +0200 Subject: [PATCH 2/3] python: unify HostPython and HostHostPython functions That means basically moving the host Python from $(STAGING_DIR_HOST) to $(STAGING_DIR_HOST)/usr and making the PYTHONPATH var as an argument. Signed-off-by: Alexandru Ardelean --- lang/python/Makefile | 10 +++++----- lang/python/files/python-host.mk | 19 ++++++++++++------- lang/python/files/python-package.mk | 17 +++++------------ 3 files changed, 22 insertions(+), 24 deletions(-) diff --git a/lang/python/Makefile b/lang/python/Makefile index e930eed8d..0dee2fdfa 100644 --- a/lang/python/Makefile +++ b/lang/python/Makefile @@ -140,13 +140,13 @@ define Build/InstallDev $(PKG_INSTALL_DIR)/usr/include/python$(PYTHON_VERSION) \ $(1)/usr/include/ $(CP) \ - $(STAGING_DIR_HOST)/lib/python$(PYTHON_VERSION) \ + $(STAGING_DIR_HOST)/usr/lib/python$(PYTHON_VERSION) \ $(PKG_INSTALL_DIR)/usr/lib/libpython$(PYTHON_VERSION).so* \ $(1)/usr/lib/ $(CP) \ - $(STAGING_DIR_HOST)/lib/pkgconfig/python.pc \ - $(STAGING_DIR_HOST)/lib/pkgconfig/python2.pc \ - $(STAGING_DIR_HOST)/lib/pkgconfig/python-$(PYTHON_VERSION).pc \ + $(STAGING_DIR_HOST)/usr/lib/pkgconfig/python.pc \ + $(STAGING_DIR_HOST)/usr/lib/pkgconfig/python2.pc \ + $(STAGING_DIR_HOST)/usr/lib/pkgconfig/python-$(PYTHON_VERSION).pc \ $(1)/usr/lib/pkgconfig $(CP) \ $(PKG_INSTALL_DIR)/usr/lib/python$(PYTHON_VERSION)/config \ @@ -219,8 +219,8 @@ HOST_CONFIGURE_ARGS+= \ --without-cxx-main \ --without-pymalloc \ --with-threads \ + --prefix=$(STAGING_DIR_HOST)/usr \ --with-system-expat=$(STAGING_DIR_HOST) \ - --prefix=$(STAGING_DIR_HOST) \ --with-ensurepip=upgrade \ CONFIG_SITE= \ CFLAGS="$(HOST_CFLAGS)" diff --git a/lang/python/files/python-host.mk b/lang/python/files/python-host.mk index ed0ef4159..d3b795e01 100644 --- a/lang/python/files/python-host.mk +++ b/lang/python/files/python-host.mk @@ -7,11 +7,14 @@ HOST_PYTHON_INC_DIR:=$(STAGING_DIR_HOST)/include/python$(PYTHON_VERSION) -HOST_PYTHON_PKG_DIR:=/lib/python$(PYTHON_VERSION)/site-packages +HOST_PYTHON_PKG_DIR:=/usr/lib/python$(PYTHON_VERSION)/site-packages HOST_PYTHONPATH:=$(HOST_PYTHON_LIB_DIR):$(STAGING_DIR_HOST)/$(HOST_PYTHON_PKG_DIR) -define HostHostPython - ( export PYTHONPATH="$(HOST_PYTHONPATH)"; \ +define HostPython + ifeq ($(3),) + $(3):=$(PYTHONPATH) + endif + ( export PYTHONPATH="$(3)"; \ export PYTHONOPTIMIZE=""; \ export PYTHONDONTWRITEBYTECODE=1; \ export _python_sysroot="$(STAGING_DIR_HOST)"; \ @@ -25,15 +28,15 @@ endef # These configure args are needed in detection of path to Python header files # using autotools. HOST_CONFIGURE_ARGS += \ - _python_sysroot="$(STAGING_DIR_HOST)" \ - _python_prefix="" \ - _python_exec_prefix="" + _python_sysroot="$(STAGING_DIR_HOST)/usr" \ + _python_prefix="/usr" \ + _python_exec_prefix="/usr" # $(1) => build subdir # $(2) => additional arguments to setup.py # $(3) => additional variables define Build/Compile/HostPyMod - $(call HostHostPython, \ + $(call HostPython, \ cd $(HOST_BUILD_DIR)/$(strip $(1)); \ CC="$(HOSTCC)" \ CCSHARED="$(HOSTCC) $(HOST_FPIC)" \ @@ -48,6 +51,8 @@ define Build/Compile/HostPyMod $(3) \ , \ ./setup.py $(2) \ + , \ + $(HOST_PYTHONPATH) \ ) endef diff --git a/lang/python/files/python-package.mk b/lang/python/files/python-package.mk index b4be3a8ee..715134d2d 100644 --- a/lang/python/files/python-package.mk +++ b/lang/python/files/python-package.mk @@ -17,21 +17,10 @@ PYTHON_PKG_DIR:=/usr/lib/python$(PYTHON_VERSION)/site-packages PYTHON:=python$(PYTHON_VERSION) -HOST_PYTHON_LIB_DIR:=$(STAGING_DIR_HOST)/lib/python$(PYTHON_VERSION) +HOST_PYTHON_LIB_DIR:=$(STAGING_DIR_HOST)/usr/lib/python$(PYTHON_VERSION) HOST_PYTHON_BIN:=$(STAGING_DIR_HOST)/bin/python2 PYTHONPATH:=$(PYTHON_LIB_DIR):$(STAGING_DIR)/$(PYTHON_PKG_DIR):$(PKG_INSTALL_DIR)/$(PYTHON_PKG_DIR) -define HostPython - ( export PYTHONPATH="$(PYTHONPATH)"; \ - export PYTHONOPTIMIZE=""; \ - export PYTHONDONTWRITEBYTECODE=1; \ - export _python_sysroot="$(STAGING_DIR)"; \ - export _python_prefix="/usr"; \ - export _python_exec_prefix="/usr"; \ - $(1) \ - $(HOST_PYTHON_BIN) $(2); \ - ) -endef # These configure args are needed in detection of path to Python header files # using autotools. @@ -94,6 +83,8 @@ define PyPackage endef endef +$(call include_mk, python-host.mk) + # $(1) => build subdir # $(2) => additional arguments to setup.py # $(3) => additional variables @@ -114,6 +105,8 @@ define Build/Compile/PyMod $(3) \ , \ ./setup.py $(2) \ + , \ + $(PYTHONPATH) \ ) find $(PKG_INSTALL_DIR) -name "*\.pyc" -o -name "*\.pyo" | xargs rm -f endef From a8602a7ccbde983412b5f0f27961ff2ab9155194 Mon Sep 17 00:00:00 2001 From: Alexandru Ardelean Date: Mon, 7 Dec 2015 16:09:31 +0200 Subject: [PATCH 3/3] python: upgrade to version 2.7.11 And split python-dev and python-lib2to3 packages. Seems for python3 this was done, so we'll sync here. Signed-off-by: Alexandru Ardelean --- lang/python/Makefile | 16 ++++++------ lang/python/files/python-package-dev.mk | 27 +++++++++++++++++++++ lang/python/files/python-package-lib2to3.mk | 18 ++++++++++++++ lang/python/files/python-package.mk | 2 +- 4 files changed, 55 insertions(+), 8 deletions(-) create mode 100644 lang/python/files/python-package-dev.mk create mode 100644 lang/python/files/python-package-lib2to3.mk diff --git a/lang/python/Makefile b/lang/python/Makefile index 0dee2fdfa..d7ce0c774 100644 --- a/lang/python/Makefile +++ b/lang/python/Makefile @@ -12,11 +12,11 @@ include ./files/python-package.mk PKG_NAME:=python PKG_VERSION:=$(PYTHON_VERSION).$(PYTHON_VERSION_MICRO) -PKG_RELEASE:=6 +PKG_RELEASE:=1 PKG_SOURCE:=Python-$(PKG_VERSION).tar.xz -PKG_SOURCE_URL:=http://www.python.org/ftp/python/$(PKG_VERSION) -PKG_MD5SUM:=c685ef0b8e9f27b5e3db5db12b268ac6 +PKG_SOURCE_URL:=https://www.python.org/ftp/python/$(PKG_VERSION) +PKG_MD5SUM:=1dbcc848b4cd8399a8199d000f9f823c 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 @@ -39,7 +39,7 @@ define Package/python/Default SECTION:=lang CATEGORY:=Languages TITLE:=Python $(PYTHON_VERSION) programming language - URL:=http://www.python.org/ + URL:=https://www.python.org/ MAINTAINER:=Alexandru Ardelean endef @@ -77,8 +77,12 @@ endef PYTHON_LIB_FILES_DEL:= PYTHON_PACKAGES:= +PYTHON_PACKAGES_DEPENDS:= define PyBasePackage PYTHON_PACKAGES+=$(1) + ifeq ($(3),) + PYTHON_PACKAGES_DEPENDS+=$(1) + endif PYTHON_LIB_FILES_DEL+=$(2) define PyPackage/$(1)/filespec $(subst $(space),$(newline),$(foreach lib_file,$(2),+|$(lib_file))) @@ -89,7 +93,7 @@ include ./files/python-package-*.mk define Package/python $(call Package/python/Default) - DEPENDS:=+python-light $(foreach package,$(PYTHON_PACKAGES),+$(package)) + DEPENDS:=+python-light $(foreach package,$(PYTHON_PACKAGES_DEPENDS),+$(package)) endef define Package/python/description @@ -184,12 +188,10 @@ endef define PyPackage/python-light/filespec +|/usr/lib/python$(PYTHON_VERSION) --|/usr/lib/python$(PYTHON_VERSION)/config -|/usr/lib/python$(PYTHON_VERSION)/distutils/cygwinccompiler.py -|/usr/lib/python$(PYTHON_VERSION)/distutils/command/wininst* -|/usr/lib/python$(PYTHON_VERSION)/ensurepip -|/usr/lib/python$(PYTHON_VERSION)/idlelib --|/usr/lib/python$(PYTHON_VERSION)/lib2to3 -|/usr/lib/python$(PYTHON_VERSION)/lib-tk -|/usr/lib/python$(PYTHON_VERSION)/lib-dynload/_testcapi.so -|/usr/lib/python$(PYTHON_VERSION)/pdb.doc diff --git a/lang/python/files/python-package-dev.mk b/lang/python/files/python-package-dev.mk new file mode 100644 index 000000000..2f807b283 --- /dev/null +++ b/lang/python/files/python-package-dev.mk @@ -0,0 +1,27 @@ +# +# Copyright (C) 2006-2015 OpenWrt.org +# +# This is free software, licensed under the GNU General Public License v2. +# See /LICENSE for more information. +# + +define Package/python-dev +$(call Package/python/Default) + TITLE:=Python $(PYTHON_VERSION) development files + DEPENDS:=+python +endef + +define PyPackage/python-dev/install + $(INSTALL_DIR) $(1)/usr/bin + $(CP) $(PKG_INSTALL_DIR)/usr/bin/python*config $(1)/usr/bin + $(CP) $(PKG_INSTALL_DIR)/usr/lib/libpython$(PYTHON_VERSION).so* $(1)/usr/lib +endef + +$(eval $(call PyBasePackage,python-dev, \ + /usr/lib/python$(PYTHON_VERSION)/config \ + /usr/include/python$(PYTHON_VERSION) \ + /usr/lib/pkgconfig \ + , \ + DO_NOT_ADD_TO_PACKAGE_DEPENDS \ +)) + diff --git a/lang/python/files/python-package-lib2to3.mk b/lang/python/files/python-package-lib2to3.mk new file mode 100644 index 000000000..5d6942d65 --- /dev/null +++ b/lang/python/files/python-package-lib2to3.mk @@ -0,0 +1,18 @@ +# +# Copyright (C) 2006-2015 OpenWrt.org +# +# This is free software, licensed under the GNU General Public License v2. +# See /LICENSE for more information. +# + +define Package/python-lib2to3 +$(call Package/python/Default) + TITLE:=Python $(PYTHON_VERSION) lib2to3 module + DEPENDS:=+python +endef + +$(eval $(call PyBasePackage,python-lib2to3, \ + /usr/lib/python$(PYTHON_VERSION)/lib2to3 \ + , \ + DO_NOT_ADD_TO_PACKAGE_DEPENDS \ +)) diff --git a/lang/python/files/python-package.mk b/lang/python/files/python-package.mk index 715134d2d..058c232f0 100644 --- a/lang/python/files/python-package.mk +++ b/lang/python/files/python-package.mk @@ -6,7 +6,7 @@ # PYTHON_VERSION:=2.7 -PYTHON_VERSION_MICRO:=10 +PYTHON_VERSION_MICRO:=11 PYTHON_DIR:=$(STAGING_DIR)/usr PYTHON_BIN_DIR:=$(PYTHON_DIR)/bin