Fixes <https://bugs.gnu.org/33046>.
* guix/build-system/python.scm (pypi-uri): Update the host URI to
"files.pythonhosted.org".
* guix/import/pypi.scm (make-pypi-sexp): Preserve the package name case when
the source URL calls for it.
* guix/import/pypi.scm (maybe-inputs): Add INPUT-TYPE argument, and use it.
(test-section?): New predicate.
(parse-requires.txt): Collect the optional test inputs, and return them as the
second element of the returned list.
(parse-wheel-metadata): Likewise.
(guess-requirements): Adapt.
(make-pypi-sexp): Likewise, and include the test inputs requirements as native
inputs in the returned package expression.
* tests/pypi.scm (test-requires.txt): Include a test section in the
test-requires.txt data.
(test-requires.txt-beaker): New variable.
("parse-requires.txt"): Adapt.
("parse-requires.txt - Beaker"): New test.
("parse-wheel-metadata, with extras"): Adapt.
("parse-wheel-metadata, with extras - Jedi"): Adapt.
("pypi->guix-package, no wheel"): Re-indent, and add the expected
native-inputs.
("pypi->guix-package, wheels"): Likewise.
With newer Wheel releases, there is no more metadata.json file; the METADATA
file should be used instead (see: https://github.com/pypa/wheel/issues/195).
This change updates our PyPI importer so that it uses the latter.
* guix/import/pypi.scm (define-module): Remove unnecessary modules and export
the PARSE-WHEEL-METADATA procedure.
(parse-wheel-metadata): Add procedure.
(guess-requirements): Use it.
* tests/pypi.scm (test-metadata): Test it.
This change enables the PyPI importer to look for requirements in a source
archive of a different type than "tar.gz" or "tar.bz2". Also, scan the source
archive to find a requires.txt file.
* guix/import/pypi.scm: (guess-requirements)[tarball-directory]: Remove procedure.
[guess-requirements-from-source]: Use COMRESSED-FILE? to determine if an
archive type is supported, and some file extension logic that chooses either
"tar" or "unzip" as the extractor. Search for the requires.txt file in the
archive instead of using a static, expected location.
(guess-requirements): Rename the TARBALL argument to ARCHIVE, to denote the
archive format is no longer bound specifically to the Tar format.
(compute-inputs): Likewise.
* tests/pypi.scm ("pypi->guix-package, no wheel"): Mock the requires.txt at a
non-standard location.
("pypi->guix-package, no usable requirement file."): New test.
The previous solution was fragile and could leave unwanted characters in a
requirement name, such as '[' or ']'.
Partially fixes <https://bugs.gnu.org/33047>.
* guix/import/pypi.scm (use-modules): Export SPECIFICATION->REQUIREMENT-NAME
(%requirement-name-regexp): New variable.
(clean-requirement): Rename to...
(specification->requirement-name): this, which now uses
%requirement-name-regexp to select the requirement name from the requirement
specification.
(parse-requires.txt): Adapt.
* guix/import/pypi.scm: Export PARSE-REQUIRES.TXT.
(clean-requirement): Move procedure to the top level.
(guess-requirements): Move the READ-REQUIREMENTS procedure to the top level,
and rename it to PARSE-REQUIRES.TXT. Move the CLEAN-REQUIREMENT procedure to
the top level. Move the COMMENT? functions inside the PARSE-REQUIRES.TXT
procedure.
(parse-requires.txt): Add a SECTION-HEADER? predicate, and use it to prevent
parsing optional requirements.
* tests/pypi.scm (test-requires-with-sections): New variable.
("parse-requires.txt, with sections"): New test.
PyPI packages are mandated to have a setup.py file, which contains a listing
of the required dependencies. The setuptools/distutils machinery embed
metadata in the archives they produce, which contains this information. There
is no need nor gain to collect the requirements from a "requirements.txt"
file, as it is not the true record of dependencies for PyPI packages and may
contain extraneous requirements or not exist at all.
* guix/import/pypi.scm (guess-requirements): Update comment.
[guess-requirements-from-source]: Do not attempt to parse the file
requirements.txt. Streamline logic.
* tests/pypi.scm (test-requires.txt): Rename from test-requirements, to hint
at the file being tested.
("pypi->guix-package"): Adapt so that the fake package contains a requires.txt
file rather than a requirements.txt file.
("pypi->guix-package, wheels"): Likewise.
* guix/import/crate.scm (maybe-cargo-inputs): Remove one level of lists.
* guix/import/crate.scm (maybe-cargo-development-inputs): Same.
* tests/crate.scm: (crate->guix-package)[package]<#:arguments>: Remove
one level of list nesting.
Hackage packages can have metadata revisions (Cabal file only) that are
not reflected in the source archive. The Haskell build system has
support for this, but until now the Hackage importer would create a
package based on the revised Cabal file which would then build using the
old Cabal file.
Fixes <https://bugs.gnu.org/35750>.
* guix/import/cabal.scm (<cabal-package>): Add 'revision' field.
(eval-cabal): Parse 'x-revision:' property.
* guix/import/hackage.scm (read-cabal-and-hash): New procedure.
(hackage-fetch-and-hash): New procedure.
(hackage-fetch): Rewrite using 'hackage-fetch-and-hash'.
(hackage-module->sexp): Add 'cabal-hash' argument and use it to populate
the '#:cabal-revision' argument.
(hackage->guix-package): Use the new '-and-hash' functions to get the
hash of the Cabal file and pass it to 'hackage-module->sexp'.
* guix/tests/hackage.scm: Test import of Cabal file revision.
Signed-off-by: Timothy Sample <samplet@ngyro.com>
* guix/import/crate.scm:
(crate-fetch)[input-crates]: Rename to dev-crates.
[native-input-crates]: Rename to dev-dep-crates.
[inputs]: Rename to cargo-inputs.
[native-inputs]: Rename to cargo-development-inputs.
(maybe-cargo-inputs, maybe-cargo-development-inputs, maybe-arguments): Add
them.
(make-crate-sexp)[inputs]: Rename to cargo-inputs.
[native-inputs]: Rename to cargo-development-inputs.
[maybe-native-inputs, maybe-inputs]: Replace with maybe-arguments.
* guix/import/utils.scm: (package-names->package-inputs): Make public. Add
docstring.
* tests/crate.scm (crate->guix-package): Update the match pattern.
Signed-off-by: Chris Marusich <cmmarusich@gmail.com>
Fixes <http://bugs.gnu.org/35893>.
Reported by Jesse Gibbons <jgibbons2357@gmail.com>.
* guix/import/print.scm (package->code)[package-lists->code]: Preserve
OUT in the result.
* tests/print.scm (define-with-source): New macro.
(pkg): Use it.
(pkg-source): New variable.
(pkg-with-inputs, pkg-with-inputs-source): New variables.
("simple package"): Refer to 'pkg-source'.
("package with inputs"): New test.
This simplifies the logic of recursive-import, intending no
major functional changes. The package import function is no
longer called twice per package. Failed imports now make it
to the package stream as '() instead of #f.
* guix/import/utils.scm (recursive-import): Simplify.
Signed-off-by: Oleg Pykhalov <go.wigust@gmail.com>
This adds partial support for Cabal properties that use curly
braces instead of the layout rule. See for example
https://hackage.haskell.org/package/cassava/
* guix/import/cabal.scm (read-braced-value): New procedure.
(is-property): Remove.
(is-layout-property, is-braced-property): New variables.
(lex-property): Rename to...
(lex-layout-property): ... this.
(lex-braced-property, lex-property): New procedures.
(lex-token): Add call to 'lex-property'.
* guix/tests/hackage.scm: Test braced description import.
* tests/hackage.scm (test-cabal-multiline-desc): Rename to...
(test-cabal-multiline-layout): ... this.
("hackage->guix-package test multiline desc"): Rename to...
("hackage->guix-package test multiline desc (layout)"): ... this.
(test-cabal-multiline-braced): New variable.
("hackage->guix-package test multiline desc (braced)"): New test.
Signed-off-by: Ludovic Courtès <ludo@gnu.org>
Update the list of excepted dependencies for current ghc-8.4, based on the
release notes at
https://downloads.haskell.org/~ghc/8.4.3/docs/html/users_guide/8.4.3-notes.html
Particularly, this adds `text` to the list, which is a dependency of `parsec`
which was already on the list before, causing build failures with updated
versions of the `text` package.
* guix/import/hackage.scm (ghc-standard-libraries): Update list.
Signed-off-by: Ricardo Wurmus <rekado@elephly.net>
* guix/import/hackage.scm (hackage->guix-package): Remove call to 'memoize'.
(hackage->guix-package/m): New procedure.
(hackage-recursive-import): Use it.
* tests/hackage.scm ("hackage->guix-package test 6"): Adjust.
Co-authored-by: Robert Vollmert <rob@vllmrt.net>
janestreet reversionned its packages and prefixed them with "v". Let the
importer know about that and choose "v" versions first.
* guix/import/opam.scm (find-latest-version): Work around version
rewrite from janestreet.
(opam->guix-package): Do not pass "v" to version number.
This fixes a regression introduced in 9a5091d0c1
whereby packages with git origin URIs not hosted on GitHub would be wrongly
detected as being covered under the github updater.
Reported by Efraim Flashner <efraim@flashner.co.il>.
* guix/import/github.scm (updated-github-url): Check if git URIs are GitHub
URIs.
* guix/import/github.scm (updated-github-url): Return the unchanged source URI
for packages using git-fetch.
[updated-url]: Do not handle URIs which end with ".git".
* guix/import/github.scm (updated-github-url): Respond with the repository url
for the 'git-fetch' fetch method.
(github-package?): Simplify boolean expression.
(github-repository, github-user-slash-repository): Strip trailing ".git" from
project if present.
(latest-release)<origin-github-uri>: Recognize a 'git-reference'.
* guix/import/cran.scm (fetch-description): Return #F on failure.
(cran->guix-package): Retry from CRAN on failure to fetch description from
bioconductor.
* guix/import/hackage.scm (hackage-module->sexp): Do not repeat inputs again
in native-inputs. native-inputs should only contain packages that are not
already listed in inputs.