Commit Graph

27 Commits (master)

Author SHA1 Message Date
Maxim Cournoyer d514276b93
import: pypi: Include optional test inputs as native-inputs.
* 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.
2019-07-02 10:08:00 +09:00
Maxim Cournoyer f0190a5dcd
import: pypi: Parse wheel METADATA instead of metadata.json.
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.
2019-07-02 10:08:00 +09:00
Maxim Cournoyer c799ad7276
import: pypi: Support more types of archives.
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.
2019-07-02 10:07:59 +09:00
Maxim Cournoyer 803fb336d6
import: pypi: Improve parsing of requirement specifications.
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.
2019-07-02 10:07:59 +09:00
Maxim Cournoyer c4797121be
import: pypi: Do not parse optional requirements from source.
* 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.
2019-07-02 10:07:59 +09:00
Maxim Cournoyer a853acebe1
tests: pypi: Mute the output of tar.
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.
2019-07-02 10:07:59 +09:00
Maxim Cournoyer 01589acc5e
import: pypi: Do not consider requirements.txt files.
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.
2019-07-02 10:07:59 +09:00
Leo Famulari 7277d06d8b
gnu: Use pypi.org.
<pypi.io> redirects to <pypi.org>.

* guix/build-system/python.scm (pypi-uri): Replace pypi.io with pypi.org.
* guix/import/pypi.scm (pypi-url?): Likewise.
* tests/pypi.scm: Likewise.
2018-10-18 23:46:33 -04:00
Ludovic Courtès ca71942445
Switch to Guile-Gcrypt.
This removes (guix hash) and (guix pk-crypto), which now live as part of
Guile-Gcrypt (version 0.1.0.)

* guix/gcrypt.scm, guix/hash.scm, guix/pk-crypto.scm,
tests/hash.scm, tests/pk-crypto.scm: Remove.
* configure.ac: Test for Guile-Gcrypt.  Remove LIBGCRYPT and
LIBGCRYPT_LIBDIR assignments.
* m4/guix.m4 (GUIX_ASSERT_LIBGCRYPT_USABLE): Remove.
* README: Add Guile-Gcrypt to the dependencies; move libgcrypt as
"required unless --disable-daemon".
* doc/guix.texi (Requirements): Likewise.
* gnu/packages/bash.scm, guix/derivations.scm, guix/docker.scm,
guix/git.scm, guix/http-client.scm, guix/import/cpan.scm,
guix/import/cran.scm, guix/import/crate.scm, guix/import/elpa.scm,
guix/import/gnu.scm, guix/import/hackage.scm,
guix/import/texlive.scm, guix/import/utils.scm, guix/nar.scm,
guix/pki.scm, guix/scripts/archive.scm,
guix/scripts/authenticate.scm, guix/scripts/download.scm,
guix/scripts/hash.scm, guix/scripts/pack.scm,
guix/scripts/publish.scm, guix/scripts/refresh.scm,
guix/scripts/substitute.scm, guix/store.scm,
guix/store/deduplication.scm, guix/tests.scm, tests/base32.scm,
tests/builders.scm, tests/challenge.scm, tests/cpan.scm,
tests/crate.scm, tests/derivations.scm, tests/gem.scm,
tests/nar.scm, tests/opam.scm, tests/pki.scm,
tests/publish.scm, tests/pypi.scm, tests/store-deduplication.scm,
tests/store.scm, tests/substitute.scm: Adjust imports.
* gnu/system/vm.scm: Likewise.
(guile-sqlite3&co): Rename to...
(gcrypt-sqlite3&co): ... this.  Add GUILE-GCRYPT.
(expression->derivation-in-linux-vm)[config]: Remove.
(iso9660-image)[config]: Remove.
(qemu-image)[config]: Remove.
(system-docker-image)[config]: Remove.
* guix/scripts/pack.scm: Adjust imports.
(guile-sqlite3&co): Rename to...
(gcrypt-sqlite3&co): ... this.  Add GUILE-GCRYPT.
(self-contained-tarball)[build]: Call 'make-config.scm' without
 #:libgcrypt argument.
