unofficial mirror of guix-devel@gnu.org 
 help / color / mirror / code / Atom feed
* Trying to fix an error in the pypi-importer
@ 2015-12-30 19:53 swedebugia
       [not found] ` <56844BF3.10701@uq.edu.au>
                   ` (2 more replies)
  0 siblings, 3 replies; 13+ messages in thread
From: swedebugia @ 2015-12-30 19:53 UTC (permalink / raw)
  To: guix-devel

Hi :)

I am trying to fix this error in the pypi-importer:

~/src/guix$ ./pre-inst-env guix lint python-twisted
gnu/packages/python.scm:6628:0: python-twisted-15.5.0: all the source 
URIs are unreachable:
gnu/packages/python.scm:6628:0: python-twisted-15.5.0: URI 
https://pypi.python.org/packages/source/T/Twisted/Twisted-15.5.0.tar.gz 
not reachable: 404 ("Not Found")
-> it should be .tar.bz2* but the pypi-importer hardcodes tar.gz in 
guix/build-system/python.scm:

(define (pypi-uri name version)
   "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/"
                  (string-take name 1) "/" name "/"
                  name "-" version ".tar.gz"))

I read up on if-else with Guile and changed it to:
(define (pypi-uri name version ending)
   "Return a URI string for the Python package hosted on the Python 
Package
Index (PyPI) corresponding to NAME and VERSION."
   (if (zero? ending)
       (string-append "https://pypi.python.org/packages/source/"
                  (string-take name 1) "/" name "/"
                  name "-" version ".tar.gz"))
   (else
       (string-append "https://pypi.python.org/packages/source/"
                  (string-take name 1) "/" name "/"
                  name "-" version "." ending )))

Will this work?
I did a make and got:
   GUILEC guix/build-system/python.go
guix/build-system/python.scm:51:2: warning: possibly unbound variable 
`else'
wrote `guix/build-system/python.go'

The goal was to change in a way that would not break all other calls to 
the procedure pypi-uri.

Any thoughts?

* see https://pypi.python.org/pypi/Twisted/json

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

* Re: Trying to fix an error in the pypi-importer
       [not found] ` <56844BF3.10701@uq.edu.au>
@ 2015-12-30 21:27   ` Ben Woodcroft
  0 siblings, 0 replies; 13+ messages in thread
From: Ben Woodcroft @ 2015-12-30 21:27 UTC (permalink / raw)
  To: swedebugia, guix-devel@gnu.org

Hi,

