Re: 'python-build-system'

2013-04-28 Thread Nikita Karetnikov
'bazaar.scm' is for testing.  The following warnings appear during the
installation:

GNU gettext msgfmt utility not found!

patch-shebang: ./tools/packaging/lp-upload-release: warning: no binary for 
interpreter `zsh' found in $PATH

patch-shebang: ./tools/weavemerge.sh: warning: no binary for interpreter `zsh' 
found in $PATH

Can we replace 'zsh' with 'bash'?  I guess there may be some
compatibility problems.

Should we package 'zsh' instead?  I haven't checked, but it seems there
are two tarballs: the first one contains sources and the second contains
docs.  Is there a way to specify both in a single recipe?

Also, I should mention that I don't understand some parts of the build
system.  I'm not sure how to check them.  Is there a Scheme level
'strace'-like tool?  If not, I'll send more specific questions later.

From aa73cd5d8e5e48d24460c9d6bcebfc92b3311d4c Mon Sep 17 00:00:00 2001
From: Nikita Karetnikov 
Date: Sun, 28 Apr 2013 16:08:23 +
Subject: [PATCH] utils: Adjust 'wrap-program'.

* guix/build/utils.scm (wrap-program): Assume that 'prog' is an
  absolute filename.  Adjust 'prog-real' and 'prog-tmp' accordingly.
  Also, change 'prog-tmp' to honor command line arguments.
---
 guix/build/utils.scm |8 
 1 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/guix/build/utils.scm b/guix/build/utils.scm
index 356dd46..fe6978b 100644
--- a/guix/build/utils.scm
+++ b/guix/build/utils.scm
@@ -680,8 +680,8 @@ contents:
 This is useful for scripts that expect particular programs to be in $PATH, for
 programs that expect particular shared libraries to be in $LD_LIBRARY_PATH, or
 modules in $GUILE_LOAD_PATH, etc."
