gnu: python-astroquery: Improve package style.

* gnu/packages/astronomy.scm (python-astroquery): Improve package style.
[build-system]: Swap to pyproject-build-system.
[arguments]{phases}: Rename 'writable-home phase to
'prepare-test-environment to reflect the purpose, Add extra step
configuring Pytest.
[native-inputs]: Remove python-flask, python-jinja2. Add
python-astropy-healpix, python-regions.

Change-Id: Id3909a13e451a2f9d5f4f28511e9f04c6bceb738
Signed-off-by: Eric Bavier <bavier@posteo.net>
This commit is contained in:
Sharlatan Hellseher 2023-11-17 12:16:09 +00:00 committed by Eric Bavier
parent 178871ff67
commit 7a4c272619
No known key found for this signature in database
GPG key ID: BC45CA67E2F8D007

View file

@ -1614,19 +1614,27 @@ (define-public python-astroquery
(uri (pypi-uri "astroquery" version)) (uri (pypi-uri "astroquery" version))
(sha256 (sha256
(base32 "1vhkzsqlgn3ji5by2rdf2gwklhbyzvpzb1iglalhqjkkrdaaaz1h")))) (base32 "1vhkzsqlgn3ji5by2rdf2gwklhbyzvpzb1iglalhqjkkrdaaaz1h"))))
(build-system python-build-system) (build-system pyproject-build-system)
(arguments (arguments
(list #:phases (list
#~(modify-phases %standard-phases #:test-flags
(add-before 'check 'writable-home #~(list "--pyargs" "astroquery"
(lambda _ ; some tests need a writable home "-m" "not remote_data")
(setenv "HOME" (getcwd)))) #:phases
(replace 'check #~(modify-phases %standard-phases
(lambda* (#:key tests? #:allow-other-keys) (add-before 'check 'prepare-test-environment
(when tests? (lambda _
(invoke "python" "-m" "pytest" "--pyargs" "astroquery" (setenv "HOME" (getcwd)) ; some tests need a writable home
;; Skip tests that require online data. ;; To solve pytest/conftest issue. Pytest tries to load all
"-m" "not remote_data"))))))) ;; files with word 'test' in them.
;;
;; ImportError while loading conftest ...
;; _pytest.pathlib.ImportPathMismatchError: ...
;;
(call-with-output-file "pytest.ini"
(lambda (port)
(format port "[pytest]
python_files = test_*.py"))))))))
(propagated-inputs (propagated-inputs
(list python-astropy (list python-astropy
python-beautifulsoup4 python-beautifulsoup4
@ -1636,12 +1644,13 @@ (define-public python-astroquery
python-pyvo python-pyvo
python-requests)) python-requests))
(native-inputs (native-inputs
(list python-flask (list python-astropy-healpix
python-jinja2
python-matplotlib python-matplotlib
;; python-mocpy : Not packed yet, optional
python-pytest-astropy python-pytest-astropy
python-pytest-dependency)) python-pytest-dependency
(home-page "https://www.astropy.org/astroquery/") python-regions))
(home-page "https://astroquery.readthedocs.io/en/latest/index.html")
(synopsis "Access online astronomical data resources") (synopsis "Access online astronomical data resources")
(description "Astroquery is a package that contains a collection of tools (description "Astroquery is a package that contains a collection of tools
to access online Astronomical data. Each web service has its own sub-package.") to access online Astronomical data. Each web service has its own sub-package.")