[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: guix import pypi uwsgi
From: |
Danny Milosavljevic |
Subject: |
Re: guix import pypi uwsgi |
Date: |
Sat, 19 Mar 2016 22:19:37 +0100 |
Hi,
On Sat, 19 Mar 2016 21:56:45 +0100
address@hidden (Ludovic Courtès) wrote:
> So the bug is that ‘guix import’ should emit ‘pypi-uri’ calls if and
> only if the URL matches the usual pypi.python.org scheme, right?
Yes.
guix/import/pypi.scm's make-pypi-sexp even knows the source-url. But then in
the source origin it prints '(pypi-uri ,name....
It should only do that if pypi-uri can actually reproduce it, and otherwise use
string-append.
That would be easiest if it actually tried to call pypi-uri on its own and
checked whether its result is equal to the source-url.
guix/import/pypi.scm even already imports guix/build-system/python.scm and so
make-pypi-sexp could call pypi-uri. But it doesn't right now.
Something like this:
diff --git a/guix/import/pypi.scm b/guix/import/pypi.scm
index d54bb9f..6889f0e 100644
--- a/guix/import/pypi.scm
+++ b/guix/import/pypi.scm
@@ -194,7 +194,8 @@ VERSION, SOURCE-URL, HOME-PAGE, SYNOPSIS, DESCRIPTION, and
LICENSE."
(version ,version)
(source (origin
(method url-fetch)
- (uri (pypi-uri ,name version))
+ (uri ,(if (equal? (pypi-uri name version) source-url)
`(pypi-uri ,name version)
+
source-url))
(sha256
(base32
,(guix-hash-url temp)))))
Note that then, it hardcodes the version number. Note sure whether heuristics
to extract it from a random URL and repplace it by 'version would be reliable,
though.
With the patch, I get:
$ guix import pypi uwsgi
Starting download of /tmp/guix-file.NdDsTJ
From https://pypi.python.org/packages/source/u/uWSGI/uwsgi-2.0.12.tar.gz...
uwsgi-2.0.12.tar.gz 766KiB 594KiB/s 00:01 [####################] 100.0%
tar: uwsgi-2.0.12/requirements.txt: Not found in archive
tar: Exiting with failure status due to previous errors
guix import: warning: 'tar xf' failed with exit code 512
(package
(name "python-uwsgi")
(version "2.0.12")
(source
(origin
(method url-fetch)
(uri
"https://pypi.python.org/packages/source/u/uWSGI/uwsgi-2.0.12.tar.gz")
(sha256
(base32
"02g46dnw5j1iw8fsq392bxbk8d21b9pdgb3ypcinv3b4jzdm2srh"))))
(build-system python-build-system)
(inputs
`(("python-setuptools" ,python-setuptools)))
(home-page "UNKNOWN")
(synopsis "The uWSGI server")
(description "The uWSGI server")
(license #f))
$
For comparison, for a package where pypi-uri works, I get
$ guix import pypi waitress
;;; note: source file /home/dannym/src/guix/guix/import/pypi.scm
;;; newer than compiled /home/dannym/src/guix/guix/import/pypi.go
Starting download of /tmp/guix-file.4QDL89
From
https://pypi.python.org/packages/source/w/waitress/waitress-0.9.0b0.tar.gz...
waitress-0.9.0b0.tar.gz 125KiB 236KiB/s 00:01 [####################] 100.0%
tar: waitress-0.9.0b0/requirements.txt: Not found in archive
tar: Exiting with failure status due to previous errors
guix import: warning: 'tar xf' failed with exit code 512
(package
(name "python-waitress")
(version "0.9.0b0")
(source
(origin
(method url-fetch)
(uri (pypi-uri "waitress" version))
(sha256
(base32
"019584z449hc3j8q51jbvrp3wjxzzbshid2x2w8xk2xbg5inj151"))))
(build-system python-build-system)
(inputs
`(("python-setuptools" ,python-setuptools)))
(home-page "https://github.com/Pylons/waitress")
(synopsis "Waitress WSGI server")
(description "Waitress WSGI server")
(license #f))
$
Note non-hardcoded version.