From fa60629c99588a111b78a6c34958f6eddc770a49 Mon Sep 17 00:00:00 2001 From: Jeffery To Date: Sun, 14 Jan 2018 22:29:29 +0800 Subject: [PATCH] python-crypto: add python3 variant, src packages, omit tests Signed-off-by: Jeffery To --- lang/python/python-crypto/Makefile | 60 ++++++++++++++----- .../patches/002-fix-endianness-detect.patch | 2 +- .../patches/003-omit-tests.patch | 19 ++++++ 3 files changed, 64 insertions(+), 17 deletions(-) create mode 100644 lang/python/python-crypto/patches/003-omit-tests.patch diff --git a/lang/python/python-crypto/Makefile b/lang/python/python-crypto/Makefile index 8d4aaefced..551fd94fa6 100644 --- a/lang/python/python-crypto/Makefile +++ b/lang/python/python-crypto/Makefile @@ -1,5 +1,5 @@ # -# Copyright (C) 2009-2015 OpenWrt.org +# Copyright (C) 2009-2015, 2017-2018 OpenWrt.org # # This is free software, licensed under the GNU General Public License v2. # See /LICENSE for more information. @@ -7,28 +7,45 @@ include $(TOPDIR)/rules.mk -PKG_NAME:=pycrypto +PKG_NAME:=python-crypto PKG_VERSION:=2.6.1 -PKG_RELEASE:=1 +PKG_RELEASE:=2 -PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz +PKG_SOURCE:=pycrypto-$(PKG_VERSION).tar.gz PKG_SOURCE_URL:=https://ftp.dlitz.net/pub/dlitz/crypto/pycrypto/ PKG_HASH:=f2ce1e989b272cfcb677616763e0a2e7ec659effa67a88aa92b3a65528f60a3c +PKG_BUILD_DIR:=$(BUILD_DIR)/$(BUILD_VARIANT)-crypto-$(PKG_VERSION) + PKG_LICENSE:=Public Domain PKG_LICENSE_FILES:=COPYRIGHT PKG_MAINTAINER:=Jeffery To include $(INCLUDE_DIR)/package.mk include ../python-package.mk +include ../python3-package.mk + +PKG_UNPACK:=$(HOST_TAR) -C $(PKG_BUILD_DIR) --strip-components=1 -xzf $(DL_DIR)/$(PKG_SOURCE) + +define Package/python-crypto/Default + SECTION:=lang-python + CATEGORY:=Languages + SUBMENU:=Python + URL:=http://www.pycrypto.org/ +endef define Package/python-crypto - SECTION:=lang-python - CATEGORY:=Languages - SUBMENU:=Python - TITLE:=python-crypto - URL:=http://www.pycrypto.org/ - DEPENDS:=+python +libgmp +$(call Package/python-crypto/Default) + TITLE:=python-crypto + DEPENDS:=+libgmp +PACKAGE_python-crypto:python + VARIANT:=python +endef + +define Package/python3-crypto +$(call Package/python-crypto/Default) + TITLE:=python3-crypto + DEPENDS:=+libgmp +PACKAGE_python3-crypto:python3 + VARIANT:=python3 endef define Package/python-crypto/description @@ -36,19 +53,30 @@ A collection of both secure hash functions (such as MD5 and SHA), and various encryption algorithms (AES, DES, IDEA, RSA, ElGamal, etc.). endef -define Build/Compile +define Package/python3-crypto/description +$(call Package/python-crypto/description) +. +(Variant for Python3) +endef + +define PyBuild/Compile $(call Build/Compile/PyMod,,\ install --prefix=/usr --root=$(PKG_INSTALL_DIR),\ CONFIG_BIG_ENDIAN="$(CONFIG_BIG_ENDIAN)" \ ) endef -define Package/python-crypto/install - $(INSTALL_DIR) $(1)$(PYTHON_PKG_DIR)/ - $(CP) \ - $(PKG_INSTALL_DIR)$(PYTHON_PKG_DIR)/* \ - $(1)$(PYTHON_PKG_DIR)/ +define Py3Build/Compile + $(call Build/Compile/Py3Mod,,\ + install --prefix=/usr --root=$(PKG_INSTALL_DIR),\ + CONFIG_BIG_ENDIAN="$(CONFIG_BIG_ENDIAN)" \ + ) endef $(eval $(call PyPackage,python-crypto)) $(eval $(call BuildPackage,python-crypto)) +$(eval $(call BuildPackage,python-crypto-src)) + +$(eval $(call Py3Package,python3-crypto)) +$(eval $(call BuildPackage,python3-crypto)) +$(eval $(call BuildPackage,python3-crypto-src)) diff --git a/lang/python/python-crypto/patches/002-fix-endianness-detect.patch b/lang/python/python-crypto/patches/002-fix-endianness-detect.patch index baed012bf6..38e5a5b624 100644 --- a/lang/python/python-crypto/patches/002-fix-endianness-detect.patch +++ b/lang/python/python-crypto/patches/002-fix-endianness-detect.patch @@ -1,6 +1,6 @@ --- a/setup.py +++ b/setup.py -@@ -100,6 +100,10 @@ +@@ -100,6 +100,10 @@ def PrintErr(*args, **kwd): w(kwd.get("end", "\n")) def endianness_macro(): diff --git a/lang/python/python-crypto/patches/003-omit-tests.patch b/lang/python/python-crypto/patches/003-omit-tests.patch new file mode 100644 index 0000000000..f72bcb07b2 --- /dev/null +++ b/lang/python/python-crypto/patches/003-omit-tests.patch @@ -0,0 +1,19 @@ +--- a/setup.py ++++ b/setup.py +@@ -357,16 +357,6 @@ kw = {'name':"pycrypto", + "Crypto.Random", + "Crypto.Random.Fortuna", + "Crypto.Random.OSRNG", +- "Crypto.SelfTest", +- "Crypto.SelfTest.Cipher", +- "Crypto.SelfTest.Hash", +- "Crypto.SelfTest.Protocol", +- "Crypto.SelfTest.PublicKey", +- "Crypto.SelfTest.Random", +- "Crypto.SelfTest.Random.Fortuna", +- "Crypto.SelfTest.Random.OSRNG", +- "Crypto.SelfTest.Util", +- "Crypto.SelfTest.Signature", + "Crypto.Protocol", + "Crypto.PublicKey", + "Crypto.Signature"], -- 2.30.2