unofficial mirror of guix-devel@gnu.org 
 help / color / mirror / code / Atom feed
* [PATCH] guix pypi importer: Add ending as an optional argument to pypi-uri.
@ 2016-01-03 21:36 swedebugia
  2016-01-03 21:53 ` swedebugia
                   ` (2 more replies)
  0 siblings, 3 replies; 6+ messages in thread
From: swedebugia @ 2016-01-03 21:36 UTC (permalink / raw)
  To: guix-devel

---
 guix/build-system/python.scm | 17 ++++++++++++-----
 1 file changed, 12 insertions(+), 5 deletions(-)

diff --git a/guix/build-system/python.scm b/guix/build-system/python.scm
index 2532210..09074ce 100644
--- a/guix/build-system/python.scm
+++ b/guix/build-system/python.scm
@@ -41,13 +41,20 @@
 ;;
 ;; Code:
 
-(define (pypi-uri name version)
+(define* (pypi-uri name version
+                  #:optional
+                  ending)
   "Return a URI string for the Python package hosted on the Python Package
-Index (PyPI) corresponding to NAME and VERSION."
-  (string-append "https://pypi.python.org/packages/source/"
+Index (PyPI) corresponding to NAME, VERSION and optionally ENDING."
+  (when (null? ending)
+      (string-append "https://pypi.python.org/packages/source/"
                  (string-take name 1) "/" name "/"
-                 name "-" version ".tar.gz"))
-
+                 name "-" version ".tar.gz")
+  ;; Ending is set -> use it.
+      (string-append "https://pypi.python.org/packages/source/"
+                 (string-take name 1) "/" name "/"
+                 name "-" version "." ending)))
+   
 (define %python-build-system-modules
   ;; Build-side modules imported by default.
   `((guix build python-build-system)
-- 
2.6.3

^ permalink raw reply related	[flat|nested] 6+ messages in thread

* Re: [PATCH] guix pypi importer: Add ending as an optional argument to pypi-uri.
  2016-01-03 21:36 [PATCH] guix pypi importer: Add ending as an optional argument to pypi-uri swedebugia
@ 2016-01-03 21:53 ` swedebugia
  2016-01-05  0:53 ` Cyril Roelandt
  2016-01-08 18:14 ` Ludovic Courtès
  2 siblings, 0 replies; 6+ messages in thread
From: swedebugia @ 2016-01-03 21:53 UTC (permalink / raw)
  To: guix-devel; +Cc: guix-devel-bounces+swedebugia=riseup.net

On 2016-01-03 22:36, swedebugia wrote:
> ---
>  guix/build-system/python.scm | 17 ++++++++++++-----
>  1 file changed, 12 insertions(+), 5 deletions(-)
> 
> diff --git a/guix/build-system/python.scm 
> b/guix/build-system/python.scm
> index 2532210..09074ce 100644
> --- a/guix/build-system/python.scm
> +++ b/guix/build-system/python.scm
> @@ -41,13 +41,20 @@
>  ;;
>  ;; Code:
> 
> -(define (pypi-uri name version)
> +(define* (pypi-uri name version
> +                  #:optional
> +                  ending)
>    "Return a URI string for the Python package hosted on the Python 
> Package
> -Index (PyPI) corresponding to NAME and VERSION."
> -  (string-append "https://pypi.python.org/packages/source/"
> +Index (PyPI) corresponding to NAME, VERSION and optionally ENDING."
> +  (when (null? ending)
> +      (string-append "https://pypi.python.org/packages/source/"
>                   (string-take name 1) "/" name "/"
> -                 name "-" version ".tar.gz"))
> -
> +                 name "-" version ".tar.gz")
> +  ;; Ending is set -> use it.
> +      (string-append "https://pypi.python.org/packages/source/"
> +                 (string-take name 1) "/" name "/"
> +                 name "-" version "." ending)))
> +
>  (define %python-build-system-modules
>    ;; Build-side modules imported by default.
>    `((guix build python-build-system)

Was this an acceptable output of git send-email?
I have yet to test this patch, but it compiled fine.

Those interested can test the code with this unfinished package-def:

(define-public python-twisted
(package
   (name "python-twisted")
   (version "15.5.0")
   (source
     (origin
       (method url-fetch)
       (ending "tar.bz2")
       (uri (pypi-uri "Twisted" version ending))
       (sha256
         (base32
          "0zy18lcrris4aaslil5k12i13k56c32hzfdv6h10kbnzl026h158")
         ))
   (build-system python-build-system)
   (inputs
     `(("python-setuptools" ,python-setuptools)))
   (home-page "http://twistedmatrix.com/")
   (synopsis
     "Asynchronous networking framework written in Python")
   (description
     "Asynchronous networking framework written in Python which 
implements a
wide range of popular network protocols.")
   (license license:expat))))

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH] guix pypi importer: Add ending as an optional argument to pypi-uri.
  2016-01-03 21:36 [PATCH] guix pypi importer: Add ending as an optional argument to pypi-uri swedebugia
  2016-01-03 21:53 ` swedebugia
@ 2016-01-05  0:53 ` Cyril Roelandt
  2016-01-05  9:58   ` Efraim Flashner
  2016-01-08 18:14 ` Ludovic Courtès
  2 siblings, 1 reply; 6+ messages in thread
