[PATCH] gnu: Add python-apache-libcloud.

  • Done
  • quality assurance status badge
Details
2 participants
  • Danny Milosavljevic
  • Marius Bakke
Owner
unassigned
Submitted by
Danny Milosavljevic
Severity
normal

Debbugs page

Danny Milosavljevic wrote 8 years ago
(address . guix-patches@gnu.org)(name . Danny Milosavljevic)(address . dannym@scratchpost.org)
20170616212156.24333-1-dannym@scratchpost.org
* gnu/packages/python.scm (python-apache-libcloud, python2-apache-libcloud):
New variables.
---
gnu/packages/python.scm | 59 +++++++++++++++++++++++++++++++++++++++++++++++++
1 file changed, 59 insertions(+)

Toggle diff (74 lines)
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))
Marius Bakke wrote 8 years ago
87zid6g2g8.fsf@fastmail.com
Danny Milosavljevic <dannym@scratchpost.org> writes:

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

[...]

Toggle quote (7 lines)
> + (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"?

Toggle quote (20 lines)
> + #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.
-----BEGIN PGP SIGNATURE-----

iQEzBAEBCgAdFiEEu7At3yzq9qgNHeZDoqBt8qM6VPoFAllFMJcACgkQoqBt8qM6
VPrEtAf9HHT+/p3gF2kuJZ0EuW8FkuYCzBXdB43TJYHEw5PFEn/pOGzRjpqVWZol
dwQFNDsAZIjdHhn8mFudu8dOJPm9fm+Xt1Q0FDmyuHR4+v4yv3ax2/Tgc/6E5rDf
x01IshNcEIikWn36AwV3pqJ3cJztpC26ApTdeqV1/LMklZSJA5DXdfd43nc2181s
w9GOTIqP3PFOYgDIV1i9XZtvYJ3mSLmUHhacXGjfhRI+zHACTTy6OKCb47CMfBSo
y2eGwDzJoxjSu9ivK9DeAjdO0MLoug2b1zeqAFQSd4tg9NDODUCWGlJTIhZVVrwa
B1n4f8tN1v6Ywrd0ulioYBSA5hqKqQ==
=4BT4
-----END PGP SIGNATURE-----

Danny Milosavljevic wrote 8 years ago
(name . Marius Bakke)(address . mbakke@fastmail.com)(address . 27400@debbugs.gnu.org)
20170617204606.4f8cdfc7@scratchpost.org
Hi Marius,

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

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

Indeed. Thanks!

Toggle quote (5 lines)
> > + (("'.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.
Danny Milosavljevic wrote 8 years ago
(no subject)
(address . control@debbugs.gnu.org)
20170617204635.7da516de@scratchpost.org
close 27400
?
Your comment

This issue is archived.

To comment on this conversation send an email to 27400@debbugs.gnu.org

To respond to this issue using the mumi CLI, first switch to it
mumi current 27400
Then, you may apply the latest patchset in this issue (with sign off)
mumi am -- -s
Or, compose a reply to this issue
mumi compose
Or, send patches to this issue
mumi send-email *.patch
You may also tag this issue. See list of standard tags. For example, to set the confirmed and easy tags
mumi command -t +confirmed -t +easy
Or, remove the moreinfo tag and set the help tag
mumi command -t -moreinfo -t +help