unofficial mirror of guix-patches@gnu.org 
 help / color / mirror / code / Atom feed
* [bug#27400] [PATCH] gnu: Add python-apache-libcloud.
@ 2017-06-16 21:21 Danny Milosavljevic
  2017-06-17 13:37 ` Marius Bakke
  0 siblings, 1 reply; 3+ messages in thread
From: Danny Milosavljevic @ 2017-06-16 21:21 UTC (permalink / raw)
  To: 27400

* gnu/packages/python.scm (python-apache-libcloud, python2-apache-libcloud):
New variables.
---
 gnu/packages/python.scm | 59 +++++++++++++++++++++++++++++++++++++++++++++++++
 1 file changed, 59 insertions(+)

diff --git a/gnu/packages/python.scm b/gnu/packages/python.scm
index 352a5f333..5807f046e 100644
--- a/gnu/packages/python.scm
+++ b/gnu/packages/python.scm
@@ -98,6 +98,7 @@
   #:use-module (gnu packages readline)
   #:use-module (gnu packages sdl)
   #:use-module (gnu packages shells)
+  #:use-module (gnu packages ssh)
   #:use-module (gnu packages statistics)
   #:use-module (gnu packages tex)
   #:use-module (gnu packages texinfo)
@@ -15324,3 +15325,61 @@ validating Swagger API specifications.")
 
 (define-public python2-swagger-spec-validator
   (package-with-python2 python-swagger-spec-validator))
+
+(define-public python-apache-libcloud
+  (package
+    (name "python-apache-libcloud")
+    (version "2.0.0")
+    (source
+      (origin
+        (method url-fetch)
+        (uri (pypi-uri "apache-libcloud" version))
+        (sha256
+          (base32
+            "1a71z02ckcxld72k4qgmdnkjan52c4wczncs3p2mp5yafh7dsan7"))))
+    (build-system python-build-system)
+    (arguments
+     `(#:phases
+       (modify-phases %standard-phases
+         (add-after 'unpack 'patch-ssh
+           (lambda* (#:key inputs #:allow-other-keys)
+             (substitute* "libcloud/compute/ssh.py"
+               (("'ssh'") (string-append "'" (assoc-ref inputs "openssh")
+                                         "'")))
+             #t))
+         (add-after 'unpack 'patch-tests
+           (lambda _
+             (substitute* "./libcloud/test/test_file_fixtures.py"
+               ;; See <https://issues.apache.org/jira/browse/LIBCLOUD-923>.
+               (("def _ascii") "def _raw_data(self, method, url, body, headers):
+        return (httplib.OK,
+                \"1234abcd\",
+                {\"test\": \"value\"},
+                httplib.responses[httplib.OK])
+    def _ascii"))
+             (substitute* "libcloud/test/compute/test_ssh_client.py"
+               (("class ShellOutSSHClientTests")
+                "@unittest.skip(\"Guix container doesn't have ssh service\")
+class ShellOutSSHClientTests")
+               ;; See <https://issues.apache.org/jira/browse/LIBCLOUD-924>.
+               (("'.xf0.x90.x8d.x88'") "b'\\xF0\\x90\\x8D\\x88'")
+               (("'.xF0', '.x90', '.x8D', '.x88'")
+                "b'\\xF0', b'\\x90', b'\\x8D', b'\\x88'"))
+             #t)))))
+    (inputs
+     `(("openssh" ,openssh)))
+    (propagated-inputs
+     `(("python-paramiko" ,python-paramiko)
+       ("python-requests" ,python-requests)))
+    (native-inputs
+     `(("python-lockfile" ,python-lockfile)
+       ("python-mock" ,python-mock)
+       ("python-requests-mock" ,python-requests-mock)))
+    (home-page "https://libcloud.apache.org/")
+    (synopsis "Unified Cloud API")
+    (description "@code{libcloud} is a Python library for interacting with
+many of the popular cloud service providers using a unified API.")
+    (license license:asl2.0)))
+
+(define-public python2-apache-libcloud
+  (package-with-python2 python-apache-libcloud))

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

* [bug#27400] [PATCH] gnu: Add python-apache-libcloud.
  2017-06-16 21:21 [bug#27400] [PATCH] gnu: Add python-apache-libcloud Danny Milosavljevic
@ 2017-06-17 13:37 ` Marius Bakke
  2017-06-17 18:46   ` Danny Milosavljevic
  0 siblings, 1 reply; 3+ messages in thread
From: Marius Bakke @ 2017-06-17 13:37 UTC (permalink / raw)
  To: Danny Milosavljevic, 27400

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

Danny Milosavljevic <dannym@scratchpost.org> writes:

> * gnu/packages/python.scm (python-apache-libcloud, python2-apache-libcloud):
> New variables.

[...]

> +       (modify-phases %standard-phases
> +         (add-after 'unpack 'patch-ssh
> +           (lambda* (#:key inputs #:allow-other-keys)
> +             (substitute* "libcloud/compute/ssh.py"
> +               (("'ssh'") (string-append "'" (assoc-ref inputs "openssh")
> +                                         "'")))

Should this not be (assoc-ref inputs "openssh") "/bin/ssh"?

> +             #t))
> +         (add-after 'unpack 'patch-tests
> +           (lambda _
> +             (substitute* "./libcloud/test/test_file_fixtures.py"
> +               ;; See <https://issues.apache.org/jira/browse/LIBCLOUD-923>.
> +               (("def _ascii") "def _raw_data(self, method, url, body, headers):
> +        return (httplib.OK,
> +                \"1234abcd\",
> +                {\"test\": \"value\"},
> +                httplib.responses[httplib.OK])
> +    def _ascii"))
> +             (substitute* "libcloud/test/compute/test_ssh_client.py"
> +               (("class ShellOutSSHClientTests")
> +                "@unittest.skip(\"Guix container doesn't have ssh service\")
> +class ShellOutSSHClientTests")
> +               ;; See <https://issues.apache.org/jira/browse/LIBCLOUD-924>.
> +               (("'.xf0.x90.x8d.x88'") "b'\\xF0\\x90\\x8D\\x88'")
> +               (("'.xF0', '.x90', '.x8D', '.x88'")
> +                "b'\\xF0', b'\\x90', b'\\x8D', b'\\x88'"))

Odd that these substitutions are necessary. Could it be something with
our Python build? Or locale in the build environment? LGTM, anyway.

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

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

* [bug#27400] [PATCH] gnu: Add python-apache-libcloud.
  2017-06-17 13:37 ` Marius Bakke
@ 2017-06-17 18:46   ` Danny Milosavljevic
  0 siblings, 0 replies; 3+ messages in thread
From: Danny Milosavljevic @ 2017-06-17 18:46 UTC (permalink / raw)
  To: Marius Bakke; +Cc: 27400

Hi Marius,

On Sat, 17 Jun 2017 15:37:27 +0200
Marius Bakke <mbakke@fastmail.com> wrote:

> Should this not be (assoc-ref inputs "openssh") "/bin/ssh"?

Indeed.  Thanks!

> > +               ;; See <https://issues.apache.org/jira/browse/LIBCLOUD-924>.
> > +               (("'.xf0.x90.x8d.x88'") "b'\\xF0\\x90\\x8D\\x88'")
> > +               (("'.xF0', '.x90', '.x8D', '.x88'")
> > +                "b'\\xF0', b'\\x90', b'\\x8D', b'\\x88'"))  

No idea.  It works fine with Python 2 - and previous versions of apache-libcloud were Python 2 only.

Let's see what they say.

Pushed as 7ea498e5cd55c056492a778203414ce977350142.

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

end of thread, other threads:[~2017-06-17 18:47 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-06-16 21:21 [bug#27400] [PATCH] gnu: Add python-apache-libcloud Danny Milosavljevic
2017-06-17 13:37 ` Marius Bakke
2017-06-17 18:46   ` Danny Milosavljevic

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