unofficial mirror of bug-guix@gnu.org 
 help / color / mirror / code / Atom feed
From: ludo@gnu.org (Ludovic Courtès)
To: Nikita Karetnikov <nikita@karetnikov.org>
Cc: bug-guix@gnu.org
Subject: Re: 'python-build-system'
Date: Sun, 07 Apr 2013 12:34:15 +0200	[thread overview]
Message-ID: <87hajiwrx4.fsf@gnu.org> (raw)
In-Reply-To: <87sj34zvn1.fsf@karetnikov.org> (Nikita Karetnikov's message of "Fri, 05 Apr 2013 22:21:06 +0400")

Nikita Karetnikov <nikita@karetnikov.org> skribis:

> The main problem is that 'set-path-environment-variable' doesn't seem
> to work.

Could you be more precise?  :-)  At the beginning of the build log, there
should be a line saying ‘PYTHONPATH set to ...’.  What does this say?

> I used Bazaar (don't forget to apply this patch [1] first) to test the
> build system:

So you did build it successfully, right?

> # /nix/var/nix/profiles/per-user/root/guix-profile/bin/bzr --help
> bzr: warning: unsupported locale setting
>   bzr could not set the application locale.
>   Although this should be no problem for bzr itself, it might
>   cause problems with some plugins. To investigate the issue,
>   look at the output of the locale(1p) tool.
> bzr: ERROR: Couldn't import bzrlib and dependencies.
> Please check the directory containing bzrlib is on your PYTHONPATH.

The ‘bzr’ binary should be wrapped (with ‘wrap-program’) in a wrapper
that sets PYTHONPATH to point to $out/lib/python2.7/site-packages (which
you did manually.)

I think it’s something that should be done automatically by
‘python-build-system’.  That is, after the ‘install’ phase, it should
traverse all the binaries in $out/{bin,sbin} and wrap them.  The
wrappers should set PYTHONPATH to
$out/lib/python2.7/site-packages:$PYTHONPATH, where $PYTHONPATH is the
build-time $PYTHONPATH.

> More questions:
>
> 1. How can I get the version of Python in 'python-build-system.scm'?
>    (I hardcoded it for now.)

In python.scm (the host-side module), you can do

  (package-version python)

You could pass that to the builder, say via #:python-version, so
python-build-system.scm can use it.

But note that in general the interesting bit is “2.7”, not “2.7.1”.

> 2. Can I remove the 'strip' phase?  Is it useful for Python packages?

There could be .so files, so you can leave it (it doesn’t hurt anyway.)

> There is a problem with Bazaar too.  Actually, it's a 'gnutls' problem.
> I packaged Bazaar 2.3.1 because I can't get the hashes of the latest
> versions.  For example:
>
> # ./pre-inst-env guix download https://launchpad.net/bzr/2.5/2.5.1/+download/bzr-2.5.1.tar.gz
>
> [...]
>
> ERROR: missing interface for module (gnutls)

That’s because GnuTLS is not available on your system.  You must install
it if you want to be able to use ‘guix download’ with https.
Fortunately, you just have to type ‘guix package -i gnutls’.  :-)

> (define* (python-build #:key inputs (phases %standard-phases)
>                        #:allow-other-keys #:rest args)
>   "Build the given Python package, applying all of PHASES in order."
>   (set-path-environment-variable "PYTHONPATH"
>                                  '("lib/python2.7/site-packages")
>                                  (match inputs
>                                    (((_ . location) ...)
>                                     location)))
>
>   (apply gnu:gnu-build #:inputs inputs #:phases phases args))

In ‘core-updates’ there’s a better mechanism for search paths.  You can
do the above in ‘master’, but for ‘core-updates’ please see in commit
a18eda2747fa2eb962e3288066d2b1a679589ed3 how ‘perl-build-system’ handles
its search path.

Other than that, looks great!

Thanks,
Ludo’.

  reply	other threads:[~2013-04-07 10:34 UTC|newest]

Thread overview: 23+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-04-05 18:21 'python-build-system' Nikita Karetnikov
2013-04-07 10:34 ` Ludovic Courtès [this message]
2013-04-23  9:49   ` ERROR: missing interface for module (gnutls) (was: 'python-build-system') Nikita Karetnikov
2013-04-23 11:51     ` ERROR: missing interface for module (gnutls) Ludovic Courtès
2013-04-23 15:03       ` Nikita Karetnikov
2013-04-23 16:01         ` Ludovic Courtès
2013-04-27 15:14 ` 'python-build-system' Ludovic Courtès
2013-04-28  1:55   ` 'python-build-system' Nikita Karetnikov
2013-04-28 17:18     ` 'python-build-system' Nikita Karetnikov
2013-04-28 20:52       ` 'python-build-system' Ludovic Courtès
2013-04-29  3:50         ` 'python-build-system' Nikita Karetnikov
2013-04-29 11:42           ` 'python-build-system' Ludovic Courtès
2013-05-08  1:52             ` 'python-build-system' Nikita Karetnikov
2013-05-08 16:47               ` 'python-build-system' Ludovic Courtès
2013-05-08 23:22                 ` 'python-build-system' Nikita Karetnikov
2013-05-09 20:29                   ` 'python-build-system' Ludovic Courtès
2013-04-29 19:33       ` 'python-build-system' Ludovic Courtès
2013-04-30 15:04         ` 'python-build-system' Ludovic Courtès
2013-04-28 22:50     ` 'python-build-system' Cyril Roelandt
2013-04-29 11:50       ` 'python-build-system' Ludovic Courtès
2013-04-29 19:24         ` 'python-build-system' Cyril Roelandt
2013-04-30 13:47           ` 'python-build-system' Nikita Karetnikov
2013-05-06 21:07             ` 'python-build-system' Ludovic Courtès

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=87hajiwrx4.fsf@gnu.org \
    --to=ludo@gnu.org \
    --cc=bug-guix@gnu.org \
    --cc=nikita@karetnikov.org \
    /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).