Re: [PATCH] guix pypi importer: Add ending as an optional argument to pypi-uri.

2016-01-08 Thread Ludovic Courtès
I’ve pushed commit 17ad0a2, which does what you want but using an
optional parameter as discussed by Cyril and Efraim.

Thanks,
Ludo’.



Re: [PATCH] guix pypi importer: Add ending as an optional argument to pypi-uri.

2016-01-05 Thread Cyril Roelandt
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.



Re: [PATCH] guix pypi importer: Add ending as an optional argument to pypi-uri.

2016-01-05 Thread Efraim Flashner
On Tue, 5 Jan 2016 01:53:40 +0100
Cyril Roelandt  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      אפרים פלשנר
GPG key = A28B F40C 3E55 1372 662D  14F7 41AA E7DC CA3D 8351
Confidentiality cannot be guaranteed on emails sent or received unencrypted


pgpBl6NjZAnz6.pgp
Description: OpenPGP digital signature


Re: [PATCH] guix pypi importer: Add ending as an optional argument to pypi-uri.

2016-01-04 Thread Cyril Roelandt
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.




Re: [PATCH] guix pypi importer: Add ending as an optional argument to pypi-uri.

2016-01-03 Thread swedebugia

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




[PATCH] guix pypi importer: Add ending as an optional argument to pypi-uri.

2016-01-03 Thread swedebugia
---
 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