all messages for Guix-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* [bug#57118] [PATCH] gnu: Add linode-cli.
@ 2022-08-10 14:18 raingloom
  2022-08-15  8:32 ` Mathieu Othacehe
                   ` (2 more replies)
  0 siblings, 3 replies; 11+ messages in thread
From: raingloom @ 2022-08-10 14:18 UTC (permalink / raw)
  To: 57118; +Cc: raingloom

* gnu/packages/python-xyz.scm (linode-cli): New variable.
---
 gnu/packages/python-xyz.scm | 69 +++++++++++++++++++++++++++++++++++++
 1 file changed, 69 insertions(+)

diff --git a/gnu/packages/python-xyz.scm b/gnu/packages/python-xyz.scm
index e5326274c0..1625df48c2 100644
--- a/gnu/packages/python-xyz.scm
+++ b/gnu/packages/python-xyz.scm
@@ -30353,3 +30353,72 @@ (define-public i3-autotiling
      "Script for Sway and i3 to automatically switch the horizontal/vertical
  window split orientation.")
     (license license:gpl3)))
+
+;; linode-cli would normally fetch this at build time
+;; TODO: is there a way to refer to previous versions? is there even a point
+;; in trying to?
+(define linode-openapi-spec
+  (origin
+    (method url-fetch)
+    (uri "https://www.linode.com/docs/api/openapi.yaml")
+    (sha256
+     (base32
+      "1jcjfnagjihcy03fcmn5sghdf7a80798xjgj1x7z3ncqwd5aggwg"))))
+
+(define-public linode-cli
+  (package
+    (name "linode-cli")
+    (version "5.22.0")
+    (synopsis "Tool for managing Linode resources")
+    (home-page "https://www.linode.com/docs/products/tools/cli/")
+    (source
+     (origin
+       (method git-fetch)
+       (uri (git-reference
+             (url "https://github.com/linode/linode-cli")
+             (commit version)))
+       (sha256
+        (base32
+         "1fv53wikx745kci86xrsq9kfsgv0a65srhywdw32cab1wywwpn2z"))))
+    (build-system python-build-system)
+    (arguments '(#:tests? #f ;; requires personal access token
+                 #:phases
+                 (modify-phases %standard-phases
+                   (add-after 'build 'bake-api
+                     (lambda* (#:key inputs #:allow-other-keys)
+                       ;; The "build" make target tries to do some Python 2
+                       ;; stuff, so instead we just take the two lines we care
+                       ;; about:
+                       (invoke "python3" "-m" "linodecli" "bake"
+                               (assoc-ref inputs
+                                          "linode-openapi-spec")
+                               "--skip-config")
+                       (copy-file "data-3" "linodecli/data-3")))
+                   (add-before 'install 'fix-bash-completions-path
+                     (lambda* (#:key outputs #:allow-other-keys)
+                       ;; rename it so setup.py thinks it's missing and
+                       ;; doesn't try to install it to /etc
+                       (rename-file "linode-cli.sh" "completions")
+                       ;; TODO for some reason these don't work?
+                       ;; I don't use bash, so I leave it for someone else to
+                       ;; figure out.
+                       (install-file "completions"
+                                  (string-append
+                                   (assoc-ref outputs "out")
+                                   "/share/bash-completion/"))))
+                   (replace 'sanity-check
+                     (lambda _
+                       ;; this way it doesn't ask for an access token
+                       (invoke "linode-cli" "--version" "--skip-config"))))))
+    (native-inputs
+     `(("linode-openapi-spec" ,linode-openapi-spec)))
+    (inputs
+     (list
+      python-terminaltables
+      python-requests
+      python-pyyaml))
+    (description
+     "A wrapper around the Linode API, which gives you the ability to manage
+your Linode account from the command line. Almost any task that can be done
+through the Cloud Manager can also be performed through the CLI.")
+    (license license:bsd-3)))
-- 
2.37.1





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

end of thread, other threads:[~2024-04-01  7:54 UTC | newest]

Thread overview: 11+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2022-08-10 14:18 [bug#57118] [PATCH] gnu: Add linode-cli raingloom
2022-08-15  8:32 ` Mathieu Othacehe
2022-08-15 11:42 ` [bug#57118] [PATCH v2] " raingloom
2022-08-31 21:33   ` [bug#57118] [PATCH] " Ludovic Courtès
2022-09-01  1:10     ` Csepp
2022-09-01  8:52       ` Ludovic Courtès
2022-09-01 20:06         ` Csepp
2022-09-02  9:13           ` Ludovic Courtès
2022-09-17 20:13             ` Csepp
2022-09-17 20:24           ` Maxime Devos
2024-04-01  7:53 ` [bug#57118] Linode-cli license Steve George

Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/guix.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.