(squashfs-image)[libgcrypt]: Remove.
[build]: Call 'make-config.scm' without #:libgcrypt.
(docker-image)[config, json]: Remove.
[build]: Add GUILE-GCRYPT to the extensions  Remove (guix config) from
the imported modules.
* guix/self.scm (specification->package): Remove "libgcrypt", add
"guile-gcrypt".
(compiled-guix): Remove #:libgcrypt.
[guile-gcrypt]: New variable.
[dependencies]: Add it.
[*core-modules*]: Remove #:libgcrypt from 'make-config.scm' call.
Add #:extensions.
[*config*]: Remove #:libgcrypt from 'make-config.scm' call.
(%dependency-variables): Remove %libgcrypt.
(make-config.scm): Remove #:libgcrypt.
* build-aux/build-self.scm (guile-gcrypt): New variable.
(make-config.scm): Remove #:libgcrypt.
(build-program)[fake-gcrypt-hash]: New variable.
Add (gcrypt hash) to the imported modules.  Adjust load path
assignments.
* gnu/packages/package-management.scm (guix)[propagated-inputs]: Add
GUILE-GCRYPT.
[arguments]: In 'wrap-program' phase, add GUILE-GCRYPT to the search
path.
2018-09-04 17:25:11 +02:00
Marius Bakke 8440db459a
import: PyPI: Update redirected URL.
* guix/import/pypi.scm (guix-package->pypi-name, pypi->guix-package): Update
docstrings.
(pypi-package?): Test for pypi.org, too.
(pypi-fetch): s/pypi.python.org/pypi.org/
* tests/pypi.scm ("guix-package->pypi-name, new URL style",
"pypi->guix-package", "pypi->guix-package, wheels"): Likewise.
2018-07-24 17:42:04 +02:00
Ludovic Courtès b3d8153d39
import: pypi: Adjust URIs in tests.
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.
2017-06-18 00:14:07 +02:00
Ludovic Courtès ce8963c5b7
tests: Adjust for 'http-fetch' change in (guix import json).
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.
2017-02-13 16:04:09 +01:00
Ludovic Courtès 4eaac4b722
import: pypi: Correctly handle multiple-URL origins.
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.
2017-02-08 16:17:05 +01:00
Carlo Zancanaro b45dbfc990
tests: Adjust pypi test to recent importer change.
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>
2017-01-28 00:38:20 +01:00
Ricardo Wurmus 239f46325d
tests: Mock up http-fetch in import test.
This is a follow-up to commit 63773200d7.

* tests/pypi.scm ("pypi->guix-package, wheels"): Add mock definition of
"http-fetch".
2016-12-18 10:54:11 +01:00
Ricardo Wurmus 506abddb99
tests: Mock up http-fetch in import tests.
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".
2016-12-18 09:55:17 +01:00
Ludovic Courtès d6aca5835a
tests: Adjust pypi test to recent importer change.
This is a followup to b5c347ad3d.

* tests/pypi.scm ("pypi->guix-package"): Expect 'propagated-inputs', not
'inputs'.
("pypi->guix-package, wheels"): Likewise.
2016-10-27 01:00:41 +02:00
David Craven a34b236c17
import: Importers return prefixed licenses.
* guix/import/utils.scm
(define-module): Import licenses with license: prefix.
(string->licenses): Use prefixed licenses.
(license->symbol): Return symbols with the prefix license:.
* guix/tests/pypi.scm (pypi->guix-package): Update test cases.
* guix/tests/gem.scm (gem->guix-package): Update test case.
2016-08-28 14:04:50 +02:00
Ludovic Courtès 8173ceee1f
import: pypi: Correctly handle new-style URLs.
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.
2016-07-26 17:49:34 +02:00
Cyril Roelandt 266785d21e import: pypi: read requirements from wheels.
* 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.
2016-06-14 22:03:22 +02:00
Mathieu Lirzin a9edb211e7 build: Add a Guile custom test driver using SRFI-64.
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.
2016-04-03 14:19:09 +02:00
Ludovic Courtès 522773b700 import: pypi: Emit 'pypi-uri' only when it yields the right URL.
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>
2016-03-19 23:54:19 +01:00
Cyril Roelandt d8bdd38201 import: pypi: Use "pypi-uri" instead of building the URL manually.
* guix/import/pypi.scm (make-pypi-sexp): Use "pypi-uri".
* tests/pypi.scm: Update the tests accordingly.
2015-11-03 21:38:13 +01:00
Cyril Roelandt ff986890ec import: pypi: Detect inputs.
* 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.
2015-06-24 22:47:59 +02:00
Eric Bavier 694b317c2d tests: import: Factorize utility function.
* tests/pypi.scm (mock): Move this...
* guix/tests.scm: to here.
2015-01-09 10:38:25 -06:00
Eric Bavier 1ff2619bc1 import: Factorize utility functions.
* guix/import/pypi.scm (hash-table->alist, flatten, assoc-ref*,
  url-fetch, json-fetch): Pull procedures from here into...
* guix/import/utils.scm: Here and...
* guix/import/json.scm: Here.  New file.
* Makefile.am (MODULE)[HAVE_GUILE_JSON]: Add it.
* guix/import/gnu.scm (file-sha256): Move from here to...
* guix/hash.scm: Here.
* tests/pypi.scm (pypi->guix-package): Update mock module reference.
2015-01-09 10:33:24 -06:00
David Thompson 1b3e968512 import: Add PyPI importer.
* 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.
2014-09-29 19:30:28 -04:00