help-guix
[Top][All Lists]
Advanced

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

Re: Python package with some rust dependency


From: Alexis Simon
Subject: Re: Python package with some rust dependency
Date: Fri, 16 Feb 2024 16:02:45 -0800
User-agent: Mozilla Thunderbird

Hi,

So I think I'm nearly there (part of the scm attached).

The last thing I'd like to do is run the python tests inside the cargo-build-system but couldn't find an example of it. I don't understand how to do that.

I get the following error, which is most probably me not knowing how to write scheme.
```
error: in phase 'check-python-module': uncaught exception:
wrong-type-arg "apply" "Apply to non-list: ~S" (#f) (#f)
phase `check-python-module' failed after 0.0 seconds
Backtrace:
           8 (primitive-load "/gnu/store/c2v51hzvlji63jbh0jwn5dbz10j…")
In guix/build/gnu-build-system.scm:
    908:2  7 (gnu-build #:source _ #:outputs _ #:inputs _ #:phases . #)
In ice-9/boot-9.scm:
  1752:10  6 (with-exception-handler _ _ #:unwind? _ # _)
In srfi/srfi-1.scm:
    634:9  5 (for-each #<procedure 7ffff5f29c20 at guix/build/gnu-b…> …)
In ice-9/boot-9.scm:
  1752:10  4 (with-exception-handler _ _ #:unwind? _ # _)
In guix/build/gnu-build-system.scm:
   929:23  3 (_)
In unknown file:
           2 (_ "/gnu/store/qzx9n7452cw0w11c96gvijdnmk6v82m2-python…" …)
In ice-9/boot-9.scm:
  1685:16  1 (raise-exception _ #:continuable? _)
  1685:16  0 (raise-exception _ #:continuable? _)

ice-9/boot-9.scm:1685:16: In procedure raise-exception:
In procedure apply: Apply to non-list: #f
```

Thanks
Alexis


On 15/02/2024 22:08, Alexis Simon wrote:
Hi,

So right now I'm trying to go the splitting in two packages way, similar to what is done for python-cryptography.

So I managed to build the first one that produces a header file in the store /gnu/store/*/lib/header.h

In the second package, I don't get how to copy this file inside the build. I've been trying something like this:
```
     (native-inputs (list python-fwdpy11-rust-lib))
     (arguments
       (list
         #:phases
         #~(modify-phases %standard-phases
             (add-before 'build 'copy-rust-lib
                (lambda* (#:key native-inputs #:allow-other-keys)
                  (copy-file (search-input-file
                            native-inputs "lib/fp11rust_api.h")
                           "lib/core/internal/fp11rust_api.h"))))))
```
Which complains there is no match, because it seams the package store path is not present in the native-inputs, although I specify it in the package.

Thanks,
Alexis

On 13/02/2024 13:55, Alexis Simon wrote:
Fair enough, I just meant that it's pretty hard as a newcomer to know which build system You're supposed to use to start with when encountering a project where several languages are used.

Alexis

On 13/02/2024 13:46, Carlo Zancanaro wrote:
On Tue, Feb 13 2024, Alexis Simon wrote:
Ok, this seems really counter intuitive though to go and use the cargo
build system for a python package only have a tiny part in rust.

I'm not sure why this is counter-intuitive. The existence of any rust at
all means you need to build rust code. The normal way to do that in Guix
is to use the cargo-build-system.

Equally, I don't find it strange that the upstream build instructions[1]
ask me to install a rust compiler and cbindgen. I need to do that if I
want to build rust code.

It's also worth noting that there are 22 packages in Cargo.lock[2], so
building the one rust file in the repository is a bit more involved.

Carlo

[1]: https://molpopgen.github.io/fwdpy11/misc/developersguide.html
[2]: https://github.com/molpopgen/fwdpy11/blob/main/rust/fp11rust/Cargo.lock

Attachment: fwdpy11.scm
Description: Text Data


reply via email to

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