all messages for Guix-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Danny Milosavljevic <dannym@scratchpost.org>
To: "Ludovic Courtès" <ludo@gnu.org>
Cc: guix-devel@gnu.org, Nils Gillmann <niasterisk@grrlz.net>
Subject: Re: guix import pypi uwsgi
Date: Sat, 19 Mar 2016 22:19:37 +0100	[thread overview]
Message-ID: <20160319221937.08ebd086@scratchpost.org> (raw)
In-Reply-To: <87egb6gp9u.fsf@gnu.org>

Hi,

On Sat, 19 Mar 2016 21:56:45 +0100
ludo@gnu.org (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.

  reply	other threads:[~2016-03-19 21:19 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-03-18 19:01 guix import pypi uwsgi Danny Milosavljevic
2016-03-18 20:32 ` Nils Gillmann
2016-03-19 12:37   ` Danny Milosavljevic
2016-03-19 14:13     ` Nils Gillmann
2016-03-19 20:56     ` Ludovic Courtès
2016-03-19 21:19       ` Danny Milosavljevic [this message]
2016-03-20  0:09         ` Ludovic Courtès

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20160319221937.08ebd086@scratchpost.org \
    --to=dannym@scratchpost.org \
    --cc=guix-devel@gnu.org \
    --cc=ludo@gnu.org \
    --cc=niasterisk@grrlz.net \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/guix.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.