On 31/12/15 05:53, swedebugia@riseup.net wrote:
> Hi :)
>
> I am trying to fix this error in the pypi-importer:
[..]
>
> I read up on if-else with Guile and changed it to:
> (define (pypi-uri name version ending)
>   "Return a URI string for the Python package hosted on the Python 
> Package
> Index (PyPI) corresponding to NAME and VERSION."
>   (if (zero? ending)
>       (string-append "https://pypi.python.org/packages/source/"
>                  (string-take name 1) "/" name "/"
>                  name "-" version ".tar.gz"))
>   (else
>       (string-append "https://pypi.python.org/packages/source/"
>                  (string-take name 1) "/" name "/"
>                  name "-" version "." ending )))
You should just omit the (else and matching bracket to avoid the error.
>
> Will this work?
> I did a make and got:
>   GUILEC guix/build-system/python.go
> guix/build-system/python.scm:51:2: warning: possibly unbound variable 
> `else'
> wrote `guix/build-system/python.go'
For testing, there's no need to run make if you don't want, you can just 
run an the import and the new code will be used.

Seems like a good idea to me overall.

ben

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

* Re: Trying to fix an error in the pypi-importer
  2015-12-30 19:53 Trying to fix an error in the pypi-importer swedebugia
       [not found] ` <56844BF3.10701@uq.edu.au>
@ 2015-12-30 22:00 ` Cyril Roelandt
  2016-01-01 18:10   ` swedebugia
  2015-12-31 11:22 ` Efraim Flashner
  2 siblings, 1 reply; 13+ messages in thread
From: Cyril Roelandt @ 2015-12-30 22:00 UTC (permalink / raw)
  To: guix-devel

On 12/30/2015 08:53 PM, swedebugia@riseup.net wrote:
> I am trying to fix this error in the pypi-importer:

Could you send your fix as a unified diff? If you work from the git
repo, you can just run "git diff" to produce one.

Thanks,

Cyril.

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

* Re: Trying to fix an error in the pypi-importer
  2015-12-30 19:53 Trying to fix an error in the pypi-importer swedebugia
       [not found] ` <56844BF3.10701@uq.edu.au>
  2015-12-30 22:00 ` Cyril Roelandt
@ 2015-12-31 11:22 ` Efraim Flashner
  2016-01-01 18:15   ` swedebugia
  2 siblings, 1 reply; 13+ messages in thread
From: Efraim Flashner @ 2015-12-31 11:22 UTC (permalink / raw)
  To: swedebugia; +Cc: guix-devel

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

On Wed, 30 Dec 2015 20:53:47 +0100
swedebugia@riseup.net wrote:

> Hi :)
> 
> I am trying to fix this error in the pypi-importer:
> 
> ~/src/guix$ ./pre-inst-env guix lint python-twisted
> gnu/packages/python.scm:6628:0: python-twisted-15.5.0: all the source 
> URIs are unreachable:
> gnu/packages/python.scm:6628:0: python-twisted-15.5.0: URI 
> https://pypi.python.org/packages/source/T/Twisted/Twisted-15.5.0.tar.gz 
> not reachable: 404 ("Not Found")
>  [...]  
> guix/build-system/python.scm:
> 
> (define (pypi-uri name version)
>    "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/"
>                   (string-take name 1) "/" name "/"
>                   name "-" version ".tar.gz"))
> 
> I read up on if-else with Guile and changed it to:
> (define (pypi-uri name version ending)
>    "Return a URI string for the Python package hosted on the Python 
> Package
> Index (PyPI) corresponding to NAME and VERSION."
>    (if (zero? ending)
>        (string-append "https://pypi.python.org/packages/source/"
>                   (string-take name 1) "/" name "/"
>                   name "-" version ".tar.gz"))
>    (else
>        (string-append "https://pypi.python.org/packages/source/"
>                   (string-take name 1) "/" name "/"
>                   name "-" version "." ending )))
> 
> Will this work?
> I did a make and got:
>    GUILEC guix/build-system/python.go
> guix/build-system/python.scm:51:2: warning: possibly unbound variable 
> `else'
> wrote `guix/build-system/python.go'
> 
> The goal was to change in a way that would not break all other calls to 
> the procedure pypi-uri.
> 
> Any thoughts?
> 
> * see https://pypi.python.org/pypi/Twisted/json
> 


does this also take care of the ones that are stored as name "-" version ".zip"?

-- 
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] 13+ messages in thread

* Re: Trying to fix an error in the pypi-importer
  2015-12-30 22:00 ` Cyril Roelandt
@ 2016-01-01 18:10   ` swedebugia
  2016-01-02 17:10     ` swedebugia
  0 siblings, 1 reply; 13+ messages in thread
From: swedebugia @ 2016-01-01 18:10 UTC (permalink / raw)
  To: guix-devel

On 2015-12-30 23:00, Cyril Roelandt wrote:
> On 12/30/2015 08:53 PM, swedebugia@riseup.net wrote:
>> I am trying to fix this error in the pypi-importer:
> 
> Could you send your fix as a unified diff? If you work from the git
> repo, you can just run "git diff" to produce one.

diff --git a/guix/build-system/python.scm b/guix/build-system/python.scm
index 2532210..f9b88d2 100644
--- a/guix/build-system/python.scm
+++ b/guix/build-system/python.scm
@@ -41,13 +41,18 @@
  ;;
  ;; Code:

-(define (pypi-uri name version)
+(define (pypi-uri name version 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."
+  (if (zero? ending)
+      (string-append "https://pypi.python.org/packages/source/"
                   (string-take name 1) "/" name "/"
-                 name "-" version ".tar.gz"))
-
+                 name "-" version ".tar.gz")
+  ;else
+      (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)

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

* Re: Trying to fix an error in the pypi-importer
  2015-12-31 11:22 ` Efraim Flashner
@ 2016-01-01 18:15   ` swedebugia
  0 siblings, 0 replies; 13+ messages in thread
From: swedebugia @ 2016-01-01 18:15 UTC (permalink / raw)
  To: guix-devel

On 2015-12-31 12:22, Efraim Flashner wrote:
> does this also take care of the ones that are stored as name "-" 
> version ".zip"?

~/src/guix$ grep 'name "-" version ".zip"' gnu/packages/*
gnu/packages/avr.scm:              (file-name (string-append name "-" 
version ".zip"))))
grep: gnu/packages/bootstrap: Is a directory
grep: gnu/packages/patches: Is a directory

=> there is no one it seems?

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

* Re: Trying to fix an error in the pypi-importer
  2016-01-01 18:10   ` swedebugia
