unofficial mirror of guix-patches@gnu.org 
 help / color / mirror / code / Atom feed
* [bug#47181] Packaging python-soundfile for use in MediaGoblin
@ 2021-03-16  3:50 Ben Sturmfels via Guix-patches via
  2021-03-16  7:51 ` Nicolò Balzarotti
  0 siblings, 1 reply; 8+ messages in thread
From: Ben Sturmfels via Guix-patches via @ 2021-03-16  3:50 UTC (permalink / raw)
  To: 47181

[-- Attachment #1: Type: text/plain, Size: 489 bytes --]

Hi folks,

I'm working on adding MediaGoblin to Guix and we're actually getting
fairly close! I'm having some trouble packaging python-soundfile and
would love some help (patch attached).

When I run:

  ./pre-inst-env guix build python-soundfile

I get:

  OSError: cannot load library 'libsndfile.so.1': libsndfile.so.1:
  cannot open shared object file: No such file or directory

The libsndfile package is included as an input, but I guess there's
something I'm missing.

Regards,
Ben

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: add-python-soundfile.patch --]
[-- Type: text/x-patch, Size: 1858 bytes --]

From 44dd541cca8fb2b1eabdf445c7251c964e17fed8 Mon Sep 17 00:00:00 2001
From: Ben Sturmfels <ben@sturm.com.au>
Date: Tue, 16 Mar 2021 14:31:15 +1100
Subject: [PATCH] gnu: Add python-soundfile

* gnu/packages/audio.scm (python-soundfile): New variable.
---
 gnu/packages/audio.scm | 26 ++++++++++++++++++++++++++
 1 file changed, 26 insertions(+)

diff --git a/gnu/packages/audio.scm b/gnu/packages/audio.scm
index 67a3e57dd9..6ce5823aa6 100644
--- a/gnu/packages/audio.scm
+++ b/gnu/packages/audio.scm
@@ -83,6 +83,7 @@
   #:use-module (gnu packages icu4c)
   #:use-module (gnu packages image)
   #:use-module (gnu packages libbsd)
+  #:use-module (gnu packages libffi)
   #:use-module (gnu packages libusb)
   #:use-module (gnu packages linux)
   #:use-module (gnu packages llvm)
@@ -2379,6 +2380,31 @@ included are the command line utilities @code{send_osc} and @code{dump_osc}.")
 (define-public python2-pyliblo
   (package-with-python2 python-pyliblo))
 
+(define-public python-soundfile
+  (package
+    (name "python-soundfile")
+    (version "0.10.3.post1")
+    (source
+     (origin
+       (method url-fetch)
+       (uri (pypi-uri "SoundFile" version))
+       (sha256
+        (base32
+         "0yqhrfz7xkvqrwdxdx2ydy4h467sk7z3gf984y1x2cq7cm1gy329"))))
+    (build-system python-build-system)
+    (native-inputs
+     `(("python-pytest" ,python-pytest)))
+    (propagated-inputs
+     `(("python-cffi" ,python-cffi)
+       ("libsndfile" ,libsndfile)
+       ("python-numpy" ,python-numpy)))
+    (home-page "https://github.com/bastibe/python-soundfile")
+    (synopsis "An audio library based on libsndfile, CFFI and NumPy")
+    (description
+     "The soundfile module can read and write sound files, representing audio
+data as NumPy arrays.")
+    (license license:bsd-3)))
+
 (define-public lilv
   (package
     (name "lilv")
-- 
2.30.2


^ permalink raw reply related	[flat|nested] 8+ messages in thread

* [bug#47181] Packaging python-soundfile for use in MediaGoblin
  2021-03-16  3:50 [bug#47181] Packaging python-soundfile for use in MediaGoblin Ben Sturmfels via Guix-patches via
@ 2021-03-16  7:51 ` Nicolò Balzarotti
  2021-03-16 11:47   ` Ben Sturmfels via Guix-patches via
  0 siblings, 1 reply; 8+ messages in thread
From: Nicolò Balzarotti @ 2021-03-16  7:51 UTC (permalink / raw)
  To: Ben Sturmfels, 47181

Ben Sturmfels via Guix-patches via <guix-patches@gnu.org> writes:

> Hi folks,
>
Hi,
>
>   OSError: cannot load library 'libsndfile.so.1': libsndfile.so.1:
>   cannot open shared object file: No such file or directory
>
You can patch the sounfile.py file, setting the correct library path.

Many other python packages do this, like python-file, python-libarchive-c, python-pyzbar

It should look something like (untested):

#+begin_src scheme
(arguments
     `(#:phases
       (modify-phases %standard-phases
         (add-before 'build 'set-library-file-name
           (lambda* (#:key inputs #:allow-other-keys)
             (let ((libsndfile (assoc-ref inputs "libsndfile")))
               (substitute* "soundfile.py"
                 (("find_library\\('sndfile'\\)")
                  (string-append "'" libsndfile "/lib/libsndfile.so.0'")))
               #t))))))
#+end_src

Nicolò




^ permalink raw reply	[flat|nested] 8+ messages in thread

* [bug#47181] Packaging python-soundfile for use in MediaGoblin
  2021-03-16  7:51 ` Nicolò Balzarotti
@ 2021-03-16 11:47   ` Ben Sturmfels via Guix-patches via
  2021-03-16 12:44     ` Nicolò Balzarotti
  2021-03-16 12:49     ` Léo Le Bouter via Guix-patches via
  0 siblings, 2 replies; 8+ messages in thread
From: Ben Sturmfels via Guix-patches via @ 2021-03-16 11:47 UTC (permalink / raw)
  To: Nicolò Balzarotti; +Cc: 47181

Thanks Nicolò,

On Tue, 16 Mar 2021, Nicolò Balzarotti wrote:

>>   OSError: cannot load library 'libsndfile.so.1': libsndfile.so.1:
>>   cannot open shared object file: No such file or directory
>>
> You can patch the sounfile.py file, setting the correct library path.
>
> Many other python packages do this, like python-file, python-libarchive-c, python-pyzbar
>
> It should look something like (untested):
>
> #+begin_src scheme
> (arguments
>      `(#:phases
>        (modify-phases %standard-phases
>          (add-before 'build 'set-library-file-name
>            (lambda* (#:key inputs #:allow-other-keys)
>              (let ((libsndfile (assoc-ref inputs "libsndfile")))
>                (substitute* "soundfile.py"
>                  (("find_library\\('sndfile'\\)")
>                   (string-append "'" libsndfile "/lib/libsndfile.so.0'")))
>                #t))))))
> #+end_src

Thanks, that solves my problem. One follow-up question - is it better to
use the ".so" link or the specific "so.0"?

I've now discovered a subsequent issue with libsndfile that I'll need to
put a patch in for first though. Progress!

Regards,
Ben




^ permalink raw reply	[flat|nested] 8+ messages in thread

* [bug#47181] Packaging python-soundfile for use in MediaGoblin
  2021-03-16 11:47   ` Ben Sturmfels via Guix-patches via
@ 2021-03-16 12:44     ` Nicolò Balzarotti
  2021-03-16 12:49     ` Léo Le Bouter via Guix-patches via
  1 sibling, 0 replies; 8+ messages in thread
From: Nicolò Balzarotti @ 2021-03-16 12:44 UTC (permalink / raw)
  To: Ben Sturmfels; +Cc: 47181

Ben Sturmfels via Guix-patches via <guix-patches@gnu.org> writes:

> Thanks, that solves my problem. One follow-up question - is it better to
> use the ".so" link or the specific "so.0"?
I don't know what's preferred, so let's wait for somebody else who knows
more than me :)

Nicolò




^ permalink raw reply	[flat|nested] 8+ messages in thread

* [bug#47181] Packaging python-soundfile for use in MediaGoblin
  2021-03-16 11:47   ` Ben Sturmfels via Guix-patches via
  2021-03-16 12:44     ` Nicolò Balzarotti
@ 2021-03-16 12:49     ` Léo Le Bouter via Guix-patches via
  2021-03-16 13:09       ` Efraim Flashner
  1 sibling, 1 reply; 8+ messages in thread
From: Léo Le Bouter via Guix-patches via @ 2021-03-16 12:49 UTC (permalink / raw)
  To: Ben Sturmfels, Nicolò Balzarotti; +Cc: 47181

[-- Attachment #1: Type: text/plain, Size: 495 bytes --]

On Tue, 2021-03-16 at 22:47 +1100, Ben Sturmfels via Guix-patches via
wrote:
> Thanks, that solves my problem. One follow-up question - is it better
> to
> use the ".so" link or the specific "so.0"?

Use the more specific one since that is a symlink for a fixed ABI, if
the main library changes ABI it can then symlink with a bumped number
to indicate that and not break any dependent package. If you use the
less specific .so file directly then your package may suffer an ABI
break.

[-- Attachment #2: This is a digitally signed message part --]
[-- Type: application/pgp-signature, Size: 833 bytes --]

^ permalink raw reply	[flat|nested] 8+ messages in thread

* [bug#47181] Packaging python-soundfile for use in MediaGoblin
  2021-03-16 12:49     ` Léo Le Bouter via Guix-patches via
@ 2021-03-16 13:09       ` Efraim Flashner
  2021-03-30  6:20         ` Ben Sturmfels via Guix-patches via
  0 siblings, 1 reply; 8+ messages in thread
From: Efraim Flashner @ 2021-03-16 13:09 UTC (permalink / raw)
  To: Léo Le Bouter; +Cc: Ben Sturmfels, 47181, Nicolò Balzarotti

[-- Attachment #1: Type: text/plain, Size: 1075 bytes --]

On Tue, Mar 16, 2021 at 01:49:51PM +0100, Léo Le Bouter via Guix-patches via wrote:
> On Tue, 2021-03-16 at 22:47 +1100, Ben Sturmfels via Guix-patches via
> wrote:
> > Thanks, that solves my problem. One follow-up question - is it better
> > to
> > use the ".so" link or the specific "so.0"?
> 
> Use the more specific one since that is a symlink for a fixed ABI, if
> the main library changes ABI it can then symlink with a bumped number
> to indicate that and not break any dependent package. If you use the
> less specific .so file directly then your package may suffer an ABI
> break.

The package gets rebuilt each time so it is less likely with Guix.
However, if you substitute libsndfile.so and the full text is
libsndfile.so.0.0.23 (or something similar) then you'll still end up
with /gnu/store/...libsndfile.../libsndfile.so.0.0.23.

-- 
Efraim Flashner   <efraim@flashner.co.il>   אפרים פלשנר
GPG key = A28B F40C 3E55 1372 662D  14F7 41AA E7DC CA3D 8351
Confidentiality cannot be guaranteed on emails sent or received unencrypted

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]

^ permalink raw reply	[flat|nested] 8+ messages in thread

* [bug#47181] Packaging python-soundfile for use in MediaGoblin
  2021-03-16 13:09       ` Efraim Flashner
@ 2021-03-30  6:20         ` Ben Sturmfels via Guix-patches via
  2021-09-12  2:14           ` bug#47181: " Ben Sturmfels via Guix-patches via
  0 siblings, 1 reply; 8+ messages in thread
From: Ben Sturmfels via Guix-patches via @ 2021-03-30  6:20 UTC (permalink / raw)
  To: Efraim Flashner; +Cc: Léo Le Bouter, 47181, Nicolò Balzarotti

On Wed, 17 Mar 2021, Efraim Flashner wrote:

> On Tue, Mar 16, 2021 at 01:49:51PM +0100, Léo Le Bouter via Guix-patches via wrote:
>> On Tue, 2021-03-16 at 22:47 +1100, Ben Sturmfels via Guix-patches via
>> wrote:
>> > Thanks, that solves my problem. One follow-up question - is it better
>> > to
>> > use the ".so" link or the specific "so.0"?
>> 
>> Use the more specific one since that is a symlink for a fixed ABI, if
>> the main library changes ABI it can then symlink with a bumped number
>> to indicate that and not break any dependent package. If you use the
>> less specific .so file directly then your package may suffer an ABI
>> break.
>
> The package gets rebuilt each time so it is less likely with Guix.
> However, if you substitute libsndfile.so and the full text is
> libsndfile.so.0.0.23 (or something similar) then you'll still end up
> with /gnu/store/...libsndfile.../libsndfile.so.0.0.23.

Thanks Efraim, Léo and Nicolò for the info on .so links.

This patch is now waiting on updates to libsndfile in core-updates. I'll
post an updated patch when that's merged. For now, I've inlined this
into MediaGoblin's guix-env.scm so I can keep working on the packaging
there.

Regards,
Ben




^ permalink raw reply	[flat|nested] 8+ messages in thread

* bug#47181: Packaging python-soundfile for use in MediaGoblin
  2021-03-30  6:20         ` Ben Sturmfels via Guix-patches via
@ 2021-09-12  2:14           ` Ben Sturmfels via Guix-patches via
  0 siblings, 0 replies; 8+ messages in thread
From: Ben Sturmfels via Guix-patches via @ 2021-09-12  2:14 UTC (permalink / raw)
  To: 47181-done

Closing - Leo Prinkler added python-soundfile back in May.

Regards,
Ben




^ permalink raw reply	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2021-09-12  2:15 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-03-16  3:50 [bug#47181] Packaging python-soundfile for use in MediaGoblin Ben Sturmfels via Guix-patches via
2021-03-16  7:51 ` Nicolò Balzarotti
2021-03-16 11:47   ` Ben Sturmfels via Guix-patches via
2021-03-16 12:44     ` Nicolò Balzarotti
2021-03-16 12:49     ` Léo Le Bouter via Guix-patches via
2021-03-16 13:09       ` Efraim Flashner
2021-03-30  6:20         ` Ben Sturmfels via Guix-patches via
2021-09-12  2:14           ` bug#47181: " Ben Sturmfels via Guix-patches via

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).