diff mbox series

[bug#52116,2/2] gnu: Add printrun.

Message ID BYAPR05MB4023D4330B53BF414D91907EC5639@BYAPR05MB4023.namprd05.prod.outlook.com
State New
Headers show
Series None | expand

Commit Message

Morgan Smith Nov. 26, 2021, 12:58 a.m. UTC
From: Morgan Smith <Morgan.J.Smith@outlook.com>

* gnu/packages/printers.scm (printrun): New variable.
---
 gnu/packages/printers.scm | 66 +++++++++++++++++++++++++++++++++++++++
 1 file changed, 66 insertions(+)
diff mbox series

Patch

diff --git a/gnu/packages/printers.scm b/gnu/packages/printers.scm
index 619a2750e0..91ab1a0dfb 100644
--- a/gnu/packages/printers.scm
+++ b/gnu/packages/printers.scm
@@ -25,6 +25,7 @@  (define-module (gnu packages printers)
   #:use-module (guix download)
   #:use-module (guix build-system gnu)
   #:use-module (guix build-system perl)
+  #:use-module (guix build-system python)
   #:use-module (guix build-system cmake)
   #:use-module ((guix licenses) #:prefix license:)
   #:use-module (gnu packages compression)
@@ -32,6 +33,7 @@  (define-module (gnu packages printers)
   #:use-module (gnu packages python)
   #:use-module (gnu packages python-xyz)
   #:use-module (gnu packages python-science)
+  #:use-module (gnu packages libffi)
   #:use-module (gnu packages libusb)
   #:use-module (gnu packages elf)
   #:use-module (gnu packages gcc)
@@ -46,6 +48,8 @@  (define-module (gnu packages printers)
   #:use-module (gnu packages perl-check)
   #:use-module (gnu packages pkg-config)
   #:use-module (gnu packages web)
+  #:use-module (gnu packages wxwidgets)
+  #:use-module (gnu packages xml)
   #:use-module (gnu packages xorg)
   #:use-module (gnu packages qt))
 
@@ -288,3 +292,65 @@  (define-public slic3rapp
     (synopsis "")
     (description "")
     (license #f)))
+
+(define-public printrun
+  (package
+    (name "printrun")
+    (version "2.0.0rc8")
+    (source
+     (origin
+       (method git-fetch)
+       (uri (git-reference
+             (url "https://github.com/kliment/Printrun")
+             (commit (string-append "printrun-" version))))
+       (file-name (git-file-name name version))
+       (sha256
+        (base32 "0bvwrfhmn2km03fp343bd9ddjxv8sp3d0qdxk786rflw4yksbxgn"))))
+    (build-system python-build-system)
+    (arguments
+     `(#:phases
+       (modify-phases %standard-phases
+         (add-after 'unpack 'patch-files
+           (lambda* (#:key outputs #:allow-other-keys)
+             (substitute* "requirements.txt"
+               (("== 4.1.0") ">= 4.0.0") ;; wxPython
+               (("dbus-python.*") "")) ;; Not sure why it can't find dbus-python
+             (delete-file "printrun/power/osx.py")
+             (delete-file "printrun/packer.py") ;; Uses a non-free library
+
+             ;; Changing the value of python variables
+             (substitute* "printrun/utils.py"
+               (("shared_pronterface_images_dir = .*")
+                (string-append "shared_pronterface_images_dir = \"" (assoc-ref outputs "out")
+                               "/share/pronterface/images\"\n"))
+               (("shared_pixmaps_dir = .*")
+                (string-append "shared_pixmaps_dir = \"" (assoc-ref outputs "out")
+                               "/share/pixmaps\"\n"))
+               (("shared_pronterface_dir = .*")
+                (string-append "shared_pixmaps_dir = \"" (assoc-ref outputs "out")
+                               "/share/pronterface\"\n")))))
+         (add-before 'check 'setup-display
+           (lambda* (#:key tests? inputs outputs #:allow-other-keys)
+             (when tests?
+               (system "Xvfb :1 &")
+               (setenv "DISPLAY" ":1")))))))
+    (inputs
+     `(("python-appdirs" ,python-appdirs)
+       ("python-cairocffi" ,python-cairocffi)
+       ("python-cairosvg" ,python-cairosvg)
+       ("python-cffi" ,python-cffi)
+       ("python-dbus" ,python-dbus)
+       ("python-lxml" ,python-lxml)
+       ("python-numpy" ,python-numpy)
+       ("python-psutil" ,python-psutil)
+       ("python-pyglet" ,python-pyglet)
+       ("python-pyserial" ,python-pyserial)
+       ("python-wxpython" ,python-wxpython)))
+    (native-inputs
+     `(("python-cython" ,python-cython)
+       ("xvfb" ,xorg-server-for-tests)))
+    (home-page "https://github.com/kliment/Printrun/")
+    (synopsis "Printrun is a full suite of host interfaces for 3D printers and CNC")
+    (description "Printrun consists of printcore, pronsole and pronterface, and a small
+collection of helpful scripts.")
+    (license license:gpl3+)))