summaryrefslogtreecommitdiff
path: root/gnu/packages/databases.scm
diff options
context:
space:
mode:
Diffstat (limited to 'gnu/packages/databases.scm')
-rw-r--r--gnu/packages/databases.scm67
1 files changed, 59 insertions, 8 deletions
diff --git a/gnu/packages/databases.scm b/gnu/packages/databases.scm
index f262aaf95b..d6a042a378 100644
--- a/gnu/packages/databases.scm
+++ b/gnu/packages/databases.scm
@@ -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