From ed8fa163c08de237ab6cbb66ebf8e8ff89dbf785 Mon Sep 17 00:00:00 2001 From: Alexandru Ardelean Date: Fri, 6 Jan 2017 17:05:27 +0200 Subject: [PATCH 1/4] python3: sync changes from python Signed-off-by: Alexandru Ardelean --- lang/python3/Makefile | 18 +++++------ lang/python3/files/python3-host.mk | 9 ------ .../005-fix-libffi-x86-64-configure.patch | 31 ------------------- .../patches/011-do-not-prefer-ncursesw.patch | 15 --------- 4 files changed, 8 insertions(+), 65 deletions(-) delete mode 100644 lang/python3/patches/005-fix-libffi-x86-64-configure.patch delete mode 100644 lang/python3/patches/011-do-not-prefer-ncursesw.patch diff --git a/lang/python3/Makefile b/lang/python3/Makefile index aa758b563..81e6679f8 100644 --- a/lang/python3/Makefile +++ b/lang/python3/Makefile @@ -14,7 +14,7 @@ PYTHON_VERSION:=$(PYTHON3_VERSION) PYTHON_VERSION_MICRO:=$(PYTHON3_VERSION_MICRO) PKG_NAME:=python3 -PKG_RELEASE:=1 +PKG_RELEASE:=3 PKG_VERSION:=$(PYTHON_VERSION).$(PYTHON_VERSION_MICRO) PKG_SOURCE:=Python-$(PKG_VERSION).tar.xz @@ -117,10 +117,6 @@ MAKE_FLAGS+=\ LD="$(TARGET_CC)" \ PGEN=pgen3 -ifeq ($(ARCH),i386) -MAKE_FLAGS+=PYTHON_DECIMAL_WITH_MACHINE=ansi32 -endif - EXTRA_CFLAGS+= \ -DNDEBUG -fno-inline EXTRA_LDFLAGS+= \ @@ -231,6 +227,9 @@ define Py3Package/python3/filespec -|$(PYTHON3_PKG_DIR) endef +HOST_LDFLAGS += \ + $$$$(pkg-config --static --libs libcrypto libssl) + HOST_CONFIGURE_ARGS+= \ --without-cxx-main \ --without-pymalloc \ @@ -238,14 +237,13 @@ HOST_CONFIGURE_ARGS+= \ --prefix=$(HOST_PYTHON3_DIR) \ --exec-prefix=$(HOST_PYTHON3_DIR) \ --with-system-expat=$(STAGING_DIR_HOSTPKG) \ - --with-system-ffi \ + --with-system-ffi=no \ --with-ensurepip=no \ - CONFIG_SITE= \ - CFLAGS="$(HOST_CFLAGS)" + CONFIG_SITE= define Host/Compile - +$(MAKE) $(HOST_JOBS) -C $(HOST_BUILD_DIR) python Parser/pgen - +$(MAKE) $(HOST_JOBS) -C $(HOST_BUILD_DIR) sharedmods + +$(HOST_MAKE_VARS) $(MAKE) $(HOST_JOBS) -C $(HOST_BUILD_DIR) python Parser/pgen + +$(HOST_MAKE_VARS) $(MAKE) $(HOST_JOBS) -C $(HOST_BUILD_DIR) sharedmods endef define Host/Install diff --git a/lang/python3/files/python3-host.mk b/lang/python3/files/python3-host.mk index 8ff6dd789..3abf6aa5f 100644 --- a/lang/python3/files/python3-host.mk +++ b/lang/python3/files/python3-host.mk @@ -78,13 +78,4 @@ define HostPy3/Compile/Default ) endef -ifeq ($(BUILD_VARIANT),python3) -define Host/Compile - $(call HostPy3/Compile/Default) -endef - -define Host/Install -endef -endif # python3 - endif # __python3_host_mk_inc diff --git a/lang/python3/patches/005-fix-libffi-x86-64-configure.patch b/lang/python3/patches/005-fix-libffi-x86-64-configure.patch deleted file mode 100644 index ea062a350..000000000 --- a/lang/python3/patches/005-fix-libffi-x86-64-configure.patch +++ /dev/null @@ -1,31 +0,0 @@ -diff --git a/Modules/_ctypes/libffi/configure b/Modules/_ctypes/libffi/configure -index 75f62a7..4d6c9f2 100755 ---- a/Modules/_ctypes/libffi/configure -+++ b/Modules/_ctypes/libffi/configure -@@ -17257,20 +17257,12 @@ case "$host" in - fi - ;; - -- i?86-*-* | x86_64-*-*) -- TARGETDIR=x86 -- if test $ac_cv_sizeof_size_t = 4; then -- case "$host" in -- *-gnux32) -- TARGET=X86_64 -- ;; -- *) -- TARGET=X86 -- ;; -- esac -- else -- TARGET=X86_64; -- fi -+ i?86-*-*) -+ TARGET=X86; TARGETDIR=x86 -+ ;; -+ -+ x86_64-*-*) -+ TARGET=X86_64; TARGETDIR=x86 - ;; - - ia64*-*-*) diff --git a/lang/python3/patches/011-do-not-prefer-ncursesw.patch b/lang/python3/patches/011-do-not-prefer-ncursesw.patch deleted file mode 100644 index c02322534..000000000 --- a/lang/python3/patches/011-do-not-prefer-ncursesw.patch +++ /dev/null @@ -1,15 +0,0 @@ -diff --git a/setup.py b/setup.py -index 2779658..b6d3d61 100644 ---- a/setup.py -+++ b/setup.py -@@ -693,8 +693,8 @@ class PyBuildExt(build_ext): - # use the same library for the readline and curses modules. - if 'curses' in readline_termcap_library: - curses_library = readline_termcap_library -- elif self.compiler.find_library_file(lib_dirs, 'ncursesw'): -- curses_library = 'ncursesw' -+ #elif self.compiler.find_library_file(lib_dirs, 'ncursesw'): -+ # curses_library = 'ncursesw' - elif self.compiler.find_library_file(lib_dirs, 'ncurses'): - curses_library = 'ncurses' - elif self.compiler.find_library_file(lib_dirs, 'curses'): From 80349f9e73f7c11785fa5e5d9ebd0185066c644b Mon Sep 17 00:00:00 2001 From: Alexandru Ardelean Date: Thu, 19 Jan 2017 18:20:15 +0200 Subject: [PATCH 2/4] python,python3: install built-in pip and setuptools Easier than using external package. Signed-off-by: Alexandru Ardelean --- lang/python-pip/Makefile | 18 ------------------ lang/python-setuptools/Makefile | 19 ------------------- lang/python/Makefile | 1 + lang/python3/Makefile | 2 +- 4 files changed, 2 insertions(+), 38 deletions(-) diff --git a/lang/python-pip/Makefile b/lang/python-pip/Makefile index 2099e63a9..b20177887 100644 --- a/lang/python-pip/Makefile +++ b/lang/python-pip/Makefile @@ -17,16 +17,10 @@ PKG_MD5SUM:=87083c0b9867963b29f7aba3613e8f4a PKG_BUILD_DIR:=$(BUILD_DIR)/python-pip-$(PKG_VERSION) PKG_UNPACK=$(HOST_TAR) -C $(PKG_BUILD_DIR) --strip-components=1 -xzf $(DL_DIR)/$(PKG_SOURCE) -HOST_BUILD_DIR:=$(BUILD_DIR_HOST)/python-pip-$(PKG_VERSION) -HOST_UNPACK=$(HOST_TAR) -C $(HOST_BUILD_DIR) --strip-components=1 -xzf $(DL_DIR)/$(PKG_SOURCE) PKG_USE_MIPS16:=0 -HOST_BUILD_DEPENDS:=python python/host python-setuptools/host - -include $(INCLUDE_DIR)/host-build.mk include $(INCLUDE_DIR)/package.mk $(call include_mk, python-package.mk) -$(call include_mk, python-host.mk) define Package/python-pip SUBMENU:=Python @@ -60,17 +54,5 @@ define PyPackage/python-pip/install $(INSTALL_CONF) ./files/pip.conf $(1)/etc/ endef -define Host/Compile - $(call Build/Compile/HostPyMod,,\ - install --root="$(STAGING_DIR_HOSTPKG)" --prefix="" \ - --single-version-externally-managed \ - ) -endef - -define Host/Install -endef - -$(eval $(call HostBuild)) - $(eval $(call PyPackage,python-pip)) $(eval $(call BuildPackage,python-pip)) diff --git a/lang/python-setuptools/Makefile b/lang/python-setuptools/Makefile index 1f312229f..8a714514d 100644 --- a/lang/python-setuptools/Makefile +++ b/lang/python-setuptools/Makefile @@ -15,18 +15,11 @@ PKG_SOURCE:=setuptools-$(PKG_VERSION).tar.gz PKG_SOURCE_URL:=https://pypi.python.org/packages/87/ba/54197971d107bc06f5f3fbdc0d728a7ae0b10cafca46acfddba65a0899d8/ PKG_MD5SUM:=b39715612fdc0372dbfd7b3fcf5d4fe5 -HOST_BUILD_DEPENDS:=python python/host - PKG_BUILD_DIR:=$(BUILD_DIR)/$(PKG_NAME)-$(PKG_VERSION) PKG_UNPACK=$(HOST_TAR) -C $(PKG_BUILD_DIR) --strip-components=1 -xzf $(DL_DIR)/$(PKG_SOURCE) -HOST_BUILD_DIR:=$(BUILD_DIR_HOST)/$(PKG_NAME)-$(PKG_VERSION) -HOST_UNPACK=$(HOST_TAR) -C $(HOST_BUILD_DIR) --strip-components=1 -xzf $(DL_DIR)/$(PKG_SOURCE) - -include $(INCLUDE_DIR)/host-build.mk include $(INCLUDE_DIR)/package.mk $(call include_mk, python-package.mk) -$(call include_mk, python-host.mk) define Package/python-setuptools SUBMENU:=Python @@ -61,18 +54,6 @@ define PyPackage/python-setuptools/install $(CP) $(PKG_INSTALL_DIR)/usr/bin/* $(1)/usr/bin/ endef -define Host/Compile - $(call Build/Compile/HostPyMod,,\ - install --root="$(STAGING_DIR_HOSTPKG)" --prefix="" \ - --single-version-externally-managed \ - ) -endef - -define Host/Install -endef - -$(eval $(call HostBuild)) - $(eval $(call PyPackage,python-setuptools)) $(eval $(call BuildPackage,python-setuptools)) diff --git a/lang/python/Makefile b/lang/python/Makefile index 6307dc3a5..c3f26800a 100644 --- a/lang/python/Makefile +++ b/lang/python/Makefile @@ -240,6 +240,7 @@ HOST_CONFIGURE_ARGS+= \ --exec-prefix=$(HOST_PYTHON_DIR) \ --with-system-expat=$(STAGING_DIR_HOSTPKG) \ --with-system-ffi=no \ + --with-ensurepip=install \ CONFIG_SITE= define Host/Install diff --git a/lang/python3/Makefile b/lang/python3/Makefile index 81e6679f8..2899b86c1 100644 --- a/lang/python3/Makefile +++ b/lang/python3/Makefile @@ -238,7 +238,7 @@ HOST_CONFIGURE_ARGS+= \ --exec-prefix=$(HOST_PYTHON3_DIR) \ --with-system-expat=$(STAGING_DIR_HOSTPKG) \ --with-system-ffi=no \ - --with-ensurepip=no \ + --with-ensurepip=install \ CONFIG_SITE= define Host/Compile From a53d0c5a403d1669e2cf6c59c2be6a9d3ed633a0 Mon Sep 17 00:00:00 2001 From: Alexandru Ardelean Date: Thu, 19 Jan 2017 18:25:19 +0200 Subject: [PATCH 3/4] pip,setuptools: move as part of python,python3 build Signed-off-by: Alexandru Ardelean --- lang/python-pip/Makefile | 58 --------------- lang/python-pip/files/pip.conf | 3 - lang/python-setuptools/Makefile | 59 ---------------- .../patches/0001-remove-windows-support.patch | 20 ------ .../0002-fix-pyvenv-environment-get.patch | 13 ---- lang/python/Makefile | 32 ++++++++- lang/python/files/python-package-pip.mk | 27 +++++++ .../python/files/python-package-setuptools.mk | 29 ++++++++ lang/python3-pip/Makefile | 61 ---------------- .../0001-remove-self-version-checking.patch | 70 ------------------- lang/python3-setuptools/Makefile | 61 ---------------- .../patches/0001-remove-windows-support.patch | 20 ------ .../0002-fix-pyvenv-environment-get.patch | 13 ---- lang/python3/Makefile | 33 ++++++++- lang/python3/files/python3-package-pip.mk | 27 +++++++ .../files/python3-package-setuptools.mk | 30 ++++++++ 16 files changed, 173 insertions(+), 383 deletions(-) delete mode 100644 lang/python-pip/Makefile delete mode 100644 lang/python-pip/files/pip.conf delete mode 100644 lang/python-setuptools/Makefile delete mode 100644 lang/python-setuptools/patches/0001-remove-windows-support.patch delete mode 100644 lang/python-setuptools/patches/0002-fix-pyvenv-environment-get.patch create mode 100644 lang/python/files/python-package-pip.mk create mode 100644 lang/python/files/python-package-setuptools.mk delete mode 100644 lang/python3-pip/Makefile delete mode 100644 lang/python3-pip/patches/0001-remove-self-version-checking.patch delete mode 100644 lang/python3-setuptools/Makefile delete mode 100644 lang/python3-setuptools/patches/0001-remove-windows-support.patch delete mode 100644 lang/python3-setuptools/patches/0002-fix-pyvenv-environment-get.patch create mode 100644 lang/python3/files/python3-package-pip.mk create mode 100644 lang/python3/files/python3-package-setuptools.mk diff --git a/lang/python-pip/Makefile b/lang/python-pip/Makefile deleted file mode 100644 index b20177887..000000000 --- a/lang/python-pip/Makefile +++ /dev/null @@ -1,58 +0,0 @@ -# -# Copyright (C) 2014 OpenWrt.org -# -# This is free software, licensed under the GNU General Public License v2. -# See /LICENSE for more information. -# - -include $(TOPDIR)/rules.mk - -PKG_NAME:=python-pip -PKG_VERSION:=8.1.2 -PKG_RELEASE:=1 - -PKG_SOURCE:=pip-$(PKG_VERSION).tar.gz -PKG_SOURCE_URL:=https://pypi.python.org/packages/e7/a8/7556133689add8d1a54c0b14aeff0acb03c64707ce100ecd53934da1aa13/ -PKG_MD5SUM:=87083c0b9867963b29f7aba3613e8f4a - -PKG_BUILD_DIR:=$(BUILD_DIR)/python-pip-$(PKG_VERSION) -PKG_UNPACK=$(HOST_TAR) -C $(PKG_BUILD_DIR) --strip-components=1 -xzf $(DL_DIR)/$(PKG_SOURCE) -PKG_USE_MIPS16:=0 - -include $(INCLUDE_DIR)/package.mk -$(call include_mk, python-package.mk) - -define Package/python-pip - SUBMENU:=Python - SECTION:=lang - CATEGORY:=Languages - TITLE:=Tool for installing Python packages. - URL:=https://pip.pypa.io - DEPENDS:=+python +python-setuptools +ca-certificates - MAINTAINER:=Alexandru Ardelean -endef - -define Package/python-pip/description - A tool for installing and managing Python packages. -endef - -define Build/Compile - $(call Build/Compile/PyMod,,\ - install --root="$(PKG_INSTALL_DIR)" --prefix="/usr" \ - --single-version-externally-managed \ - ) -endef - -define PyPackage/python-pip/filespec -+|$(PYTHON_PKG_DIR) --|$(PYTHON_PKG_DIR)/pip/_vendor/distlib/*.exe -endef - -define PyPackage/python-pip/install - $(INSTALL_DIR) $(1)/usr/bin $(1)/etc - $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/bin/* $(1)/usr/bin - $(INSTALL_CONF) ./files/pip.conf $(1)/etc/ -endef - -$(eval $(call PyPackage,python-pip)) -$(eval $(call BuildPackage,python-pip)) diff --git a/lang/python-pip/files/pip.conf b/lang/python-pip/files/pip.conf deleted file mode 100644 index 89339e98a..000000000 --- a/lang/python-pip/files/pip.conf +++ /dev/null @@ -1,3 +0,0 @@ -[global] -cache-dir=/tmp/.cache -log-file=/tmp/pip-log.txt diff --git a/lang/python-setuptools/Makefile b/lang/python-setuptools/Makefile deleted file mode 100644 index 8a714514d..000000000 --- a/lang/python-setuptools/Makefile +++ /dev/null @@ -1,59 +0,0 @@ -# -# Copyright (C) 2014-2016 OpenWrt.org -# -# This is free software, licensed under the GNU General Public License v2. -# See /LICENSE for more information. -# - -include $(TOPDIR)/rules.mk - -PKG_NAME:=python-setuptools -PKG_VERSION:=27.2.0 -PKG_RELEASE:=1 - -PKG_SOURCE:=setuptools-$(PKG_VERSION).tar.gz -PKG_SOURCE_URL:=https://pypi.python.org/packages/87/ba/54197971d107bc06f5f3fbdc0d728a7ae0b10cafca46acfddba65a0899d8/ -PKG_MD5SUM:=b39715612fdc0372dbfd7b3fcf5d4fe5 - -PKG_BUILD_DIR:=$(BUILD_DIR)/$(PKG_NAME)-$(PKG_VERSION) -PKG_UNPACK=$(HOST_TAR) -C $(PKG_BUILD_DIR) --strip-components=1 -xzf $(DL_DIR)/$(PKG_SOURCE) - -include $(INCLUDE_DIR)/package.mk -$(call include_mk, python-package.mk) - -define Package/python-setuptools - SUBMENU:=Python - SECTION:=lang - CATEGORY:=Languages - TITLE:=Tool for installing Python packages. - URL:=https://bitbucket.org/pypa/setuptools - DEPENDS:=+python +ca-certificates - MAINTAINER:=Alexandru Ardelean -endef - -define Package/python-setuptools/description - Easily download, build, install, upgrade, and uninstall Python packages -endef - -define Build/Compile - $(call Build/Compile/PyMod,,\ - install --root="$(PKG_INSTALL_DIR)" --prefix="/usr" \ - --single-version-externally-managed \ - ) -endef - -define Build/InstallDev - $(INSTALL_DIR) $(PYTHON_LIB_DIR) - $(CP) \ - $(PKG_INSTALL_DIR)$(PYTHON_PKG_DIR)/* \ - $(PYTHON_LIB_DIR) -endef - -define PyPackage/python-setuptools/install - $(INSTALL_DIR) $(1)/usr/bin - $(CP) $(PKG_INSTALL_DIR)/usr/bin/* $(1)/usr/bin/ -endef - -$(eval $(call PyPackage,python-setuptools)) -$(eval $(call BuildPackage,python-setuptools)) - diff --git a/lang/python-setuptools/patches/0001-remove-windows-support.patch b/lang/python-setuptools/patches/0001-remove-windows-support.patch deleted file mode 100644 index 86e5bba05..000000000 --- a/lang/python-setuptools/patches/0001-remove-windows-support.patch +++ /dev/null @@ -1,20 +0,0 @@ -diff --git a/setuptools/dist.py b/setuptools/dist.py -index b004f92..66b9d89 100644 ---- a/setuptools/dist.py -+++ b/setuptools/dist.py -@@ -17,7 +17,6 @@ from setuptools.extern.six.moves import map - from pkg_resources.extern import packaging - - from setuptools.depends import Require --from setuptools import windows_support - from setuptools.monkey import get_unpatched - import pkg_resources - -@@ -383,7 +382,6 @@ class Distribution(_Distribution): - egg_cache_dir = os.path.join(os.curdir, '.eggs') - if not os.path.exists(egg_cache_dir): - os.mkdir(egg_cache_dir) -- windows_support.hide_file(egg_cache_dir) - readme_txt_filename = os.path.join(egg_cache_dir, 'README.txt') - with open(readme_txt_filename, 'w') as f: - f.write('This directory contains eggs that were downloaded ' diff --git a/lang/python-setuptools/patches/0002-fix-pyvenv-environment-get.patch b/lang/python-setuptools/patches/0002-fix-pyvenv-environment-get.patch deleted file mode 100644 index d96ab089c..000000000 --- a/lang/python-setuptools/patches/0002-fix-pyvenv-environment-get.patch +++ /dev/null @@ -1,13 +0,0 @@ -diff --git a/setuptools/command/easy_install.py b/setuptools/command/easy_install.py -index e8b90c7..8598c44 100755 ---- a/setuptools/command/easy_install.py -+++ b/setuptools/command/easy_install.py -@@ -1946,6 +1946,8 @@ class CommandSpec(list): - Construct a CommandSpec from a parameter to build_scripts, which may - be None. - """ -+ if os.environ.get('__PYVENV_LAUNCHER__'): -+ return cls.from_environment() - if isinstance(param, cls): - return param - if isinstance(param, list): diff --git a/lang/python/Makefile b/lang/python/Makefile index c3f26800a..f12e0361b 100644 --- a/lang/python/Makefile +++ b/lang/python/Makefile @@ -12,7 +12,7 @@ include ./files/python-version.mk PKG_NAME:=python PKG_VERSION:=$(PYTHON_VERSION).$(PYTHON_VERSION_MICRO) -PKG_RELEASE:=3 +PKG_RELEASE:=4 PKG_SOURCE:=Python-$(PKG_VERSION).tar.xz PKG_SOURCE_URL:=https://www.python.org/ftp/python/$(PKG_VERSION) @@ -92,7 +92,9 @@ define PyBasePackage endif PYTHON_LIB_FILES_DEL+=$(2) define PyPackage/$(1)/filespec - $(subst $(space),$(newline),$(foreach lib_file,$(2),+|$(lib_file))) + ifneq ($(2),) + $(subst $(space),$(newline),$(foreach lib_file,$(2),+|$(lib_file))) + endif endef endef @@ -136,6 +138,7 @@ CONFIGURE_ARGS+= \ --without-cxx-main \ --with-threads \ --with-system-ffi \ + --with-ensurepip=no \ --without-pymalloc \ PYTHON_FOR_BUILD="$(PYTHON_FOR_BUILD)" \ $(ENABLE_IPV6) \ @@ -147,6 +150,31 @@ define Build/Prepare $(CP) ./files/config.site $(PKG_BUILD_DIR)/config.site endef +ifdef CONFIG_PACKAGE_python-setuptools +define Build/Compile/python-setuptools + $(STAGING_DIR_HOSTPKG)/bin/pip install \ + --ignore-installed \ + --root=$(PKG_BUILD_DIR)/install-setuptools --prefix=. \ + $(PKG_BUILD_DIR)/Lib/ensurepip/_bundled/setuptools-*.whl +endef +endif # CONFIG_PACKAGE_python-setuptools + +ifdef CONFIG_PACKAGE_python-pip +define Build/Compile/python-pip + $(STAGING_DIR_HOSTPKG)/bin/pip install \ + --ignore-installed \ + --root=$(PKG_BUILD_DIR)/install-pip --prefix=. \ + $(PKG_BUILD_DIR)/Lib/ensurepip/_bundled/pip-*.whl +endef +endif # CONFIG_PACKAGE_python-pip + +define Build/Compile + $(call Build/Compile/Default) + # Use host pip to install python-setuptools + $(call Build/Compile/python-setuptools) + $(call Build/Compile/python-pip) +endef + define Build/InstallDev $(INSTALL_DIR) $(STAGING_DIR)/mk/ $(INSTALL_DIR) $(1)/usr/include/ $(1)/usr/lib/ $(1)/usr/lib/pkgconfig diff --git a/lang/python/files/python-package-pip.mk b/lang/python/files/python-package-pip.mk new file mode 100644 index 000000000..66bd6553f --- /dev/null +++ b/lang/python/files/python-package-pip.mk @@ -0,0 +1,27 @@ +# +# Copyright (C) 2017 OpenWrt.org +# +# This is free software, licensed under the GNU General Public License v2. +# See /LICENSE for more information. +# + +define Package/python-pip +$(call Package/python/Default) + TITLE:=Python $(PYTHON_VERSION) pip module + DEPENDS:=+python +python-setuptools +endef + +define PyPackage/python-pip/install + $(INSTALL_DIR) $(1)/usr/bin $(1)/usr/lib/python$(PYTHON_VERSION)/site-packages + # Adjust shebang to proper python location on target + sed "1s/.*/#\!\/usr\/bin\/python$(PYTHON_VERSION)/" -i $(PKG_BUILD_DIR)/install-pip/bin/* + $(CP) $(PKG_BUILD_DIR)/install-pip/bin/* $(1)/usr/bin + $(CP) \ + $(PKG_BUILD_DIR)/install-pip/lib/python$(PYTHON_VERSION)/site-packages/pip \ + $(1)/usr/lib/python$(PYTHON_VERSION)/site-packages/ +endef + +$(eval $(call PyBasePackage,python-pip, \ + , \ + DO_NOT_ADD_TO_PACKAGE_DEPENDS \ +)) diff --git a/lang/python/files/python-package-setuptools.mk b/lang/python/files/python-package-setuptools.mk new file mode 100644 index 000000000..7025ebbc0 --- /dev/null +++ b/lang/python/files/python-package-setuptools.mk @@ -0,0 +1,29 @@ +# +# Copyright (C) 2017 OpenWrt.org +# +# This is free software, licensed under the GNU General Public License v2. +# See /LICENSE for more information. +# + +define Package/python-setuptools +$(call Package/python/Default) + TITLE:=Python $(PYTHON_VERSION) setuptools module + DEPENDS:=+python +endef + +define PyPackage/python-setuptools/install + $(INSTALL_DIR) $(1)/usr/bin $(1)/usr/lib/python$(PYTHON_VERSION)/site-packages + # Adjust shebang to proper python location on target + sed "1s/.*/#\!\/usr\/bin\/python$(PYTHON_VERSION)/" -i $(PKG_BUILD_DIR)/install-setuptools/bin/* + $(CP) $(PKG_BUILD_DIR)/install-setuptools/bin/* $(1)/usr/bin + $(CP) \ + $(PKG_BUILD_DIR)/install-setuptools/lib/python$(PYTHON_VERSION)/site-packages/pkg_resources \ + $(PKG_BUILD_DIR)/install-setuptools/lib/python$(PYTHON_VERSION)/site-packages/setuptools \ + $(PKG_BUILD_DIR)/install-setuptools/lib/python$(PYTHON_VERSION)/site-packages/easy_install.py \ + $(1)/usr/lib/python$(PYTHON_VERSION)/site-packages +endef + +$(eval $(call PyBasePackage,python-setuptools, \ + , \ + DO_NOT_ADD_TO_PACKAGE_DEPENDS \ +)) diff --git a/lang/python3-pip/Makefile b/lang/python3-pip/Makefile deleted file mode 100644 index b7680b933..000000000 --- a/lang/python3-pip/Makefile +++ /dev/null @@ -1,61 +0,0 @@ -# -# Copyright (C) 2014-2015 OpenWrt.org -# -# This is free software, licensed under the GNU General Public License v2. -# See /LICENSE for more information. -# - -include $(TOPDIR)/rules.mk - -PKG_NAME:=python3-pip -PKG_VERSION:=8.1.2 -PKG_RELEASE:=1 - -PKG_SOURCE:=pip-$(PKG_VERSION).tar.gz -PKG_SOURCE_URL:=https://pypi.python.org/packages/e7/a8/7556133689add8d1a54c0b14aeff0acb03c64707ce100ecd53934da1aa13/ -PKG_MD5SUM:=87083c0b9867963b29f7aba3613e8f4a - -PKG_LICENSE:=MIT - -PKG_BUILD_DIR:=$(BUILD_DIR)/python3-pip-$(PKG_VERSION) -PKG_UNPACK=$(HOST_TAR) -C $(PKG_BUILD_DIR) --strip-components=1 -xzf $(DL_DIR)/$(PKG_SOURCE) -PKG_USE_MIPS16:=0 - -include $(INCLUDE_DIR)/package.mk -$(call include_mk, python3-package.mk) - -define Package/python3-pip - SUBMENU:=Python - SECTION:=lang - CATEGORY:=Languages - TITLE:=Tool for installing Python $(PYTHON3_VERSION) packages. - URL:=https://pip.pypa.io - DEPENDS:=+python3 +python3-dev +python3-lib2to3 +python3-setuptools - MAINTAINER:=Alexandru Ardelean -endef - -define Package/python3-pip/description - A tool for installing and managing Python $(PYTHON3_VERSION) packages. -endef - -define Build/Compile - $(call Build/Compile/Py3Mod,,\ - install --root="$(PKG_INSTALL_DIR)" --prefix="/usr" \ - --single-version-externally-managed \ - ) -endef - -define Py3Package/python3-pip/filespec -+|$(PYTHON3_PKG_DIR) --|$(PYTHON3_PKG_DIR)/_vendor/distlib/*.exe --|$(PYTHON3_PKG_DIR)/utils/outdated.py -endef - -define Py3Package/python3-pip/install - $(INSTALL_DIR) $(1)/usr/bin - $(CP) $(PKG_INSTALL_DIR)/usr/bin/pip$(PYTHON3_VERSION) $(1)/usr/bin - $(LN) pip$(PYTHON3_VERSION) $(1)/usr/bin/pip3 -endef - -$(eval $(call Py3Package,python3-pip)) -$(eval $(call BuildPackage,python3-pip)) diff --git a/lang/python3-pip/patches/0001-remove-self-version-checking.patch b/lang/python3-pip/patches/0001-remove-self-version-checking.patch deleted file mode 100644 index b8c0bb647..000000000 --- a/lang/python3-pip/patches/0001-remove-self-version-checking.patch +++ /dev/null @@ -1,70 +0,0 @@ -From 771a1407b15538697a7f38209e40dbbf58828d33 Mon Sep 17 00:00:00 2001 -From: Florian Fieber -Date: Tue, 9 Jun 2015 15:59:04 +0200 -Subject: [PATCH] Remove self version checking - -Signed-off-by: Florian Fieber ---- - pip/basecommand.py | 10 ---------- - pip/cmdoptions.py | 10 ---------- - 2 files changed, 20 deletions(-) - -diff --git a/pip/basecommand.py b/pip/basecommand.py -index 854d113..c2337a4 100644 ---- a/pip/basecommand.py -+++ b/pip/basecommand.py -@@ -22,7 +22,6 @@ from pip.status_codes import ( - from pip.utils import get_prog, normalize_path - from pip.utils.deprecation import RemovedInPip8Warning - from pip.utils.logging import IndentingFormatter --from pip.utils.outdated import pip_version_check - - - __all__ = ['Command'] -@@ -237,15 +236,6 @@ class Command(object): - logger.critical('Exception:', exc_info=True) - - return UNKNOWN_ERROR -- finally: -- # Check if we're using the latest version of pip available -- if (not options.disable_pip_version_check and not -- getattr(options, "no_index", False)): -- with self._build_session( -- options, -- retries=0, -- timeout=min(5, options.timeout)) as session: -- pip_version_check(session) - - return SUCCESS - -diff --git a/pip/cmdoptions.py b/pip/cmdoptions.py -index 9a0446a..4fa29d3 100644 ---- a/pip/cmdoptions.py -+++ b/pip/cmdoptions.py -@@ -514,15 +514,6 @@ no_clean = partial( - default=False, - help="Don't clean up build directories.") - --disable_pip_version_check = partial( -- Option, -- "--disable-pip-version-check", -- dest="disable_pip_version_check", -- action="store_true", -- default=False, -- help="Don't periodically check PyPI to determine whether a new version " -- "of pip is available for download. Implied with --no-index.") -- - # Deprecated, Remove later - always_unzip = partial( - Option, -@@ -560,7 +551,6 @@ general_group = { - client_cert, - cache_dir, - no_cache, -- disable_pip_version_check, - ] - } - --- -2.6.2 - diff --git a/lang/python3-setuptools/Makefile b/lang/python3-setuptools/Makefile deleted file mode 100644 index b112a3b66..000000000 --- a/lang/python3-setuptools/Makefile +++ /dev/null @@ -1,61 +0,0 @@ -# -# Copyright (C) 2014-2016 OpenWrt.org -# -# This is free software, licensed under the GNU General Public License v2. -# See /LICENSE for more information. -# - -include $(TOPDIR)/rules.mk - -PKG_NAME:=python3-setuptools -PKG_VERSION:=27.2.0 -PKG_RELEASE:=1 - -PKG_SOURCE:=setuptools-$(PKG_VERSION).tar.gz -PKG_SOURCE_URL:=https://pypi.python.org/packages/87/ba/54197971d107bc06f5f3fbdc0d728a7ae0b10cafca46acfddba65a0899d8/ -PKG_MD5SUM:=b39715612fdc0372dbfd7b3fcf5d4fe5 - -PKG_LICENSE:=PSF - -PKG_BUILD_DIR:=$(BUILD_DIR)/python3-setuptools-$(PKG_VERSION) -PKG_UNPACK=$(HOST_TAR) -C $(PKG_BUILD_DIR) --strip-components=1 -xzf $(DL_DIR)/$(PKG_SOURCE) - -include $(INCLUDE_DIR)/package.mk -$(call include_mk, python3-package.mk) - -define Package/python3-setuptools - SUBMENU:=Python - SECTION:=lang - CATEGORY:=Languages - TITLE:=Tool for installing Python $(PYTHON3_VERSION) packages. - URL:=https://bitbucket.org/pypa/setuptools - DEPENDS:=+python3 +python3-dev +python3-lib2to3 - MAINTAINER:=Alexandru Ardelean -endef - -define Package/python3-setuptools/description - Easily download, build, install, upgrade, and uninstall Python $(PYTHON3_VERSION) packages -endef - -define Build/Compile - $(call Build/Compile/Py3Mod,,\ - install --root="$(PKG_INSTALL_DIR)" --prefix="/usr" \ - --single-version-externally-managed \ - ) -endef - -define Build/InstallDev - $(INSTALL_DIR) $(PYTHON3_LIB_DIR) - $(CP) \ - $(PKG_INSTALL_DIR)$(PYTHON3_PKG_DIR)/* \ - $(PYTHON3_LIB_DIR) -endef - -define Py3Package/python3-setuptools/install - $(INSTALL_DIR) $(1)/usr/bin - $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/bin/easy_install-$(PYTHON3_VERSION) $(1)/usr/bin/ - $(LN) easy_install-$(PYTHON3_VERSION) $(1)/usr/bin/easy_install3 -endef - -$(eval $(call Py3Package,python3-setuptools)) -$(eval $(call BuildPackage,python3-setuptools)) diff --git a/lang/python3-setuptools/patches/0001-remove-windows-support.patch b/lang/python3-setuptools/patches/0001-remove-windows-support.patch deleted file mode 100644 index 86e5bba05..000000000 --- a/lang/python3-setuptools/patches/0001-remove-windows-support.patch +++ /dev/null @@ -1,20 +0,0 @@ -diff --git a/setuptools/dist.py b/setuptools/dist.py -index b004f92..66b9d89 100644 ---- a/setuptools/dist.py -+++ b/setuptools/dist.py -@@ -17,7 +17,6 @@ from setuptools.extern.six.moves import map - from pkg_resources.extern import packaging - - from setuptools.depends import Require --from setuptools import windows_support - from setuptools.monkey import get_unpatched - import pkg_resources - -@@ -383,7 +382,6 @@ class Distribution(_Distribution): - egg_cache_dir = os.path.join(os.curdir, '.eggs') - if not os.path.exists(egg_cache_dir): - os.mkdir(egg_cache_dir) -- windows_support.hide_file(egg_cache_dir) - readme_txt_filename = os.path.join(egg_cache_dir, 'README.txt') - with open(readme_txt_filename, 'w') as f: - f.write('This directory contains eggs that were downloaded ' diff --git a/lang/python3-setuptools/patches/0002-fix-pyvenv-environment-get.patch b/lang/python3-setuptools/patches/0002-fix-pyvenv-environment-get.patch deleted file mode 100644 index d96ab089c..000000000 --- a/lang/python3-setuptools/patches/0002-fix-pyvenv-environment-get.patch +++ /dev/null @@ -1,13 +0,0 @@ -diff --git a/setuptools/command/easy_install.py b/setuptools/command/easy_install.py -index e8b90c7..8598c44 100755 ---- a/setuptools/command/easy_install.py -+++ b/setuptools/command/easy_install.py -@@ -1946,6 +1946,8 @@ class CommandSpec(list): - Construct a CommandSpec from a parameter to build_scripts, which may - be None. - """ -+ if os.environ.get('__PYVENV_LAUNCHER__'): -+ return cls.from_environment() - if isinstance(param, cls): - return param - if isinstance(param, list): diff --git a/lang/python3/Makefile b/lang/python3/Makefile index 2899b86c1..67a594de6 100644 --- a/lang/python3/Makefile +++ b/lang/python3/Makefile @@ -14,7 +14,7 @@ PYTHON_VERSION:=$(PYTHON3_VERSION) PYTHON_VERSION_MICRO:=$(PYTHON3_VERSION_MICRO) PKG_NAME:=python3 -PKG_RELEASE:=3 +PKG_RELEASE:=4 PKG_VERSION:=$(PYTHON_VERSION).$(PYTHON_VERSION_MICRO) PKG_SOURCE:=Python-$(PKG_VERSION).tar.xz @@ -96,7 +96,9 @@ define Py3BasePackage endif PYTHON3_LIB_FILES_DEL+=$(2) define Py3Package/$(1)/filespec - $(subst $(space),$(newline),$(foreach lib_file,$(2),+|$(lib_file))) + ifneq ($(2),) + $(subst $(space),$(newline),$(foreach lib_file,$(2),+|$(lib_file))) + endif endef endef @@ -140,8 +142,8 @@ CONFIGURE_ARGS+= \ --without-cxx-main \ --with-threads \ --with-system-ffi \ - --without-pymalloc \ --with-ensurepip=no \ + --without-pymalloc \ PYTHON_FOR_BUILD="$(PYTHON_FOR_BUILD)" \ $(ENABLE_IPV6) \ CONFIG_SITE="$(PKG_BUILD_DIR)/config.site" \ @@ -152,6 +154,31 @@ define Build/Prepare $(CP) ./files/config.site $(PKG_BUILD_DIR)/config.site endef +ifdef CONFIG_PACKAGE_python3-setuptools +define Build/Compile/python3-setuptools + $(STAGING_DIR_HOSTPKG)/bin/pip3 install \ + --ignore-installed \ + --root=$(PKG_BUILD_DIR)/install-setuptools --prefix=. \ + $(PKG_BUILD_DIR)/Lib/ensurepip/_bundled/setuptools-*.whl +endef +endif # CONFIG_PACKAGE_python3-setuptools + +ifdef CONFIG_PACKAGE_python3-pip +define Build/Compile/python3-pip + $(STAGING_DIR_HOSTPKG)/bin/pip3 install \ + --ignore-installed \ + --root=$(PKG_BUILD_DIR)/install-pip --prefix=. \ + $(PKG_BUILD_DIR)/Lib/ensurepip/_bundled/pip-*.whl +endef +endif # CONFIG_PACKAGE_python3-pip + +define Build/Compile + $(call Build/Compile/Default) + # Use host pip to install python-setuptools + $(call Build/Compile/python3-setuptools) + $(call Build/Compile/python3-pip) +endef + define Build/InstallDev $(INSTALL_DIR) $(STAGING_DIR)/mk/ $(INSTALL_DIR) $(1)/usr/include/ $(1)/usr/lib/ diff --git a/lang/python3/files/python3-package-pip.mk b/lang/python3/files/python3-package-pip.mk new file mode 100644 index 000000000..e346e22c5 --- /dev/null +++ b/lang/python3/files/python3-package-pip.mk @@ -0,0 +1,27 @@ +# +# Copyright (C) 2017 OpenWrt.org +# +# This is free software, licensed under the GNU General Public License v2. +# See /LICENSE for more information. +# + +define Package/python3-pip +$(call Package/python3/Default) + TITLE:=Python $(PYTHON3_VERSION) pip module + DEPENDS:=+python3 +python3-setuptools +endef + +define Py3Package/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/* + $(CP) $(PKG_BUILD_DIR)/install-pip/bin/pip3* $(1)/usr/bin + $(CP) \ + $(PKG_BUILD_DIR)/install-pip/lib/python$(PYTHON3_VERSION)/site-packages/pip \ + $(1)/usr/lib/python$(PYTHON3_VERSION)/site-packages/ +endef + +$(eval $(call Py3BasePackage,python3-pip, \ + , \ + DO_NOT_ADD_TO_PACKAGE_DEPENDS \ +)) diff --git a/lang/python3/files/python3-package-setuptools.mk b/lang/python3/files/python3-package-setuptools.mk new file mode 100644 index 000000000..063acb80e --- /dev/null +++ b/lang/python3/files/python3-package-setuptools.mk @@ -0,0 +1,30 @@ +# +# Copyright (C) 2017 OpenWrt.org +# +# This is free software, licensed under the GNU General Public License v2. +# See /LICENSE for more information. +# + +define Package/python3-setuptools +$(call Package/python3/Default) + TITLE:=Python $(PYTHON3_VERSION) setuptools module + DEPENDS:=+python3 +endef + +define Py3Package/python3-setuptools/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-setuptools/bin/* + $(CP) $(PKG_BUILD_DIR)/install-setuptools/bin/easy_install-* $(1)/usr/bin + $(LN) easy_install-$(PYTHON3_VERSION) $(1)/usr/bin/easy_install-3 + $(CP) \ + $(PKG_BUILD_DIR)/install-setuptools/lib/python$(PYTHON3_VERSION)/site-packages/pkg_resources \ + $(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 +endef + +$(eval $(call Py3BasePackage,python3-setuptools, \ + , \ + DO_NOT_ADD_TO_PACKAGE_DEPENDS \ +)) From 31d614f92cb2d34d657abdb9eb374e3e87dc4021 Mon Sep 17 00:00:00 2001 From: Alexandru Ardelean Date: Fri, 20 Jan 2017 18:11:18 +0200 Subject: [PATCH 4/4] python,python3: add python-pip-conf package to be used by both python-pip & python3-pip Signed-off-by: Alexandru Ardelean --- lang/python/Makefile | 17 +++++++++++++++++ lang/python/files/pip.conf | 3 +++ lang/python/files/python-package-pip.mk | 2 +- lang/python3/files/python3-package-pip.mk | 2 +- 4 files changed, 22 insertions(+), 2 deletions(-) create mode 100644 lang/python/files/pip.conf diff --git a/lang/python/Makefile b/lang/python/Makefile index f12e0361b..42b10d55e 100644 --- a/lang/python/Makefile +++ b/lang/python/Makefile @@ -59,6 +59,16 @@ define Package/python/Default/description the development of higher quality, more maintainable code. endef +define Package/python-pip-conf +$(call Package/python/Default) + TITLE:=Configuration file for pip/pip3 + URL:=https://pip.pypa.io +endef + +define Package/python-pip-conf/description + Configuration file for pip/pip3 +endef + define Package/python-base $(call Package/python/Default) TITLE:=Python $(PYTHON_VERSION) interpreter @@ -257,6 +267,11 @@ define PyPackage/python/filespec -|$(PYTHON_PKG_DIR) endef +define Package/python-pip-conf/install + $(INSTALL_DIR) $(1)/etc + $(CP) ./files/pip.conf $(1)/etc +endef + HOST_LDFLAGS += \ $$$$(pkg-config --static --libs libcrypto libssl) @@ -288,6 +303,8 @@ $(eval $(call PyPackage,python-base)) $(eval $(call PyPackage,python-light)) $(eval $(call PyPackage,python)) +$(eval $(call BuildPackage,python-pip-conf)) + $(eval $(call BuildPackage,python-base)) $(eval $(call BuildPackage,python-light)) $(eval $(call BuildPackage,python)) diff --git a/lang/python/files/pip.conf b/lang/python/files/pip.conf new file mode 100644 index 000000000..89339e98a --- /dev/null +++ b/lang/python/files/pip.conf @@ -0,0 +1,3 @@ +[global] +cache-dir=/tmp/.cache +log-file=/tmp/pip-log.txt diff --git a/lang/python/files/python-package-pip.mk b/lang/python/files/python-package-pip.mk index 66bd6553f..dbbffbcc0 100644 --- a/lang/python/files/python-package-pip.mk +++ b/lang/python/files/python-package-pip.mk @@ -8,7 +8,7 @@ define Package/python-pip $(call Package/python/Default) TITLE:=Python $(PYTHON_VERSION) pip module - DEPENDS:=+python +python-setuptools + DEPENDS:=+python +python-setuptools +python-pip-conf endef define PyPackage/python-pip/install diff --git a/lang/python3/files/python3-package-pip.mk b/lang/python3/files/python3-package-pip.mk index e346e22c5..a42c27c9d 100644 --- a/lang/python3/files/python3-package-pip.mk +++ b/lang/python3/files/python3-package-pip.mk @@ -8,7 +8,7 @@ define Package/python3-pip $(call Package/python3/Default) TITLE:=Python $(PYTHON3_VERSION) pip module - DEPENDS:=+python3 +python3-setuptools + DEPENDS:=+python3 +python3-setuptools +python-pip-conf endef define Py3Package/python3-pip/install