-  (let ((prog-real (string-append "." prog "-real"))
-(prog-tmp  (string-append "." prog "-tmp")))
+  (let ((prog-real (string-append (dirname prog) "/." (basename prog) "-real"))
+(prog-tmp  (string-append (dirname prog) "/." (basename prog) "-tmp")))
 (define (export-variable lst)
   ;; Return a string that exports an environment variable.
   (match lst
@@ -709,11 +709,11 @@ modules in $GUILE_LOAD_PATH, etc."
 (with-output-to-file prog-tmp
   (lambda ()
 (format #t
-"#!~a~%~a~%exec ~a~%"
+"#!~a~%~a~%exec ~a $@~%"
 (which "bash")
 (string-join (map export-variable vars)
  "\n")
-(canonicalize-path prog-real
+prog-real)))
 
 (chmod prog-tmp #o755)
 (rename-file prog-tmp prog)))
-- 
1.7.5.4

From e217b27883223f4c6adc39c4ed3c1af6d1ddf4af Mon Sep 17 00:00:00 2001
From: Nikita Karetnikov 
Date: Sun, 28 Apr 2013 12:55:27 +
Subject: [PATCH] Add 'python-build-system'.

* guix/build-system/python.scm, guix/build/python-build-system.scm: New files.
* Makefile.am (MODULES): Add them.
---
 Makefile.am|2 +
 guix/build-system/python.scm   |  111 
 guix/build/python-build-system.scm |   89 +
 3 files changed, 202 insertions(+), 0 deletions(-)
 create mode 100644 guix/build-system/python.scm
 create mode 100644 guix/build/python-build-system.scm

diff --git a/Makefile.am b/Makefile.am
index 847d850..7172a90 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -46,6 +46,7 @@ MODULES =	\
   guix/build-system/cmake.scm			\
   guix/build-system/gnu.scm			\
   guix/build-system/perl.scm			\
+  guix/build-system/python.scm			\
   guix/build-system/trivial.scm			\
   guix/ftp-client.scm\
   guix/web.scm	\
@@ -56,6 +57,7 @@ MODULES =	\
   guix/build/cmake-build-system.scm		\
   guix/build/gnu-build-system.scm		\
   guix/build/perl-build-system.scm		\
+  guix/build/python-build-system.scm		\
   guix/build/utils.scm\
   guix/build/union.scm\
   guix/packages.scm\
diff --git a/guix/build-system/python.scm b/guix/build-system/python.scm
new file mode 100644
index 000..55d752a
--- /dev/null
+++ b/guix/build-system/python.scm
@@ -0,0 +1,111 @@
+;;; GNU Guix --- Functional package management for GNU
+;;; Copyright © 2013 Ludovic Courtès 
+;;; Copyright © 2013 Nikita Karetnikov 
+;;;
+;;; This file is part of GNU Guix.
+;;;
+;;; GNU Guix is free software; you can redistribute it and/or modify it
+;;; under the terms of the GNU General Public License as published by
+;;; the Free Software Foundation; either version 3 of the License, or (at
+;;; your option) any later version.
+;;;
+;;; GNU Guix is distributed in the hope that it will be useful, but
+;;; WITHOUT ANY WARRANTY; without even the implied warranty of
+;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+;;; GNU General Public License for more details.
+;;;
+;;; You should have received a copy of the GNU General Public License
+;;; along with GNU Guix.  If not, see .
+
+(define-module (guix build-system python)
+  #:use-module (guix store)
+  #:use-module (guix utils)
+  #:use-module (guix packages)
+  #

Re: Xpdf

2013-04-28 Thread Andreas Enge
Am Montag, 1. April 2013 schrieb Ludovic Courtès:
> Perhaps we could patch xpdfrc to point to GhostScript’s font directory?

I just added the gs-fonts package in core-updates, and modified xpdfrc 
accordingly.

Andreas



Re: 'python-build-system'

2013-04-28 Thread Ludovic Courtès
Nikita Karetnikov  skribis:

> 'bazaar.scm' is for testing.  The following warnings appear during the
> installation:
>
> GNU gettext msgfmt utility not found!

Just add gettext as an input.

> patch-shebang: ./tools/packaging/lp-upload-release: warning: no binary for 
> interpreter `zsh' found in $PATH
>
> patch-shebang: ./tools/weavemerge.sh: warning: no binary for interpreter 
> `zsh' found in $PATH
>
> Can we replace 'zsh' with 'bash'?  I guess there may be some
> compatibility problems.

Yes, definitely.  But that’s not a problem: these scripts are most
likely unused during the build process and afterward.

> Also, I should mention that I don't understand some parts of the build
> system.  I'm not sure how to check them.  Is there a Scheme level
> 'strace'-like tool?  If not, I'll send more specific questions later.

Well, there’s ‘pk’ and ‘format’, to add debugging statements here and
there.  There’s also the debugger.

> From aa73cd5d8e5e48d24460c9d6bcebfc92b3311d4c Mon Sep 17 00:00:00 2001
> From: Nikita Karetnikov 
> Date: Sun, 28 Apr 2013 16:08:23 +
> Subject: [PATCH] utils: Adjust 'wrap-program'.
>
> * guix/build/utils.scm (wrap-program): Assume that 'prog' is an
>   absolute filename.  Adjust 'prog-real' and 'prog-tmp' accordingly.
>   Also, change 'prog-tmp' to honor command line arguments.

What was wrong with the previous approach?  I don’t like the “assume
it’s an absolute file name” bit, because we don’t know whether the
assumption holds.

>  guix/build/utils.scm |8 
>  1 files changed, 4 insertions(+), 4 deletions(-)
>
> diff --git a/guix/build/utils.scm b/guix/build/utils.scm
> index 356dd46..fe6978b 100644
> --- a/guix/build/utils.scm
> +++ b/guix/build/utils.scm
> @@ -680,8 +680,8 @@ contents:
>  This is useful for scripts that expect particular programs to be in $PATH, 
> for
>  programs that expect particular shared libraries to be in $LD_LIBRARY_PATH, 
> or
>  modules in $GUILE_LOAD_PATH, etc."
> -  (let ((prog-real (string-append "." prog "-real"))
> -(prog-tmp  (string-append "." prog "-tmp")))
> +  (let ((prog-real (string-append (dirname prog) "/." (basename prog) 
> "-real"))
> +(prog-tmp  (string-append (dirname prog) "/." (basename prog) 
> "-tmp")))
>  (define (export-variable lst)
>;; Return a string that exports an environment variable.
>(match lst
> @@ -709,11 +709,11 @@ modules in $GUILE_LOAD_PATH, etc."
>  (with-output-to-file prog-tmp
>(lambda ()
>  (format #t
> -"#!~a~%~a~%exec ~a~%"
> +"#!~a~%~a~%exec ~a $@~%"

Oops, indeed.  You need double quotes around $@.

>  (which "bash")
>  (string-join (map export-variable vars)
>   "\n")
> -(canonicalize-path prog-real
> +prog-real)))
>  
>  (chmod prog-tmp #o755)
>  (rename-file prog-tmp prog)))
> +  (define builder
> +`(begin
> +   (use-modules ,@modules)
> +   (python-build #:name ,name
> + #:source ,(if (and source (derivation-path? source))
> +   (derivation-path->output-path source)
> +   source)
> + #:configure-flags ,configure-flags
> + #:system ,system
> + #:test-target "test"
> + #:tests? ,tests?
> + #:outputs %outputs
> + #:python-version ,python-version
> + #:search-paths ',(map search-path-specification->sexp
> +   (append search-paths
> +   (standard-search-paths)))

You also need to keep (package-native-search-paths python).  See commit
35ac56b6, which fixed that for Perl & co.

Otherwise looks good.

Thanks!

Ludo’.



Re: Xpdf

2013-04-28 Thread Ludovic Courtès
Andreas Enge  skribis:

> Am Montag, 1. April 2013 schrieb Ludovic Courtès:
>> Perhaps we could patch xpdfrc to point to GhostScript’s font directory?
>
> I just added the gs-fonts package in core-updates, and modified xpdfrc 
> accordingly.

Just tried it with ‘env -i’ (to make sure) on several PDF files and it
works fine.  Thanks!

Ludo’.



Re: Search paths

2013-04-28 Thread Ludovic Courtès
l...@gnu.org (Ludovic Courtès) skribis:

> Commit a18eda2 in ‘core-updates’ adds the ‘native-search-paths’ field
> for packages, and honor it.  The next commit gives an example of how to
> use it.

With commit 5924080, ‘guix package --install’ reports environment
variables that needs to be defined, using information from
‘native-search-paths’.

For example, if you install GCC and a C library, it will tell you to set
CPATH=$HOME/.guix-profile/include and
LIBRARY_PATH=$HOME/.guix-profile/lib, unless the environment variables
are already defined appropriately.

Also, ‘guix package --search-paths’ lists environment variables that
need to be defined, regardless of their current value.

Hopefully that will help avoid common mistakes when using Guix.

Comments welcome!

Ludo’.



Re: 'python-build-system'

2013-04-28 Thread Cyril Roelandt

On 04/28/2013 03:55 AM, Nikita Karetnikov wrote:

What’s the status of this?  It would be great to have it in time for
0.2.


OK, I'll try to finalize it today.


Should we really call this "python-build-system" ? I think there are a 
few different build systems for Python, even though they are all forks 
of one another (distutils, setuptools, distutils2, distribute, and maybe 
others).


I'm not sure that Python chose one of these as the "official" build 
system. Maybe we should use names such as 
"python-setuptools-build-system". WDYT ?


Cyril.



Re: 'python-build-system'

2013-04-28 Thread Nikita Karetnikov
> Yes, definitely.  But that’s not a problem: these scripts are most
> likely unused during the build process and afterward.

So, should I package it (without replacing shells)?

>> * guix/build/utils.scm (wrap-program): Assume that 'prog' is an
>>   absolute filename.  Adjust 'prog-real' and 'prog-tmp' accordingly.
>>   Also, change 'prog-tmp' to honor command line arguments.

> What was wrong with the previous approach?  I don’t like the “assume
> it’s an absolute file name” bit, because we don’t know whether the
> assumption holds.

Well, have a look at this snippet:

+  (for-each (cut wrap-program <> var)
+files)))

Each 'file' here will have an absolute filename.

I failed to make it work with the previous version.

Should I change the commit message?

> You need double quotes around $@.

Why should I add them?

> You also need to keep (package-native-search-paths python).  See commit
> 35ac56b6, which fixed that for Perl & co.

Could you elaborate?  Why is it needed?  Is it necessary to add
'python-search-paths'?


pgpHbFcpJdXQB.pgp
Description: PGP signature