[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: 'python-build-system'

From: Ludovic Courtès
Subject: Re: 'python-build-system'
Date: Sun, 07 Apr 2013 12:34:15 +0200
User-agent: Gnus/5.130005 (Ma Gnus v0.5) Emacs/24.3 (gnu/linux)

Nikita Karetnikov <address@hidden> 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!


reply via email to

[Prev in Thread] Current Thread [Next in Thread]