The 'memoize' binding was re-exported in 2016, commit
19e1d5f7f9, as a backwards-compatibility
measure that makes little sense now.
* guix/utils.scm: Don't re-export 'memoize'.
* guix/import/pypi.scm: Adjust imports.
* tests/pypi.scm: Remove duplicate (guix memoization) import.
* guix/import/pypi.scm (non-empty-string-or-false): New procedure.
(<pypi-project>, <project-info>, <distribution>): New record types.
(pypi-fetch): Call 'json->pypi-project'.
(latest-source-release, latest-wheel-release): Use the new record
accessors instead of 'assoc-ref*'.
(pypi->guix-package, latest-release): Likewise.
* tests/pypi.scm (test-json): Add mandatory fields.
* 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.
The output of tar when creating archives for the purpose of tests is not
useful, so we mute it.
* tests/pypi.scm ("pypi->guix-package"): Mute the output of tar.
("pypi->guix-package, wheels"): Likewise.
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.
This is a followup to d1e7ca2df8.
* tests/pypi.scm ("pypi->guix-package")
("pypi->guix-package, wheels"): Expect (pypi-uri "foo" version) for the
'uri' field.
This is a followup to commit 81e0bc1834.
* tests/cpan.scm ("cpan->guix-package"): Add a 'rest' argument to the
lambda that mocks 'http-fetch'.
* tests/crate.scm ("crate->guix-package"): Likewise.
* tests/gem.scm ("gem->guix-package"): Likewise.
* tests/pypi.scm ("pypi->guix-package"): Likewise.
("pypi->guix-package, wheels"): Likewise.
Fixes <https://bugs.gnu.org/25635>.
Reported by Sergei Trofimovich <slyfox@inbox.ru>.
* guix/import/pypi.scm (guix-package->pypi-name)[url->pypi-name]: New
procedure.
Rewrite body to match lists in addition to strings.
* tests/pypi.scm ("guix-package->pypi-name, several URLs"): New test.
This is a followup to 2f977d92d3.
* tests/pypi.scm ("pypi->guix-package"): Don't expect 'python-setuptools' in
'propagated-inputs'.
("pypi->guix-package, wheels"): Likewise.
Signed-off-by: Ludovic Courtès <ludo@gnu.org>
This is a follow-up to commit 63773200d7.
* tests/gem.scm ("gem->guix-package"): Replace mock definition of
"url-fetch" with "http-fetch".
* tests/pypi.scm ("pypi->guix-package"): Add mock definition of
"http-fetch".
This is a followup to b5c347ad3d.
* tests/pypi.scm ("pypi->guix-package"): Expect 'propagated-inputs', not
'inputs'.
("pypi->guix-package, wheels"): Likewise.
Fixes <http://bugs.gnu.org/23997>.
* guix/import/pypi.scm (guix-package->pypi-name): Rewrite using
'basename' and 'hyphen-package-name->name+version'.
* tests/pypi.scm ("guix-package->pypi-name, old URL style")
("guix-package->pypi-name, new URL style"): New tests.
* doc/guix.tex (Invoking guix import): Mention that the pypi importer
works better with "unzip".
* guix/import/pypi.scm (latest-wheel-release,
wheel-url->extracted-directory): New procedures.
* tests/pypi.scm (("pypi->guix-package, wheels"): New test.
Before that '.log' files for scheme tests were fragmented and not
included in test-suite.log. This unifies the semantics of SRFI-64 API
with Automake test suite.
* build-aux/test-driver.scm: New file.
* Makefile.am (SCM_LOG_DRIVER, AM_SCM_LOG_DRIVER_FLAGS): New variables.
(SCM_LOG_COMPILER, AM_SCM_LOG_FLAGS): Delete variables.
(AM_TESTS_ENVIRONMENT): Set GUILE_AUTO_COMPILE to 0.
* test-env.in: Silence guix-daemon.
* doc/guix.texi (Running the Test Suite): Describe how to display the
detailed results. Bug reports require only 'test-suite.log' file.
* tests/base32.scm, tests/build-utils.scm, tests/builders.scm,
tests/challenge.scm, tests/cpan.scm, tests/cpio.scm, tests/cran.scm,
tests/cve.scm, tests/derivations.scm, tests/elpa.scm,
tests/file-systems.scm, tests/gem.scm, tests/gexp.scm,
tests/gnu-maintenance.scm, tests/grafts.scm, tests/graph.scm,
tests/gremlin.scm, tests/hackage.scm, tests/hash.scm,
tests/import-utils.scm, tests/lint.scm, tests/monads.scm, tests/nar.scm,
tests/packages.scm, tests/pk-crypto.scm, tests/pki.scm,
tests/profiles.scm, tests/publish.scm, tests/pypi.scm,
tests/records.scm, tests/scripts-build.scm, tests/scripts.scm,
tests/services.scm, tests/sets.scm, tests/size.scm, tests/snix.scm,
tests/store.scm, tests/substitute.scm, tests/syscalls.scm,
tests/system.scm, tests/ui.scm, tests/union.scm, tests/upstream.scm,
tests/utils.scm: Don't exit at the end of test groups.
* tests/containers.scm: Likewise. Use 'test-skip' instead of exiting
with error code 77.
Fixes <http://bugs.gnu.org/23062>.
Reported by Danny Milosavljevic <dannym@scratchpost.org>.
* guix/import/pypi.scm (make-pypi-sexp): Check whether 'pypi-uri'
returns SOURCE-URL and fall back to the full URL otherwise.
* tests/pypi.scm ("pypi->guix-package"): Adjust expected URI
accordingly.
Co-authored-by: Danny Milosavljevic <dannym@scratchpost.org>
* guix/import/pypi.scm (python->package-name, maybe-inputs, compute-inputs,
guess-requirements): New procedures.
* guix/import/pypi.scm (guix-hash-url): Now takes a filename instead of an
URL as input.
* guix/import/pypi.scm (make-pypi-sexp): Now tries to generate the inputs
automagically.
* tests/pypi.scm: Update the test.
* guix/snix.scm: Delete.
* guix/import/snix.scm: New file.
* guix/import/pypi.scm: New file.
* guix/import/utils.scm: New file.
* guix/scripts/import/nix.scm: New file.
* guix/scripts/import/pypi.scm: New file.
* tests/pypi.scm: New file.
* tests/snix.scm: Import (guix import snix) module.
* guix/scripts/import.scm (%default-options, %options): Delete.
(%standard-import-options, importers): New variables.
(show-help): List importers.
(guix-import): Factor out Nix-specific logic. Delegate to correct importer
based upon first argument.
* configure.ac (HAVE_GUILE_JSON): New conditional.
* Makefile.am (MODULES): Add new files and remove 'guix/snix.scm'.
(SCM_TESTS): Add 'tests/pypi.scm' if guile-json is installed.