all messages for Guix-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Nicolas Goaziou <mail@nicolasgoaziou.fr>
To: 31985@debbugs.gnu.org
Subject: [bug#31985] [PATCH 2/2] gnu: python-pylibscrypt: Improve speed.
Date: Wed, 27 Jun 2018 00:31:16 +0200	[thread overview]
Message-ID: <20180626223116.3448-2-mail@nicolasgoaziou.fr> (raw)
In-Reply-To: <20180626223116.3448-1-mail@nicolasgoaziou.fr>

* gnu/packages/python-crypto.scm (python-pylibscrypt): Use "libscrypt"
  implementation instead of "openssl".

"hashlib.scrypt" requires Python 3.6+ and OpenSSL 1.1+.  Since Python is built
with OpenSSL 1.0, the library is unavailable. "pylibscrypt" defaults to a slow
pure Python implementation.  Instead, rely on the much faster "libscrypt".
---
 gnu/packages/python-crypto.scm | 21 ++++++++++++++++++---
 1 file changed, 18 insertions(+), 3 deletions(-)

diff --git a/gnu/packages/python-crypto.scm b/gnu/packages/python-crypto.scm
index 6162fc835..779b86222 100644
--- a/gnu/packages/python-crypto.scm
+++ b/gnu/packages/python-crypto.scm
@@ -884,14 +884,29 @@ through the Engine interface.")
          "1b3rgzl6dbzs08vhv41b6y4n5189wv7lr27acxn104hs45745abs"))))
     (build-system python-build-system)
     (arguments
-     `(#:tests? #f))                    ;FIXME: unable to find libraries
+     `(#:phases
+       (modify-phases %standard-phases
+         (add-before 'build 'hard-code-path-to-libscrypt
+           (lambda* (#:key inputs #:allow-other-keys)
+             (let ((libscrypt (assoc-ref inputs "libscrypt")))
+               (substitute* "pylibscrypt/pylibscrypt.py"
+                 (("find_library\\('scrypt'\\)")
+                  (string-append "'" libscrypt "/lib/libscrypt.so'")))
+               #t))))
+       ;; The library can use various scrypt implementations and tests all of
+       ;; them.  Since we only provide a single implementation, most tests
+       ;; fail.  Simply skip them.
+       #:tests? #f))
+    ;; FIXME: Using "libscrypt" is the second best choice.  The best one
+    ;; requires "hashlib.scrypt", provided by Python 3.6+ built with OpenSSL
+    ;; 1.1+.  Use that as soon as Guix provides it.
     (inputs
-     `(("openssl" ,openssl)))
+     `(("libscrypt" ,libscrypt)))
     (home-page "https://github.com/jvarho/pylibscrypt")
     (synopsis "Scrypt for Python")
     (description "There are a lot of different scrypt modules for Python, but
 none of them have everything that I'd like, so here's one more.  It uses
-hashlib.scrypt on Python 3.6 and OpenSSL 1.1.")
+@code{libscrypt}.")
     (license license:isc)))
 
 (define-public python-libnacl
-- 
2.18.0

  reply	other threads:[~2018-06-26 22:32 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-06-26 22:24 [bug#31985] [PATCH 0/2] Improve python-libscrypt speed Nicolas Goaziou
2018-06-26 22:31 ` [bug#31985] [PATCH 1/2] gnu: Add libscrypt Nicolas Goaziou
2018-06-26 22:31   ` Nicolas Goaziou [this message]
2018-07-02 15:33     ` [bug#31985] [PATCH 2/2] gnu: python-pylibscrypt: Improve speed Ludovic Courtès
2018-07-02 21:19       ` bug#31985: " Nicolas Goaziou
2018-07-02 15:32   ` [bug#31985] [PATCH 1/2] gnu: Add libscrypt Ludovic Courtès
2018-07-02 21:19     ` Nicolas Goaziou
2018-07-03  8:09       ` Ludovic Courtès

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20180626223116.3448-2-mail@nicolasgoaziou.fr \
    --to=mail@nicolasgoaziou.fr \
    --cc=31985@debbugs.gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/guix.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.