@ 2016-01-02 17:10     ` swedebugia
  2016-01-02 18:06       ` How to test changes to guix locally? (Was: Re: Trying to fix an error in the pypi-importer) swedebugia
                         ` (3 more replies)
  0 siblings, 4 replies; 13+ messages in thread
From: swedebugia @ 2016-01-02 17:10 UTC (permalink / raw)
  To: guix-devel; +Cc: guix-devel-bounces+swedebugia=riseup.net

On 2016-01-01 19:10, swedebugia@riseup.net wrote:
> On 2015-12-30 23:00, Cyril Roelandt wrote:
>> On 12/30/2015 08:53 PM, swedebugia@riseup.net wrote:
>>> I am trying to fix this error in the pypi-importer:
>> 
>> Could you send your fix as a unified diff? If you work from the git
>> repo, you can just run "git diff" to produce one.
> 
> diff --git a/guix/build-system/python.scm 
> b/guix/build-system/python.scm
> index 2532210..f9b88d2 100644
> --- a/guix/build-system/python.scm
> +++ b/guix/build-system/python.scm
> @@ -41,13 +41,18 @@
>  ;;
>  ;; Code:
> 
> -(define (pypi-uri name version)
> +(define (pypi-uri name version 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."
> +  (if (zero? ending)
> +      (string-append "https://pypi.python.org/packages/source/"
>                   (string-take name 1) "/" name "/"
> -                 name "-" version ".tar.gz"))
> -
> +                 name "-" version ".tar.gz")
> +  ;else
> +      (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)

During compilation after applying my patch above I get this error.

   GUILEC guix/build-system/python.go
ice-9/boot-9.scm:106:20: In procedure #<procedure 8bbb4e0 at 
ice-9/boot-9.scm:97:6 (thrown-k . args)>:
ice-9/boot-9.scm:106:20: In procedure scm_i_lreadparen: 
guix/build-system/python.scm:216:1: end of file
Makefile:4604: recipe for target 'guix/build-system/python.go' failed

So removing the (else -> to a comment and adjusting the parentheses did 
not work.

Could somebody point me to relevant documentation about how to write 
conditional statements in guile?

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

* How to test changes to guix locally? (Was: Re: Trying to fix an error in the pypi-importer)
  2016-01-02 17:10     ` swedebugia
@ 2016-01-02 18:06       ` swedebugia
  2016-01-02 18:58         ` Ricardo Wurmus
  2016-01-02 18:26       ` Trying to fix an error in the pypi-importer Erik Edrosa
                         ` (2 subsequent siblings)
  3 siblings, 1 reply; 13+ messages in thread
From: swedebugia @ 2016-01-02 18:06 UTC (permalink / raw)
  To: guix-devel; +Cc: guix-devel-bounces+swedebugia=riseup.net

