diff mbox series

[bug#49469] gnu: Add python-pysox.

Message ID 20211010061525.11302-2-jgart@dismail.de
State New
Headers show
Series [bug#49469] gnu: Add python-pysox. | expand

Checks

Context Check Description
cbaines/comparison success View comparision
cbaines/git branch success View Git branch
cbaines/applying patch success View Laminar job
cbaines/issue success View issue
cbaines/comparison success View comparision
cbaines/git branch success View Git branch
cbaines/applying patch success View Laminar job
cbaines/issue success View issue
cbaines/comparison success View comparision
cbaines/git branch success View Git branch
cbaines/applying patch success View Laminar job
cbaines/issue success View issue
cbaines/comparison success View comparision
cbaines/git branch success View Git branch
cbaines/applying patch success View Laminar job
cbaines/issue success View issue
cbaines/comparison success View comparision
cbaines/git branch success View Git branch
cbaines/applying patch success View Laminar job
cbaines/issue success View issue
cbaines/comparison success View comparision
cbaines/git branch success View Git branch
cbaines/applying patch success View Laminar job
cbaines/issue success View issue

Commit Message

jgart Oct. 10, 2021, 6:15 a.m. UTC
* gnu/packages/audio.scm (python-pysox): New variable.
---
 gnu/packages/audio.scm | 57 ++++++++++++++++++++++++++++++++++++++++++
 1 file changed, 57 insertions(+)

Comments

Arun Isaac Oct. 16, 2021, 10:02 a.m. UTC | #1
Hi jgart,

Thanks for the updated patch! Some feedback follows.

> +(define-public python-pysox
> +  (let ((commit "3d0053381c24ae3490f759d4de87194b85789d36")
> +        (revision "0"))
> +    (package
> +      (name "python-pysox")
> +      (version (git-version "1.4.2" revision commit))

According to PyPI, it seems that the latest version is 1.4.1.

And, I see that upstream is not tagging releases correctly in their git
repo. Could you raise this issue with upstream?

> +      (source
> +        (origin
> +          (method git-fetch)
> +          (uri (git-reference
> +                 (url "https://github.com/rabitt/pysox")

We should prefer the PyPI source tarball. If there is something missing
in the PyPI source tarball, and that's why you are using the GitHub
source, could you add a comment explaining the reason?

> +                  (substitute* "sox/log.py"
> +                    (("Logger\\('sox")
> +                     (string-append "Logger\('" sox-bin))))))

I think the above substitution is not required, because in this instance
'sox' is the name of the logger, rather than the full path to the sox
executable.

> +                  (setenv "PYTHONPATH" (string-append ".:" (getenv
> "PYTHONPATH")))

This setting of PYTHONPATH does not seem to be required. The tests
succeed without it.

> +      (description
> +"@code{pysox} is a wrapper around the @command{sox} command line tool.
> + pysox's API offers @code{Transformer} and @code{Combiner} classes that allow the user to
> +incrementally build up effects and audio manipulations.  @code{pysox} also
> +provides methods for querying audio information such as sample rate,
> +determining whether an audio file is silent and much more.")

I think @code{pysox} should be @code{python-pysox} since we are
referring to the python-pysox scheme variable.

Could you send an updated patch? Also, please do use `git format-patch
-v2', `git format-patch -v3', etc. when sending updated patches.

Thanks!
Arun
Arun Isaac Oct. 16, 2021, 10:05 a.m. UTC | #2
Also, in the next patch, please add a copyright header for yourself.

Thanks!
diff mbox series

Patch

diff --git a/gnu/packages/audio.scm b/gnu/packages/audio.scm
index cc51ac51f3..8b412a63d1 100644
--- a/gnu/packages/audio.scm
+++ b/gnu/packages/audio.scm
@@ -2429,6 +2429,63 @@  compensation, (de)interleaving, and byte-swapping
     ;; original developer.
     (license license:expat)))
 
+(define-public python-pysox
+  (let ((commit "3d0053381c24ae3490f759d4de87194b85789d36")
+        (revision "0"))
+    (package
+      (name "python-pysox")
+      (version (git-version "1.4.2" revision commit))
+      (source
+        (origin
+          (method git-fetch)
+          (uri (git-reference
+                 (url "https://github.com/rabitt/pysox")
+                 (commit commit)))
+          (file-name (git-file-name name version))
+          (sha256
+            (base32
+              "0i62jx92vfpcr2z7lp69yzqdi9idfs3pifl3rzm2akc2c4cr1mac"))))
+      (build-system python-build-system)
+      (arguments
+        `(#:phases
+          (modify-phases %standard-phases
+            (add-after 'unpack 'patch-sox
+              (lambda* (#:key inputs #:allow-other-keys)
+                (let* ((sox-store-path (assoc-ref inputs "sox"))
+                       (sox-bin (string-append sox-store-path "/bin/sox")))
+                  (substitute* "sox/__init__.py"
+                    (("sox -h")
+                     (string-append sox-bin " -h")))
+                  (substitute* "sox/core.py"
+                    (("\\['sox")
+                     (string-append "['" sox-bin)))
+                  (substitute* "sox/log.py"
+                    (("Logger\\('sox")
+                     (string-append "Logger\('" sox-bin))))))
+            (replace 'check
+              (lambda* (#:key inputs outputs tests? #:allow-other-keys)
+                (when tests?
+                  (add-installed-pythonpath inputs outputs)
+                  (setenv "PYTHONPATH" (string-append ".:" (getenv "PYTHONPATH")))
+                  (invoke "pytest")))))))
+      (propagated-inputs
+        `(("python-numpy" ,python-numpy)
+          ("python-typing-extensions" ,python-typing-extensions)))
+      (native-inputs
+        `(("sox" ,sox)
+          ("python-pytest" ,python-pytest)
+          ("python-pytest-cov" ,python-pytest-cov)
+          ("python-soundfile" ,python-soundfile)))
+      (home-page "https://github.com/rabitt/pysox")
+      (synopsis "Python wrapper around sox")
+      (description
+"@code{pysox} is a wrapper around the @command{sox} command line tool.
+ pysox's API offers @code{Transformer} and @code{Combiner} classes that allow the user to
+incrementally build up effects and audio manipulations.  @code{pysox} also
+provides methods for querying audio information such as sample rate,
+determining whether an audio file is silent and much more.")
+      (license license:bsd-3))))
+
 (define-public python-pyaudio
   (package
     (name "python-pyaudio")