Control: tags -1 + patch

On 2021-01-20 01:52:54 +1100, Konomi Kitten wrote:
> Package: python3-otr
> Version: python3-potr
> Severity: grave
> Justification: renders package unusable
> X-Debbugs-Cc: konomikit...@gmail.com
> 
> Trying to import potr throws the following error:
> 
> $ python3
> Python 3.9.1+ (default, Jan 10 2021, 15:42:50)
> [GCC 10.2.1 20201224] on linux
> Type "help", "copyright", "credits" or "license" for more information.
> >>> import potr
> Traceback (most recent call last):
>   File "/usr/lib/python3/dist-packages/potr/compatcrypto/pycrypto.py", line 
> 19,
> in <module>
>     import Crypto
> ModuleNotFoundError: No module named 'Crypto'
> 
> During handling of the above exception, another exception occurred:
> 
> Traceback (most recent call last):
>   File "<stdin>", line 1, in <module>
>   File "/usr/lib/python3/dist-packages/potr/__init__.py", line 21, in <module>
>     from potr import context
>   File "/usr/lib/python3/dist-packages/potr/context.py", line 43, in <module>
>     from potr import crypt
>   File "/usr/lib/python3/dist-packages/potr/crypt.py", line 25, in <module>
>     from potr.compatcrypto import SHA256, SHA1, SHA1HMAC, SHA256HMAC, \
>   File "/usr/lib/python3/dist-packages/potr/compatcrypto/__init__.py", line 
> 21,
> in <module>
>     from potr.compatcrypto.pycrypto import *
>   File "/usr/lib/python3/dist-packages/potr/compatcrypto/pycrypto.py", line 
> 21,
> in <module>
>     import crypto as Crypto
> ModuleNotFoundError: No module named 'crypto'
> >>>

Please consider applying the attached patch. The package also needs to
depend on python3-pycryptodome either by manually hardcoding the
dependency in debian/control or by fixing
debian/patches/0001-Use-pycryptodome-as-dependency.patch to have
install_requires=["pycryptodomex"]

Cheers
-- 
Sebastian Ramacher
--- python-potr-1.0.2.orig/src/potr/compatcrypto/pycrypto.py
+++ python-potr-1.0.2/src/potr/compatcrypto/pycrypto.py
@@ -16,16 +16,16 @@
 #    along with this library.  If not, see <http://www.gnu.org/licenses/>.
 
 try:
-  import Crypto
+  import Cryptodome
 except ImportError:
   import crypto as Crypto
 
-from Crypto import Cipher
-from Crypto.Hash import SHA256 as _SHA256
-from Crypto.Hash import SHA as _SHA1
-from Crypto.Hash import HMAC as _HMAC
-from Crypto.PublicKey import DSA
-import Crypto.Random.random
+from Cryptodome import Cipher
+from Cryptodome.Hash import SHA256 as _SHA256
+from Cryptodome.Hash import SHA as _SHA1
+from Cryptodome.Hash import HMAC as _HMAC
+from Cryptodome.PublicKey import DSA
+import Cryptodome.Random.random
 from numbers import Number
 
 from potr.compatcrypto import common
@@ -143,7 +143,7 @@ class DSAKey(common.PK):
         return cls((y, g, p, q), private=False), data
 
 def getrandbits(k):
-    return Crypto.Random.random.getrandbits(k)
+    return Cryptodome.Random.random.getrandbits(k)
 
 def randrange(start, stop):
-    return Crypto.Random.random.randrange(start, stop)
+    return Cryptodome.Random.random.randrange(start, stop)

Attachment: signature.asc
Description: PGP signature

Reply via email to