unofficial mirror of help-guix@gnu.org 
 help / color / mirror / Atom feed
From: Simon Tournier <zimon.toutoune@gmail.com>
To: Kyle Andrews <kyle@posteo.net>, help-guix@gnu.org
Subject: Re: Using an alternative python to build python modules
Date: Tue, 21 Feb 2023 13:52:08 +0100	[thread overview]
Message-ID: <86a6179o5j.fsf@gmail.com> (raw)
In-Reply-To: <87ttzkose5.fsf@posteo.net>

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


  parent reply	other threads:[~2023-02-21 13:05 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-02-17 21:27 Using an alternative python to build python modules Kyle Andrews
2023-02-18  9:57 ` Wojtek Kosior via
2023-02-18 17:53   ` Edouard Klein
2023-02-20 22:29     ` Kyle Andrews
2023-02-21 16:50       ` Edouard Klein
2023-02-21 12:52 ` Simon Tournier [this message]
2023-02-21 20:26   ` Kyle Andrews
2023-02-21 21:10     ` Simon Tournier
2023-02-22  9:23       ` Simon Tournier
2023-02-21 21:28     ` Kyle Andrews
2023-02-22  4:23       ` Kyle Andrews
2023-02-22 10:09         ` Simon Tournier
2023-02-24  0:16           ` Kyle Andrews

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=86a6179o5j.fsf@gmail.com \
    --to=zimon.toutoune@gmail.com \
    --cc=help-guix@gnu.org \
    --cc=kyle@posteo.net \
    /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.
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).