diff mbox series

[bug#51314,v2,24/24] gnu: Add octoprint.

Message ID 20211113200230.192559-24-monego@posteo.net
State New
Headers show
Series [bug#51314,v2,01/24] gnu: Add python-sarge. | 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

Vinicius Monego Nov. 13, 2021, 8:02 p.m. UTC
* gnu/packages/printers.scm (octoprint): New variable.
---
 gnu/packages/printers.scm | 118 +++++++++++++++++++++++++++++++++++++-
 1 file changed, 117 insertions(+), 1 deletion(-)
diff mbox series

Patch

diff --git a/gnu/packages/printers.scm b/gnu/packages/printers.scm
index f1535d5db1..c2189a1b79 100644
--- a/gnu/packages/printers.scm
+++ b/gnu/packages/printers.scm
@@ -25,9 +25,15 @@ 
   #:use-module (guix build-system gnu)
   #:use-module (guix build-system python)
   #:use-module ((guix licenses) #:prefix license:)
+  #:use-module (gnu packages check)
   #:use-module (gnu packages libusb)
   #:use-module (gnu packages pkg-config)
-  #:use-module (gnu packages qt))
+  #:use-module (gnu packages python)
+  #:use-module (gnu packages python-check)
+  #:use-module (gnu packages python-web)
+  #:use-module (gnu packages python-xyz)
+  #:use-module (gnu packages qt)
+  #:use-module (gnu packages web))
 
 ;; This is a module for packages related to printer-like devices, but not
 ;; related to CUPS.
@@ -95,6 +101,116 @@  uploaded files that are known to cause issues while printing and which in
 the past have caused support requests on OctoPrint's Community Forums.")
     (license license:agpl3)))
 
+(define-public octoprint
+  (package
+    (name "octoprint")
+    (version "1.7.2")
+    (source
+     (origin
+       (method git-fetch) ; no tests in the PyPI tarball.
+       (uri (git-reference
+             (url "https://github.com/OctoPrint/OctoPrint")
+             (commit version)))
+       (file-name (git-file-name name version))
+       (sha256
+        (base32 "0zvjnbcmszifvr02rsmfzb5v24f1ss8klrnkd9fcg2351nkpqbbd"))
+       (modules '((guix build utils)))
+       (snippet
+        '(begin
+           ;; Remove bundled font-awesome.
+           (delete-file-recursively "src/octoprint/static/vendor") #t))))
+    (build-system python-build-system)
+    (arguments
+     `(#:phases
+       (modify-phases %standard-phases
+         (add-after 'unpack 'relax-version-requirements
+           ;; Octoprint maintains strict version requirements for Python2
+           ;; compatibility.  We're not packaging with Python2, so modify
+           ;; setup.py to relax those versions.  Octoprint will drop Python2
+           ;; support in version 2.0 so we won't need this change after it.
+           (lambda _
+             (substitute* "setup.py"
+               (("cachelib>=0.1,<0.2") "cachelib>=0.1")
+               (("colorlog>=5.0.1,<6") "colorlog>=5.0.1")
+               (("markdown>=3.1,<3.2") "markdown>=3.1,<4")
+               (("watchdog==0.10.4") "watchdog>=0.10.4")
+               (("wrapt>=1.12.1,<1.13") "wrapt>=1.12.1")
+               (("zeroconf>=0.33,<0.34") "zeroconf>=0.33")
+               ;; Relax core packages that are outdated in Guix.
+               (("Jinja2>=2.11.3,<3") "Jinja2>=2.11.2,<3")
+               (("requests>=2.26.0,<3") "requests>=2.25,<3"))))
+         (add-before 'check 'set-home
+           (lambda _
+             (setenv "HOME" (getcwd)))) ; some tests need a writable home
+         (replace 'check
+           (lambda* (#:key inputs outputs tests? #:allow-other-keys)
+             (when tests?
+               (add-installed-pythonpath inputs outputs)
+               (invoke "python" "-m" "pytest" "tests" "-k"
+                       (string-append
+                        ;; These tests try to write to the source tree and
+                        ;; fail with PermissionError.
+                        "not test_add_file_overwrite"
+                        " and not test_set_external_modification"))))))))
+    (native-inputs
+     `(("python-ddt" ,python-ddt)
+       ("python-mock" ,python-mock)
+       ("python-pytest" ,python-pytest)
+       ("python-pytest-doctest-custom"
+        ,python-pytest-doctest-custom)))
+    (inputs
+     `(("octoprint-filecheck" ,octoprint-filecheck)
+       ("octoprint-firmwarecheck" ,octoprint-firmwarecheck)
+       ("octoprint-pisupport" ,octoprint-pisupport)
+       ("python-appdirs" ,python-appdirs)
+       ("python-blinker" ,python-blinker)
+       ("python-cachelib" ,python-cachelib)
+       ("python-click" ,python-click)
+       ("python-colorlog" ,python-colorlog)
+       ("python-emoji" ,python-emoji)
+       ("python-feedparser" ,python-feedparser)
+       ("python-filetype" ,python-filetype)
+       ("python-flask" ,python-flask)
+       ("python-flask-assets" ,python-flask-assets)
+       ("python-flask-babel" ,python-flask-babel)
+       ("python-flask-login" ,python-flask-login)
+       ("python-future" ,python-future)
+       ("python-immutabledict" ,python-immutabledict)
+       ("python-itsdangerous" ,python-itsdangerous)
+       ("python-jinja2" ,python-jinja2)
+       ("python-markdown" ,python-markdown)
+       ("python-markupsafe" ,python-markupsafe)
+       ("python-netaddr" ,python-netaddr)
+       ("python-netifaces" ,python-netifaces)
+       ("python-pathvalidate" ,python-pathvalidate)
+       ("python-pkginfo" ,python-pkginfo)
+       ("python-psutil" ,python-psutil)
+       ("python-pylru" ,python-pylru)
+       ("python-pyserial" ,python-pyserial)
+       ("python-pyyaml" ,python-pyyaml)
+       ("python-regex" ,python-regex)
+       ("python-requests" ,python-requests)
+       ("python-sarge" ,python-sarge)
+       ("python-semantic-version"
+        ,python-semantic-version)
+       ("python-sentry-sdk" ,python-sentry-sdk)
+       ("python-tornado" ,python-tornado-6)
+       ("python-unidecode" ,python-unidecode)
+       ("python-watchdog" ,python-watchdog)
+       ("python-websocket-client"
+        ,python-websocket-client)
+       ("python-werkzeug" ,python-werkzeug)
+       ("python-wrapt" ,python-wrapt)
+       ("python-zeroconf" ,python-zeroconf)
+       ("python-zipstream-new" ,python-zipstream-new)))
+    (home-page "https://octoprint.org")
+    (synopsis "Web interface for 3D printers")
+    (description "OctoPrint provides a snappy web interface for controlling
+consumer 3D printers.")
+    ;; The web interface contains many third party JavaScript libraries under
+    ;; different licenses.  Check THIRDPARTYLICENSES.md.
+    (license license:agpl3)))
+
 (define-public robocut
   (package
     (name "robocut")