help-guix
[Top][All Lists]
Advanced

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

Re: Using an alternative python to build python modules


From: Simon Tournier
Subject: Re: Using an alternative python to build python modules
Date: Tue, 21 Feb 2023 13:52:08 +0100

Hi,

On Fri, 17 Feb 2023 at 21:27, Kyle Andrews <kyle@posteo.net> wrote:

> For example:
>
> ```
> (build-system python-build-system #:python python-3.6)
> ```
>
> That would be quite convenient and in line with the level of complexity
> I was faced with when I took the conda approach before trying to use
> Guix. Unfortunately, this functionality doesn't seem to be provided out
> of box and I am seeking help in the hopes that there is an easy way to
> do it.

You might be interested by the unexported procedure from (guix
build-system python):

--8<---------------cut here---------------start------------->8---
(define* (package-with-explicit-python python old-prefix new-prefix
                                       #:key variant-property)
  "Return a procedure of one argument, P.  The procedure creates a package with
the same fields as P, which is assumed to use PYTHON-BUILD-SYSTEM, such that
it is compiled with PYTHON instead.  The inputs are changed recursively
accordingly.  If the name of P starts with OLD-PREFIX, this is replaced by
NEW-PREFIX; otherwise, NEW-PREFIX is prepended to the name.

When VARIANT-PROPERTY is present, it is used as a key to search for
pre-defined variants of this transformation recorded in the 'properties' field
of packages.  The property value must be the promise of a package.  This is a
convenient way for package writers to force the transformation to use
pre-defined variants."
--8<---------------cut here---------------end--------------->8---

For example, it was intensively used for maintaining both Python 3 and
Python 2 variants.

For instance, if you have a variant of the Python interpreter say
variant-python, then can have a manifest that apply the transformation,
something like:

--8<---------------cut here---------------start------------->8---
(map (lambda (pkg)
       ((package-with-explicit-python variant-python
       “python-” “python-” #:variant-property my-python)
       pkg))
  (list
    python-one python-two python-three etc))
--8<---------------cut here---------------end--------------->8---
  

Cheers,
simon



reply via email to

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