From 8173ceee1f31ab562118ff5171254a4b73b71400 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ludovic=20Court=C3=A8s?= Date: Tue, 26 Jul 2016 17:49:34 +0200 Subject: import: pypi: Correctly handle new-style URLs. Fixes . * 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. --- tests/pypi.scm | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) (limited to 'tests/pypi.scm') diff --git a/tests/pypi.scm b/tests/pypi.scm index 379c288394..01d8a575ab 100644 --- a/tests/pypi.scm +++ b/tests/pypi.scm @@ -73,6 +73,22 @@ baz > 13.37") (test-begin "pypi") +(test-equal "guix-package->pypi-name, old URL style" + "psutil" + (guix-package->pypi-name + (dummy-package "foo" + (source (dummy-origin + (uri + "https://pypi.io/packages/source/p/psutil/psutil-4.3.0.tar.gz")))))) + +(test-equal "guix-package->pypi-name, new URL style" + "certbot" + (guix-package->pypi-name + (dummy-package "foo" + (source (dummy-origin + (uri + "https://pypi.python.org/packages/a2/3b/4756e6a0ceb14e084042a2a65c615d68d25621c6fd446d0fc10d14c4ce7d/certbot-0.8.1.tar.gz")))))) + (test-assert "pypi->guix-package" ;; Replace network resources with sample data. (mock ((guix import utils) url-fetch -- cgit v1.2.3