diff mbox series

[bug#51676,v2] gnu: Add python-miniupnpc

Message ID 20220114010954.28886-1-singpolyma@singpolyma.net
State Accepted
Headers show
Series [bug#51676,v2] gnu: Add python-miniupnpc | 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

Commit Message

Stephen Paul Weber Jan. 14, 2022, 1:09 a.m. UTC
* gnu/packages/python-xyz.scm (python-miniupnpc): New variable.
---
 gnu/packages/python-xyz.scm | 34 ++++++++++++++++++++++++++++++++++
 1 file changed, 34 insertions(+)

Comments

Xinglu Chen Feb. 9, 2022, 2:07 p.m. UTC | #1
Stephen schrieb am Donnerstag der 13. Januar 2022 um 20:09 -05:

> * gnu/packages/python-xyz.scm (python-miniupnpc): New variable.
> ---
>  gnu/packages/python-xyz.scm | 34 ++++++++++++++++++++++++++++++++++
>  1 file changed, 34 insertions(+)
>
> diff --git a/gnu/packages/python-xyz.scm b/gnu/packages/python-xyz.scm
> index 0091165d37..0ad5dfd85c 100644
> --- a/gnu/packages/python-xyz.scm
> +++ b/gnu/packages/python-xyz.scm
> @@ -3150,6 +3150,40 @@ server.")
>       "@code{pafy} is a python library to retrieve YouTube content and metadata.")
>      (license license:lgpl3+)))
>  
> +(define-public python-miniupnpc
> +  (package
> +    (name "python-miniupnpc")
> +    (version "2.2.3")
> +    (source
> +     (origin
> +       (method git-fetch)
> +       (uri
> +        (git-reference
> +         (url "https://github.com/miniupnp/miniupnp")
> +         (commit "miniupnpc_2_2_3")))

The version should not be hard-coded.  You could use
‘string-replace-substring’ from (ice-9 string-fun).

  (string-replace-substring version "." "_")


> +       (file-name
> +        (git-file-name name version))
> +       (sha256
> +        (base32 "0h7smsp1fnwsmgg3n70813ln9j5y20g61x25s4kn91vzkbbq9188"))))

I am getting a hash mismatch

--8<---------------cut here---------------start------------->8---
expected hash: 0h7smsp1fnwsmgg3n70813ln9j5y20g61x25s4kn91vzkbbq9188
actual hash:   03q1rlzvfzm15g1bfw2zqzavlsyaypnaf2k3cz6ha7k5rirkdy0l
--8<---------------cut here---------------end--------------->8---

> +    (build-system python-build-system)
> +    (arguments
> +     `(#:phases
> +       (modify-phases %standard-phases
> +         (add-after 'unpack 'subdir
> +           (lambda _
> +             (chdir "miniupnpc")
> +             (setenv "CC" ,(cc-for-target))
> +             (substitute* "Makefile"
> +               (("SH = /bin/sh") (string-append "SH = " (which "bash"))))

Nitpick: Could we just match on /bin/sh?

> +             #t)))))

Phases don’t have to return #t.

> +    (inputs (list python)) ; We are building a Python extension.
> +    (native-inputs (list which))
> +    (synopsis "UPnP client for Python")
> +    (description "Miniupnpc is a client library for Python programs to set up
> +port forwards using UPnP.")

Acronyms should be expanded at least once, see “17.4.4 Synopses and
Descriptions” in the manual.

  @acronym{UPnP, Universal Plug and Play}
diff mbox series

Patch

diff --git a/gnu/packages/python-xyz.scm b/gnu/packages/python-xyz.scm
index 0091165d37..0ad5dfd85c 100644
--- a/gnu/packages/python-xyz.scm
+++ b/gnu/packages/python-xyz.scm
@@ -3150,6 +3150,40 @@  server.")
      "@code{pafy} is a python library to retrieve YouTube content and metadata.")
     (license license:lgpl3+)))
 
+(define-public python-miniupnpc
+  (package
+    (name "python-miniupnpc")
+    (version "2.2.3")
+    (source
+     (origin
+       (method git-fetch)
+       (uri
+        (git-reference
+         (url "https://github.com/miniupnp/miniupnp")
+         (commit "miniupnpc_2_2_3")))
+       (file-name
+        (git-file-name name version))
+       (sha256
+        (base32 "0h7smsp1fnwsmgg3n70813ln9j5y20g61x25s4kn91vzkbbq9188"))))
+    (build-system python-build-system)
+    (arguments
+     `(#:phases
+       (modify-phases %standard-phases
+         (add-after 'unpack 'subdir
+           (lambda _
+             (chdir "miniupnpc")
+             (setenv "CC" ,(cc-for-target))
+             (substitute* "Makefile"
+               (("SH = /bin/sh") (string-append "SH = " (which "bash"))))
+             #t)))))
+    (inputs (list python)) ; We are building a Python extension.
+    (native-inputs (list which))
+    (synopsis "UPnP client for Python")
+    (description "Miniupnpc is a client library for Python programs to set up
+port forwards using UPnP.")
+    (home-page "http://miniupnp.free.fr")
+    (license license:bsd-3)))
+
 (define-public python2-funcsigs
   (package
     (name "python2-funcsigs")