[oe] [meta-python] [PATCH] python3-pycrypto: drop time.clock

liu.ming50 at gmail.com liu.ming50 at gmail.com
Sat Jan 25 14:19:53 UTC 2020


From: Ming Liu <liu.ming50 at gmail.com>

The use of time.clock() is deprecated in python 3.8, change to use
time.process_time().

Reference:
https://docs.python.org/3.3/library/time.html#time.clock

Signed-off-by: Ming Liu <liu.ming50 at gmail.com>
---
 ...Replace-time.clock-with-time.process_time.patch | 34 ++++++++++++++++++++++
 .../python/python3-pycrypto_2.6.1.bb               |  2 ++
 2 files changed, 36 insertions(+)
 create mode 100644 meta-python/recipes-devtools/python/python3-pycrypto/0001-Replace-time.clock-with-time.process_time.patch

diff --git a/meta-python/recipes-devtools/python/python3-pycrypto/0001-Replace-time.clock-with-time.process_time.patch b/meta-python/recipes-devtools/python/python3-pycrypto/0001-Replace-time.clock-with-time.process_time.patch
new file mode 100644
index 0000000..282fdd3
--- /dev/null
+++ b/meta-python/recipes-devtools/python/python3-pycrypto/0001-Replace-time.clock-with-time.process_time.patch
@@ -0,0 +1,34 @@
+From 1d90727ff2368012d6e2f91b1a3198f626495b7f Mon Sep 17 00:00:00 2001
+From: Ming Liu <liu.ming50 at gmail.com>
+Date: Sat, 25 Jan 2020 14:36:16 +0100
+Subject: [PATCH] Replace time.clock() with time.process_time()
+
+The use of time.clock() is deprecated in python 3.8, change to use
+time.process_time().
+
+Reference:
+https://docs.python.org/3.3/library/time.html#time.clock
+
+Upstream-Status: Pending
+
+Signed-off-by: Ming Liu <liu.ming50 at gmail.com>
+---
+ lib/Crypto/Random/_UserFriendlyRNG.py | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/lib/Crypto/Random/_UserFriendlyRNG.py b/lib/Crypto/Random/_UserFriendlyRNG.py
+index 957e006..d2a0259 100644
+--- a/lib/Crypto/Random/_UserFriendlyRNG.py
++++ b/lib/Crypto/Random/_UserFriendlyRNG.py
+@@ -74,7 +74,7 @@ class _EntropyCollector(object):
+         self._time_es.feed(struct.pack("@I", int(2**30 * (t - floor(t)))))
+ 
+         # Add the fractional part of time.clock()
+-        t = time.clock()
++        t = time.process_time()
+         self._clock_es.feed(struct.pack("@I", int(2**30 * (t - floor(t)))))
+ 
+ 
+-- 
+2.7.4
+
diff --git a/meta-python/recipes-devtools/python/python3-pycrypto_2.6.1.bb b/meta-python/recipes-devtools/python/python3-pycrypto_2.6.1.bb
index 02d634c..a20eafe 100644
--- a/meta-python/recipes-devtools/python/python3-pycrypto_2.6.1.bb
+++ b/meta-python/recipes-devtools/python/python3-pycrypto_2.6.1.bb
@@ -1,6 +1,8 @@
 inherit distutils3
 require python-pycrypto.inc
 
+SRC_URI += "file://0001-Replace-time.clock-with-time.process_time.patch"
+
 # We explicitly call distutils_do_install, since we want it to run, but
 # *don't* want the autotools install to run, since this package doesn't
 # provide a "make install" target.
-- 
2.7.4



More information about the Openembedded-devel mailing list