python-crypto: add python3 variant, src packages, omit tests 5437/head
authorJeffery To <jeffery.to@gmail.com>
Sun, 14 Jan 2018 14:29:29 +0000 (22:29 +0800)
committerJeffery To <jeffery.to@gmail.com>
Sun, 14 Jan 2018 14:31:01 +0000 (22:31 +0800)
Signed-off-by: Jeffery To <jeffery.to@gmail.com>
lang/python/python-crypto/Makefile
lang/python/python-crypto/patches/002-fix-endianness-detect.patch
lang/python/python-crypto/patches/003-omit-tests.patch [new file with mode: 0644]

index 8d4aaefcede27b42da2b917ab6cf55fcae83e999..551fd94fa6806969a8813758dcc2b56a2aef8cbc 100644 (file)
@@ -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 <jeffery.to@gmail.com>
 
 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))
index baed012bf692a5ecbfffa1ef62da57010bd71506..38e5a5b624d72f7fee10adf8577a6a4bfa2d942b 100644 (file)
@@ -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 (file)
index 0000000..f72bcb0
--- /dev/null
@@ -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"],