New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
pythonPackages.sounddevice: fixed portaudio library path #43083
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please update to 3.11 first, the code seems to have changed since 3.9: https://github.com/spatialaudio/python-sounddevice/blob/7d7e4f3f87f56012ef1338bd51f02085f08e1186/sounddevice.py#L66
Updated to 0.3.11 and changed the patch accordingly. |
}; | ||
|
||
propagatedBuildInputs = [ cffi numpy portaudio ]; | ||
|
||
# No tests included nor upstream available. | ||
doCheck = false; | ||
|
||
prePatch = '' | ||
substituteInPlace src/sounddevice.py --replace "'portaudio'" "'${portaudio}/lib/libportaudio.so.2'" | ||
patches = [ ./fix-portaudio-library-path.patch ]; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You should use substituteAll
here instead of an additional postPatch
phase. Have a look at e.g.
nixpkgs/pkgs/applications/networking/syncthing-gtk/default.nix
Lines 34 to 44 in a44d33a
patches = [ | |
(fetchpatch { | |
url = https://github.com/syncthing/syncthing-gtk/commit/b2535e5a9cdb31c4987ab7af37f62d58d38255b7.patch; | |
sha256 = "047v79wz2a9334gbzywlqwpacrk53s26ksvfqaddk06avv8742w7"; | |
}) | |
(substituteAll { | |
src = ./paths.patch; | |
killall = "${killall}/bin/killall"; | |
syncthing = "${syncthing}/bin/syncthing"; | |
}) | |
]; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for your feedback. I've updated the patch to use substituteAll.
@GrahamcOfBorg build python2.pkgs.sounddevice python3.pkgs.sounddevice |
Success on x86_64-linux (full log) Attempted: python2.pkgs.sounddevice, python3.pkgs.sounddevice Partial log (click to expand)
|
Success on aarch64-linux (full log) Attempted: python2.pkgs.sounddevice, python3.pkgs.sounddevice Partial log (click to expand)
|
Motivation for this change
The path to the portaudio library is patched in sounddevice.py library. Problem is that sounddevice passes the path through a function
_find_library
that will try to find the relative library name somewhere on the filesystem. Unfortunately that function doesn't support the absolute library path that is patched in, and gives backNone
. Removing the_find_library
function call resolves this issue.To replicate this error put below content in a file
default.nix
:Then in the same directory run
nix-shell --run python3
Things done
sandbox
innix.conf
on non-NixOS)nix-shell -p nox --run "nox-review wip"
./result/bin/
)nix path-info -S
before and after)