From: ludo@gnu.org (Ludovic Courtès)
To: Cyril Roelandt <tipecaml@gmail.com>
Cc: guix-devel@gnu.org
Subject: Re: [PATCH] import: pypi: Detect inputs.
Date: Sun, 07 Jun 2015 22:03:34 +0200 [thread overview]
Message-ID: <87d217uvzd.fsf@gnu.org> (raw)
In-Reply-To: <1433458614-4189-1-git-send-email-tipecaml@gmail.com> (Cyril Roelandt's message of "Fri, 5 Jun 2015 00:56:54 +0200")
Cyril Roelandt <tipecaml@gmail.com> skribis:
> * guix/import/pypi.scm (compute-inputs, guess-requirements): New procedures.
Nice!
Please mention the ‘guix-hash-url’, ‘make-pypi-sexp’,
‘python->package-name’, etc. changes and the tests.
> +(define (maybe-inputs python->package-name inputs)
> + (match inputs
> + (()
> + '())
> + ((inputs ...)
> + `((,python->package-name (,'quasiquote ,inputs))))))
Please add a docstring. The first argument is misnamed: There’s only on
call site and its value is 'inputs, so I think you should remove this
argument.
> +(define (guess-requirements source-url tarball)
> + "Given SOURCE-URL and a TARBALL of the package, return a list of the required
> +packages specified in the requirements.txt file."
Perhaps this should mention that TARBALL is extracted in the current
directory.
> + (define (tarball-directory url)
> + "Given the URL of the package's tarball, return the name of the directory
> +that will be created upon decompressing it."
Use comments instead of docstrings for internal procedures. Also
mention the #f return value.
> + (let ((basename (substring url (+ 1 (string-rindex url #\/)))))
> + (cond
The opening paren should be under the ‘e’ of ‘let’.
> + ((string-suffix? ".tar.gz" basename)
> + (string-drop-right basename 7))
> + ((string-suffix? ".tar.bz2" basename)
> + (string-drop-right basename 8))
> + (else #f))))
Would be nice to emit a warning like “unsupported archive format; cannot
determine package dependencies” in the #f case.
> + (if (zero? (system* "tar" "xf" tarball req-file))
> + (dynamic-wind
> + (const #t)
> + (lambda ()
> + (read-requirements req-file))
> + (lambda ()
> + (delete-file req-file)
> + (rmdir dirname)))
> + '()))
When ‘tar’ exits with non-zero, it would be nice to report the failure
and exit value using ‘warning’ from (guix ui).
> + ,@(maybe-inputs 'inputs
> + (compute-inputs source-url temp))
Second line should be aligned with 'inputs.
> + (match url
> + ("https://pypi.python.org/pypi/foo/json"
> + (with-output-to-file file-name
> + (lambda ()
> + (display test-json))))
> + ("https://example.com/foo-1.0.0.tar.gz"
> + (begin
> + (mkdir "foo-1.0.0")
> + (with-output-to-file "foo-1.0.0/requirements.txt"
> + (lambda ()
> + (display test-requirements)))
> + (system* "tar" "czvf" file-name "foo-1.0.0/")
> + (system* "rm" "-rf" "foo-1.0.0")
Use ‘delete-file-recursively’ here.
Could you send an updated patch?
Thank you!
Ludo’.
next prev parent reply other threads:[~2015-06-07 20:03 UTC|newest]
Thread overview: 18+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-03-07 23:51 [PATCH] import: pypi: detect requirements from requirements.txt Cyril Roelandt
2015-03-08 0:41 ` David Thompson
2015-03-22 21:05 ` [PATCH] import: pypi: Detect inputs Cyril Roelandt
2015-03-26 13:15 ` Ludovic Courtès
2015-03-27 12:36 ` David Thompson
2015-03-29 13:46 ` Ludovic Courtès
2015-06-04 22:56 ` Cyril Roelandt
2015-06-07 20:03 ` Ludovic Courtès [this message]
2015-06-15 1:25 ` Cyril Roelandt
2015-06-18 10:45 ` Amirouche Boubekki
2015-06-19 15:32 ` Christopher Allan Webber
2015-06-20 18:01 ` Amirouche Boubekki
2015-06-21 20:56 ` Ludovic Courtès
2015-06-21 21:32 ` Amirouche Boubekki
2015-06-23 21:04 ` Cyril Roelandt
2015-06-24 19:49 ` Ludovic Courtès
2015-06-24 21:42 ` Cyril Roelandt
2015-03-22 21:05 ` [PATCH] import: pypi: detect requirements from requirements.txt Cyril Roelandt
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
List information: https://guix.gnu.org/
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=87d217uvzd.fsf@gnu.org \
--to=ludo@gnu.org \
--cc=guix-devel@gnu.org \
--cc=tipecaml@gmail.com \
/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 public inbox
https://git.savannah.gnu.org/cgit/guix.git
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).