gnu: python-typer: Simplify by using pyproject-build-system.

* gnu/packages/python-xyz.scm (python-typer)[build-system]: Use
pyproject-build-system.
[arguments]: Remove extra quoting; remove custom 'build phase; remove custom
'install phase; remove custom 'check phase; add 'pre-check phase.
[synopsis]: Pull onto the same line.
[description]: Reformat.
This commit is contained in:
Ricardo Wurmus 2022-12-12 21:40:53 +01:00
parent 1d160f41f5
commit c4bcb5db49
No known key found for this signature in database
GPG key ID: 197A5888235FACAC

View file

@ -22311,60 +22311,42 @@ (define-public python-typer
(file-name (git-file-name name version))
(sha256
(base32 "1knv353qhkl2imav3jfp6bgq47m8wkkqhq1dzmqg2sv8rsy7zgl7"))))
(build-system python-build-system)
(build-system pyproject-build-system)
(arguments
`(#:phases
,#~(modify-phases %standard-phases
;; Unfortunately, this doesn't seem to be enough to fix these two
;; tests, but we'll patch this anyway.
(add-after 'unpack 'patch-shell-reference
(lambda _
(substitute* "tests/test_completion/test_completion.py"
(("\"bash\"") (string-append "\"" (which "bash") "\""))
(("\"/bin/bash\"")
(string-append "\"" (which "bash") "\"")))))
(replace 'build
(lambda _
(invoke "flit" "build")))
(replace 'install
(lambda* (#:key inputs outputs #:allow-other-keys)
(add-installed-pythonpath inputs outputs)
(for-each
(lambda (wheel)
(format #true wheel)
(invoke "python" "-m" "pip" "install"
wheel (string-append "--prefix=" #$output)))
(find-files "dist" "\\.whl$"))))
(replace 'check
(lambda* (#:key tests? #:allow-other-keys)
(when tests?
(setenv "HOME" "/tmp") ; some tests need it
;; This is for completion tests
(with-output-to-file "/tmp/.bashrc"
(lambda _ (display "# dummy")))
(setenv "GUIX_PYTHONPATH"
(string-append (getcwd) ":"
(getenv "GUIX_PYTHONPATH")))
(let ((disabled-tests (list "test_show_completion"
"test_install_completion")))
(invoke "python" "-m" "pytest" "tests/"
"-k"
(string-append "not "
(string-join disabled-tests
" and not "))))))))))
(list
#:test-flags
'(let ((disabled-tests (list "test_show_completion"
"test_install_completion")))
(list "-k" (string-append "not "
(string-join disabled-tests
" and not "))))
#:phases
#~(modify-phases %standard-phases
;; Unfortunately, this doesn't seem to be enough to fix these two
;; tests, but we'll patch this anyway.
(add-after 'unpack 'patch-shell-reference
(lambda _
(substitute* "tests/test_completion/test_completion.py"
(("\"bash\"") (string-append "\"" (which "bash") "\""))
(("\"/bin/bash\"")
(string-append "\"" (which "bash") "\"")))))
(add-before 'check 'pre-check
(lambda* (#:key tests? #:allow-other-keys)
(when tests?
(setenv "HOME" "/tmp") ; some tests need it
;; This is for completion tests
(with-output-to-file "/tmp/.bashrc"
(lambda _ (display "# dummy")))))))))
(propagated-inputs
(list python-click))
(native-inputs
(list python-coverage python-flit python-pytest python-rich
python-shellingham))
(home-page "https://github.com/tiangolo/typer")
(synopsis
"Typer builds CLI based on Python type hints")
(synopsis "Typer builds CLI based on Python type hints")
(description
"Typer is a library for building CLI applications. It's based on
Python 3.6+ type hints.")
"Typer is a library for building CLI applications. It's based on Python
3.6+ type hints.")
;; MIT license
(license license:expat)))