Subject: Re: [bug#44275] [PATCH] gnu: Add python-pydub.

From: Tanguy Le Carrour <[email-masked]>
Date: Fri, 30 Oct 2020 10:19:01 +0100

Hi Leo!

Le 10/29, Leo Famulari a écrit :
> On Thu, Oct 29, 2020 at 10:14:27AM -0400, Leo Famulari wrote:
> > Okay, I will take a look at the scipy thing today.
> 
> I decided to let scipy be propagated since it's normal for Python things
> to be propagated. But I still think we should hard-code the reference to
> ffmpeg.
> 
> I looked at the code, and it finds ffmpeg-related programs in
> 'pydub/utils.py', in the functions get_encoder_name(),
> get_player_name(), and get_prober_name().
> 
> I think it should be sufficient to substitute any mention of the words
> "ffmpeg", "ffplay", and "ffprobe" with the full store-path of those
> programs.

+1…

> I included a diff on your patch. You can see exactly what it does by
> adding (error "Stopping...") after the substitute*, building with
> --keep-failed, and then looking at the 'pydub/utils.py' file.
> 
> diff --git a/gnu/packages/python-xyz.scm b/gnu/packages/python-xyz.scm
> index 3c2d882003e..47ec542e6d1 100644
> --- a/gnu/packages/python-xyz.scm
> +++ b/gnu/packages/python-xyz.scm
> @@ -16696,9 +16696,24 @@ ignoring formatting changes.")
>           "0sfwfq7yjv4bl3yqbmizszscafvwf4zr40hzbsy7rclvzyznh333"))))
>      (build-system python-build-system)
>      (home-page "http://pydub.com")
> +    (arguments
> +     `(#:phases
> +       (modify-phases %standard-phases
> +         (add-after 'unpack 'patch-ffmpeg-references
> +           (lambda* (#:key inputs #:allow-other-keys)
> +             (let* ((ffmpeg-store-item (assoc-ref inputs "ffmpeg"))
> +                    (ffmpeg (string-append ffmpeg-store-item "/bin/ffmpeg"))
> +                    (ffplay (string-append ffmpeg-store-item "/bin/ffplay"))
> +                    (ffprobe (string-append ffmpeg-store-item "/bin/ffprobe")))
> +               (substitute* "pydub/utils.py"
> +                 (("ffmpeg") ffmpeg)
> +                 (("ffplay") ffplay)
> +                 (("ffprobe") ffprobe))
> +               #t))))))
> +    (inputs
> +     `(("ffmpeg" ,ffmpeg)))
>      (propagated-inputs
> -     `(("ffmpeg" ,ffmpeg)
> -       ("python-scipy" ,python-scipy)))
> +     `(("python-scipy" ,python-scipy)))
>      (synopsis "Manipulate audio with an simple and easy high level interface")
>      (description
>       "@code{pydub} makes it easy to manipulate audio.  It relies on

So I guess you didn't see the one I submitted: https://debbugs.gnu.org/cgi/bugreport.cgi?bug=44275#14 :-(
I was really proud, because… it worked! :-)

But yours is shorter and does the job (even if it "brute-force" replaces all
the occurences of "ffmpeg", even in the comments!) and I'm totally fine
with it!

Thanks again for your help and your time!

-- 
Tanguy