From: Cyril Roelandt @ 2016-01-05  0:53 UTC (permalink / raw)
  To: guix-devel

On 01/03/2016 10:36 PM, swedebugia wrote:
> ---
>  guix/build-system/python.scm | 17 ++++++++++++-----
>  1 file changed, 12 insertions(+), 5 deletions(-)
> 
> diff --git a/guix/build-system/python.scm b/guix/build-system/python.scm
> index 2532210..09074ce 100644
> --- a/guix/build-system/python.scm
> +++ b/guix/build-system/python.scm
> @@ -41,13 +41,20 @@
>  ;;
>  ;; Code:
>  
> -(define (pypi-uri name version)
> +(define* (pypi-uri name version
> +                  #:optional
> +                  ending)

Could we use "tar.gz" as the default value of ENDING as to avoid the
need for a test in this function?

Also, it would be nice to update the pypi importer as well, so that it
detects the right suffix.

I also think "ending" should be renamed to "extension" or something like
that.

WDYT?

Cyril.

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH] guix pypi importer: Add ending as an optional argument to pypi-uri.
  2016-01-05  0:53 ` Cyril Roelandt
@ 2016-01-05  9:58   ` Efraim Flashner
  2016-01-05 10:23     ` Cyril Roelandt
  0 siblings, 1 reply; 6+ messages in thread
From: Efraim Flashner @ 2016-01-05  9:58 UTC (permalink / raw)
  To: Cyril Roelandt; +Cc: guix-devel

[-- Attachment #1: Type: text/plain, Size: 1375 bytes --]

On Tue, 5 Jan 2016 01:53:40 +0100
Cyril Roelandt <tipecaml@gmail.com> wrote:

> On 01/03/2016 10:36 PM, swedebugia wrote:
> > ---
> >  guix/build-system/python.scm | 17 ++++++++++++-----
> >  1 file changed, 12 insertions(+), 5 deletions(-)
> > 
> > diff --git a/guix/build-system/python.scm b/guix/build-system/python.scm
> > index 2532210..09074ce 100644
> > --- a/guix/build-system/python.scm
> > +++ b/guix/build-system/python.scm
> > @@ -41,13 +41,20 @@
> >  ;;
> >  ;; Code:
> >  
> > -(define (pypi-uri name version)
> > +(define* (pypi-uri name version
> > +                  #:optional
> > +                  ending)  
> 
> Could we use "tar.gz" as the default value of ENDING as to avoid the
> need for a test in this function?
> 
It already does that with the patch  If there's no change then it defaults to .tar.gz. Could part of the patch be changed to:
#:optional (ending ".tar.gz")) ?

> Also, it would be nice to update the pypi importer as well, so that it
> detects the right suffix.
> 
> I also think "ending" should be renamed to "extension" or something like
> that.
> 
> WDYT?
> 

I like extension too.

-- 
Efraim Flashner   <efraim@flashner.co.il>   אפרים פלשנר
GPG key = A28B F40C 3E55 1372 662D  14F7 41AA E7DC CA3D 8351
Confidentiality cannot be guaranteed on emails sent or received unencrypted

[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 819 bytes --]

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH] guix pypi importer: Add ending as an optional argument to pypi-uri.
  2016-01-05  9:58   ` Efraim Flashner
@ 2016-01-05 10:23     ` Cyril Roelandt
  0 siblings, 0 replies; 6+ messages in thread
From: Cyril Roelandt @ 2016-01-05 10:23 UTC (permalink / raw)
  To: Efraim Flashner; +Cc: guix-devel

On 01/05/2016 10:58 AM, Efraim Flashner wrote:
> It already does that with the patch  If there's no change then it defaults to .tar.gz. Could part of the patch be changed to:
> #:optional (ending ".tar.gz")) ?
That is what I meant. This way we would not need the "(when ..." and
could keep this function simple.

Cyril.

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH] guix pypi importer: Add ending as an optional argument to pypi-uri.
  2016-01-03 21:36 [PATCH] guix pypi importer: Add ending as an optional argument to pypi-uri swedebugia
  2016-01-03 21:53 ` swedebugia
  2016-01-05  0:53 ` Cyril Roelandt
@ 2016-01-08 18:14 ` Ludovic Courtès
  2 siblings, 0 replies; 6+ messages in thread
From: Ludovic Courtès @ 2016-01-08 18:14 UTC (permalink / raw)
  To: swedebugia; +Cc: guix-devel

I’ve pushed commit 17ad0a2, which does what you want but using an
optional parameter as discussed by Cyril and Efraim.

Thanks,
Ludo’.

^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2016-01-08 18:14 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-01-03 21:36 [PATCH] guix pypi importer: Add ending as an optional argument to pypi-uri swedebugia
2016-01-03 21:53 ` swedebugia
2016-01-05  0:53 ` Cyril Roelandt
2016-01-05  9:58   ` Efraim Flashner
2016-01-05 10:23     ` Cyril Roelandt
2016-01-08 18:14 ` Ludovic Courtès

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).