~ruther/guix-local

2f1dd4f3265c7a831a41851e988ea9eb9232d969 — Nicolas Graves 11 months ago 11902d4
gnu: python-asyncmy: Update to 0.2.10.

* gnu/packages/databases.scm (python-asyncmy): Update to 0.2.10.
[source]: Switch to git-fetch.
[build-system]: Switch to pyproject-build-system.
[arguments]<#:tests?>: Disable them for now.
<#:phases>: Replace 'check phase. Add a 'cleanup phase.
[native-inputs]: Add mysql, python-poetry-core, python-pytest,
python-pytest-asyncio, python-setuptools, python-wheel.

Change-Id: I759a85d29372b0d50c2d8992ee303724b7462958
Signed-off-by: Sharlatan Hellseher <sharlatanus@gmail.com>
1 files changed, 59 insertions(+), 8 deletions(-)

M gnu/packages/databases.scm
M gnu/packages/databases.scm => gnu/packages/databases.scm +59 -8
@@ 3694,15 3694,66 @@ with Python's asyncio framework.")
(define-public python-asyncmy
  (package
    (name "python-asyncmy")
    (version "0.2.5")
    (version "0.2.10")
    (source
      (origin
        (method url-fetch)
        (uri (pypi-uri "asyncmy" version))
        (sha256
          (base32 "0i18zxy6xvzv6dk791xifn2sw2q4zvqwpzrzy8qx51d3mp8z6gng"))))
    (build-system python-build-system)
    (native-inputs (list python-cython))
     (origin
       (method git-fetch)
       (uri (git-reference
              (url "https://github.com/long2ice/asyncmy")
              (commit (string-append "v" version))))
       (file-name (git-file-name name version))
       (sha256
        (base32 "10sqihiwx7vsdaavgl418hhk7d5rl6d1i60y5bjr76mdfny18q55"))))
    (build-system pyproject-build-system)
    (arguments
     (list
      ;; XXX: Most tests fail, probably because
      ;; of pytest-asyncio version mismatch.
      #:tests? #f
      #:phases
      #~(modify-phases %standard-phases
          (add-after 'install 'cleanup
            (lambda* (#:key inputs outputs #:allow-other-keys)
              (for-each delete-file
                        (find-files (site-packages inputs outputs)
                                    "\\.(c|pyx)$"))))

          (replace 'check
            (lambda* (#:key tests? #:allow-other-keys #:rest rest)
              (when tests?
                ;; XXX: Else pytest picks up the wrong __init__.py
                (delete-file-recursively "asyncmy")
                ;; The tests rely on a MySQL or MariaDB test server
                ;; being available.
                (let ((datadir "/tmp/mysql")
                      (socket "/tmp/mysql/mysqld.sock")
                      (username "root")
                      (password "123456")) ;default in conftest.py
                  (invoke "mysqld" "--initialize-insecure"
                          (string-append "--datadir=" datadir))
                  (spawn "mysqld"
                         (list
                          "mysqld"
                          ;; Respect '--datadir'.
                          "--no-defaults"
                          (string-append "--datadir=" datadir)
                          (string-append "--socket=" socket)))
                  (sleep 1)
                  (invoke "mysql"
                          (string-append "--socket=" socket)
                          "-u" "root"
                          "-e" (string-append
                                "ALTER USER 'root'@'localhost' IDENTIFIED BY '"
                                password "';"))
                  (apply (assoc-ref %standard-phases 'check)
                         `(#:tests? ,tests? ,@rest)))))))))
    (native-inputs
     (list mysql
           python-cython
           python-poetry-core
           python-pytest
           python-pytest-asyncio
           python-setuptools))
    (home-page "https://github.com/long2ice/asyncmy")
    (synopsis "Fast MySQL driver for Python")
    (description "@code{asyncmy} is a fast @code{asyncio} MySQL driver, which