On 2016-01-02 18:10, swedebugia@riseup.net wrote:
> So removing the (else -> to a comment and adjusting the parentheses
> did not work.
it did work with the right amount of parent.

> Could somebody point me to relevant documentation about how to write
> conditional statements in guile?

NWM  doc here http://www.delorie.com/gnu/docs/guile/guile-tut_8.html

found a bug in my code: zero? should be null? because ending is not set 
in most pack. def.

How do I best go about testing my changes to the build-system? make & 
./pre-inst-env guix ...? Somebody mentioned input but I did not 
understand that.

cheers

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

* Re: Trying to fix an error in the pypi-importer
  2016-01-02 17:10     ` swedebugia
  2016-01-02 18:06       ` How to test changes to guix locally? (Was: Re: Trying to fix an error in the pypi-importer) swedebugia
@ 2016-01-02 18:26       ` Erik Edrosa
  2016-01-03 14:09       ` Ludovic Courtès
  2016-01-03 18:47       ` Ricardo Wurmus
  3 siblings, 0 replies; 13+ messages in thread
From: Erik Edrosa @ 2016-01-02 18:26 UTC (permalink / raw)
  To: guix-devel

On 01/02/2016 12:10 PM, swedebugia@riseup.net wrote:
> On 2016-01-01 19:10, swedebugia@riseup.net wrote:
>> On 2015-12-30 23:00, Cyril Roelandt wrote:
>>> On 12/30/2015 08:53 PM, swedebugia@riseup.net wrote:
>>>> I am trying to fix this error in the pypi-importer:
>>>
>>> Could you send your fix as a unified diff? If you work from the git
>>> repo, you can just run "git diff" to produce one.
>>
>> diff --git a/guix/build-system/python.scm b/guix/build-system/python.scm
>> index 2532210..f9b88d2 100644
>> --- a/guix/build-system/python.scm
>> +++ b/guix/build-system/python.scm
>> @@ -41,13 +41,18 @@
>>  ;;
>>  ;; Code:
>>
>> -(define (pypi-uri name version)
>> +(define (pypi-uri name version 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."
>> +  (if (zero? ending)
>> +      (string-append "https://pypi.python.org/packages/source/"
>>                   (string-take name 1) "/" name "/"
>> -                 name "-" version ".tar.gz"))
>> -
>> +                 name "-" version ".tar.gz")
>> +  ;else
>> +      (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)
> 
> During compilation after applying my patch above I get this error.
> 
>   GUILEC guix/build-system/python.go
> ice-9/boot-9.scm:106:20: In procedure #<procedure 8bbb4e0 at
> ice-9/boot-9.scm:97:6 (thrown-k . args)>:
> ice-9/boot-9.scm:106:20: In procedure scm_i_lreadparen:
> guix/build-system/python.scm:216:1: end of file
> Makefile:4604: recipe for target 'guix/build-system/python.go' failed
> 
> So removing the (else -> to a comment and adjusting the parentheses did
> not work.
> 
> Could somebody point me to relevant documentation about how to write
> conditional statements in guile?
> 

Here is the conditionals in the guile manual
https://www.gnu.org/software/guile/manual/html_node/Conditionals.html#Conditionals

This might be a useful book on learning scheme
http://ds26gte.github.io/tyscheme/index.html

You might find more useful intro books to scheme at
http://schemers.org/Documents/#all-texts

Regarding the changes, I think the ending argument might be better as an
optional argument (see
https://www.gnu.org/software/guile/manual/html_node/lambda_002a-and-define_002a.html#lambda_002a-and-define_002a
about optional arguments) so packages with files ending in .tar.gz do
not need to be modified.

So a package can be (pypi-uri "foo" "1.0.0") or (pypi-uri "bar" "1.0.0"
".tar.bz2")

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

* Re: How to test changes to guix locally? (Was: Re: Trying to fix an error in the pypi-importer)
  2016-01-02 18:06       ` How to test changes to guix locally? (Was: Re: Trying to fix an error in the pypi-importer) swedebugia
@ 2016-01-02 18:58         ` Ricardo Wurmus
  0 siblings, 0 replies; 13+ messages in thread
From: Ricardo Wurmus @ 2016-01-02 18:58 UTC (permalink / raw)
  To: swedebugia; +Cc: guix-devel, guix-devel-bounces+swedebugia=riseup.net


swedebugia@riseup.net writes:

> How do I best go about testing my changes to the build-system? make & 
> ./pre-inst-env guix ...? Somebody mentioned input but I did not 
> understand that.

Yes, “./pre-inst-env” allows you to use the guix library in the current
directory.

Note that when you change a build system all packages that use this
build system would be rebuilt.  Changing the importer has no such
effect.

~~ Ricardo

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

* Re: Trying to fix an error in the pypi-importer
  2016-01-02 17:10     ` swedebugia
  2016-01-02 18:06       ` How to test changes to guix locally? (Was: Re: Trying to fix an error in the pypi-importer) swedebugia
  2016-01-02 18:26       ` Trying to fix an error in the pypi-importer Erik Edrosa
@ 2016-01-03 14:09       ` Ludovic Courtès
  2016-01-03 16:29         ` swedebugia
  2016-01-03 18:47       ` Ricardo Wurmus
  3 siblings, 1 reply; 13+ messages in thread
From: Ludovic Courtès @ 2016-01-03 14:09 UTC (permalink / raw)
  To: swedebugia; +Cc: guix-devel

swedebugia@riseup.net skribis:

> During compilation after applying my patch above I get this error.
>
>   GUILEC guix/build-system/python.go
> ice-9/boot-9.scm:106:20: In procedure #<procedure 8bbb4e0 at
> ice-9/boot-9.scm:97:6 (thrown-k . args)>:
> ice-9/boot-9.scm:106:20: In procedure scm_i_lreadparen:
> guix/build-system/python.scm:216:1: end of file

This (admittedly suboptimal) error suggests that Guile was looking for a
closing parenthesis that never came.  Presumably the patch adds an
opening parenthesis but forgets to close it.

Editors such as Emacs and Vim have support to highlight parentheses or
even enter them automatically; I suggest using that to simplify work
with Scheme code.  For Emacs, see
<https://www.gnu.org/software/guix/manual/html_node/The-Perfect-Setup.html>.

Thanks,
Ludo’.

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

* Re: Trying to fix an error in the pypi-importer
  2016-01-03 14:09       ` Ludovic Courtès
@ 2016-01-03 16:29         ` swedebugia
  0 siblings, 0 replies; 13+ messages in thread
From: swedebugia @ 2016-01-03 16:29 UTC (permalink / raw)
  To: ludo; +Cc: guix-devel

On 2016-01-03 15:09, ludo@gnu.org wrote:
> swedebugia@riseup.net skribis:
> 
>> During compilation after applying my patch above I get this error.
>> 
>>   GUILEC guix/build-system/python.go
>> ice-9/boot-9.scm:106:20: In procedure #<procedure 8bbb4e0 at
>> ice-9/boot-9.scm:97:6 (thrown-k . args)>:
>> ice-9/boot-9.scm:106:20: In procedure scm_i_lreadparen:
>> guix/build-system/python.scm:216:1: end of file
> 
> This (admittedly suboptimal) error suggests that Guile was looking for 
> a
> closing parenthesis that never came.  Presumably the patch adds an
> opening parenthesis but forgets to close it.
> 
> Editors such as Emacs and Vim have support to highlight parentheses or
> even enter them automatically; I suggest using that to simplify work
> with Scheme code.  For Emacs, see
> <https://www.gnu.org/software/guix/manual/html_node/The-Perfect-Setup.html>.

Thanks for taking you time to tip me about this.

I will soon send a patch with my changes to the pypi-uri importer using 
define* and an #:optional argument 'ending'

:)

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

* Re: Trying to fix an error in the pypi-importer
  2016-01-02 17:10     ` swedebugia
                         ` (2 preceding siblings ...)
  2016-01-03 14:09       ` Ludovic Courtès
@ 2016-01-03 18:47       ` Ricardo Wurmus
  3 siblings, 0 replies; 13+ messages in thread
From: Ricardo Wurmus @ 2016-01-03 18:47 UTC (permalink / raw)
  To: swedebugia; +Cc: guix-devel, guix-devel-bounces+swedebugia=riseup.net

> So removing the (else -> to a comment and adjusting the parentheses did 
> not work.
>
> Could somebody point me to relevant documentation about how to write 
> conditional statements in guile?

In Scheme a conditional statement just looks like this:

  (if condition
    expression-a
    expression-b)

If the condition evaluates to “#t” then “expression-a” is evaluated.
Otherwise “expression-b” is evaluated.  “expression-a” and
“expression-b” can be something more complicated, too:

  (if (zero? number)
    ;; "then" ...
    (let ((name "swedebugia"))
      (format #t "The number was zero, ~a.\n" name))
    ;; "else" ...
    (begin
      (display "The number was not zero.")
      (display "I’m not done yet.")
      (display "Well, now I am.")))

Chapter 3 of the Guile info manual contains a useful introduction to
Scheme.

~~ Ricardo

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

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

Thread overview: 13+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-12-30 19:53 Trying to fix an error in the pypi-importer swedebugia
     [not found] ` <56844BF3.10701@uq.edu.au>
2015-12-30 21:27   ` Ben Woodcroft
2015-12-30 22:00 ` Cyril Roelandt
2016-01-01 18:10   ` swedebugia
2016-01-02 17:10     ` swedebugia
2016-01-02 18:06       ` How to test changes to guix locally? (Was: Re: Trying to fix an error in the pypi-importer) swedebugia
2016-01-02 18:58         ` Ricardo Wurmus
2016-01-02 18:26       ` Trying to fix an error in the pypi-importer Erik Edrosa
2016-01-03 14:09       ` Ludovic Courtès
2016-01-03 16:29         ` swedebugia
2016-01-03 18:47       ` Ricardo Wurmus
2015-12-31 11:22 ` Efraim Flashner
2016-01-01 18:15   ` swedebugia

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