unofficial mirror of guix-patches@gnu.org 
 help / color / mirror / code / Atom feed
* [bug#56803] [PATCH 0/6] Add hydrus network and its dependencies
@ 2022-07-27 18:57 Tomasz Jeneralczyk
  2022-07-27 19:00 ` [bug#56803] [PATCH 1/6] gnu: Add swftools Tomasz Jeneralczyk
                   ` (6 more replies)
  0 siblings, 7 replies; 24+ messages in thread
From: Tomasz Jeneralczyk @ 2022-07-27 18:57 UTC (permalink / raw)
  To: 56803; +Cc: Tomasz Jeneralczyk

This patch series will add hydrus network along with all dependencies it needs and fixes
to already existing packages.
The hydrus-network package added in the last patch depends on all previous patches to
work, so I want to sent it all in one go.

Hydrus is something I wanted to use and decided to package, but this sent me on a deep rabbit
hole of packaging new software and fixing what's already present. There are still problems with
swftools and hydrus that I couldn't resolve, but those are minor and I'll dedicate time to fixing
them in the future. I provided more details in relevant commit messages and source comments.



Tomasz Jeneralczyk (6):
  gnu: Add swftools.
  gnu: Add python-xvfbwrapper.
  gnu: Add python-mpv.
  gnu: Add opencv-with-python.
  gnu: Update python-cloudscraper.
  gnu: Add hydrus-network.

 gnu/packages/animation.scm        |  93 ++++++++++++++++++++++
 gnu/packages/image-processing.scm |  12 +++
 gnu/packages/image-viewers.scm    | 127 ++++++++++++++++++++++++++++++
 gnu/packages/python-check.scm     |  22 ++++++
 gnu/packages/python-web.scm       |  10 +--
 gnu/packages/python-xyz.scm       |  62 +++++++++++++++
 6 files changed, 321 insertions(+), 5 deletions(-)


base-commit: ecb91c993dcce7e6c3faa0d156013dac42380cc6
-- 
2.37.1





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

* [bug#56803] [PATCH 1/6] gnu: Add swftools.
  2022-07-27 18:57 [bug#56803] [PATCH 0/6] Add hydrus network and its dependencies Tomasz Jeneralczyk
@ 2022-07-27 19:00 ` Tomasz Jeneralczyk
  2022-07-27 19:00 ` [bug#56803] [PATCH 2/6] gnu: Add python-xvfbwrapper Tomasz Jeneralczyk
                   ` (5 subsequent siblings)
  6 siblings, 0 replies; 24+ messages in thread
From: Tomasz Jeneralczyk @ 2022-07-27 19:00 UTC (permalink / raw)
  To: 56803; +Cc: Tomasz Jeneralczyk

This package will built all of swftools' tools but one: PDF2SWF, so I
purposefuly commented it out of description.
Swftools includes the source tarball of an old version of xpdf and I have not
been successful in replacing it with the version distributed in guix. However
I believe the near-completeness of the package warrants a release.

Also updated copyright and used modules.

*gnu/packages/animation.scm (swftools): Add variable.
---
 gnu/packages/animation.scm | 93 ++++++++++++++++++++++++++++++++++++++
 1 file changed, 93 insertions(+)

diff --git a/gnu/packages/animation.scm b/gnu/packages/animation.scm
index c281772563..3078f586cf 100644
--- a/gnu/packages/animation.scm
+++ b/gnu/packages/animation.scm
@@ -3,6 +3,7 @@
 ;;; Copyright © 2018–2021 Tobias Geerinckx-Rice <me@tobias.gr>
 ;;; Copyright © 2019 Pkill -9 <pkill9@runbox.com>
 ;;; Copyright © 2020, 2021 Vinicius Monego <monego@posteo.net>
+;;; Copyright © 2022 Tomasz Jeneralczyk <tj@schwi.pl>
 ;;;
 ;;; This file is part of GNU Guix.
 ;;;
@@ -47,6 +48,7 @@ (define-module (gnu packages animation)
   #:use-module (gnu packages image)
   #:use-module (gnu packages imagemagick)
   #:use-module (gnu packages jemalloc)
+  #:use-module (gnu packages mp3)
   #:use-module (gnu packages networking)
   #:use-module (gnu packages pcre)
   #:use-module (gnu packages perl)
@@ -496,3 +498,94 @@ (define-public pencil2d
 lets you create traditional hand-drawn animations (cartoons) using both bitmap
 and vector graphics.")
     (license license:gpl2)))
+
+(define-public swftools
+  ;; Last release of swftools was 0.9.2 on 2012-04-21 - it is really old and
+  ;; does not compile with what's available in guix, master on the other hand works.
+  (let ((commit "772e55a271f66818b06c6e8c9b839befa51248f4")
+        (revision "1"))
+    (package
+      (name "swftools")
+      (version (git-version "0.9.2" revision commit))
+      (source
+       (origin
+         (method git-fetch)
+         (uri (git-reference
+               (url "https://github.com/matthiaskramm/swftools")
+               (commit commit)))
+         (sha256
+                 (base32 "0a8a29rn7gpxnba3spnvkpdgr7mdlssvr273mzw5b2wjvbzard3w"))
+         (file-name (git-file-name name version))
+         (modules '((guix build utils)))
+         (snippet
+          '(begin
+             ;; To fix a linking error I followed the workaround in:
+             ;; https://github.com/matthiaskramm/swftools/issues/178
+             ;; and implented it as a two-step snippet because substitute*
+             ;; does not match multiline regexes.
+             (substitute* "lib/lame/quantize.c"
+               ;; move inline keywords to the same line as their function headers
+               (("^inline.*\n") "inline "))
+             (substitute* "lib/lame/quantize.c"
+               ;; make this particular function not inline
+               (("inline (void bitpressure_strategy1)" _ f) f))))))
+      (build-system gnu-build-system)
+      (arguments
+       (list #:tests? #f)) ; no rule for check
+      (inputs (list zlib freetype giflib libjpeg-turbo lame))
+      (home-page "http://www.swftools.org")
+      (synopsis "Collection of utilities for working with Adobe Flash files")
+      (description "SWFTools is a collection of utilities for working with
+Adobe Flash files (SWF files).  The tool collection includes programs for
+reading SWF files, combining them, and creating them from other content (like
+images, sound files, videos or sourcecode).  The current collection is
+ comprised of the programs detailed below:
+
+@itemize
+@comment PDF2SWF is not currentlybeing  build alongside other tools. The next
+@comment two lines should be uncommented if this will ever get fixed.
+@comment @item
+@comment @command{PDF2SWF} A PDF to SWF Converter.
+
+@item
+@command{SWFCombine} A multi-function tool for inserting, contatenating,
+stacking and changing parameters in SWFs.
+
+@item
+@command{SWFStrings} Scans SWFs for text data.
+@item
+@command{SWFDump} Prints out various informations about SWFs.
+
+@item
+@command{JPEG2SWF} Takes one or more JPEG pictures and generates a SWF
+slideshow from them.
+
+@item
+@command{PNG2SWF} Like JPEG2SWF, only for PNGs.
+
+@item
+@command{GIF2SWF} Converts GIFs to SWF. Also able to handle animated gifs.
+
+@item
+@command{WAV2SWF} Converts WAV audio files to SWFs, using the L.A.M.E. MP3
+ encoder library.
+
+@item
+@command{Font2SWF} Converts font files (TTF, Type1) to SWF.
+
+@item
+@command{SWFBBox} Allows to read out, optimize and readjust SWF bounding boxes.
+
+@item
+@command{SWFC} A tool for creating SWF files from simple script files. Supports
+both ActionScript 2.0 aand 3.0.
+
+@item
+@command{SWFExtract} Allows to extract Movieclips, Sounds, Images etc. from SWF
+ files.
+
+@item
+@command{AS3Compile} A standalone ActionScript 3.0 compiler. Mostly compatible
+ with Flex.
+@end itemize")
+      (license license:gpl2))))
-- 
2.37.1





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

* [bug#56803] [PATCH 2/6] gnu: Add python-xvfbwrapper.
  2022-07-27 18:57 [bug#56803] [PATCH 0/6] Add hydrus network and its dependencies Tomasz Jeneralczyk
  2022-07-27 19:00 ` [bug#56803] [PATCH 1/6] gnu: Add swftools Tomasz Jeneralczyk
@ 2022-07-27 19:00 ` Tomasz Jeneralczyk
  2022-07-27 19:00 ` [bug#56803] [PATCH 3/6] gnu: Add python-mpv Tomasz Jeneralczyk
                   ` (4 subsequent siblings)
  6 siblings, 0 replies; 24+ messages in thread
From: Tomasz Jeneralczyk @ 2022-07-27 19:00 UTC (permalink / raw)
  To: 56803; +Cc: Tomasz Jeneralczyk

Also updates copyright.

* gnu/packages/python-check.scm (python-xvfbwrapper): New variable.
---
 gnu/packages/python-check.scm | 22 ++++++++++++++++++++++
 1 file changed, 22 insertions(+)

diff --git a/gnu/packages/python-check.scm b/gnu/packages/python-check.scm
index af0e5be28b..e5d9600490 100644
--- a/gnu/packages/python-check.scm
+++ b/gnu/packages/python-check.scm
@@ -15,6 +15,7 @@
 ;;; Copyright © 2021 Bonface Munyoki Kilyungi <me@bonfacemunyoki.com>
 ;;; Copyright © 2022 Malte Frank Gerdes <malte.f.gerdes@gmail.com>
 ;;; Copyright © 2022 Felix Gruber <felgru@posteo.net>
+;;; Copyright © 2022 Tomasz Jeneralczyk <tj@schwi.pl>
 ;;;
 ;;; This file is part of GNU Guix.
 ;;;
@@ -2373,3 +2374,24 @@ (define-public python-pycotap
 attachments).
 @end itemize")
     (license license:expat)))
+
+(define-public python-xvfbwrapper
+  (package
+    (name "python-xvfbwrapper")
+    (version "0.2.9")
+    (source (origin
+              (method url-fetch)
+              (uri (pypi-uri "xvfbwrapper" version))
+              (sha256
+               (base32
+                "097wxhvp01ikqpg1z3v8rqhss6f1vwr399zpz9a05d2135bsxx5w"))))
+    (build-system python-build-system)
+    (propagated-inputs (list xorg-server-for-tests))
+    (home-page "https://github.com/cgoldberg/xvfbwrapper")
+    (synopsis "Python module for controlling virtual displays with Xvfb")
+    (description
+     "Xvfb (X virtual framebuffer) is a display server implementing
+the X11 display server protocol.  It runs in memory and does not require a
+physical display.  Only a network layer is necessary.  Xvfb is useful for
+running acceptance tests on headless servers.")
+    (license license:expat)))
-- 
2.37.1





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

* [bug#56803] [PATCH 3/6] gnu: Add python-mpv.
  2022-07-27 18:57 [bug#56803] [PATCH 0/6] Add hydrus network and its dependencies Tomasz Jeneralczyk
  2022-07-27 19:00 ` [bug#56803] [PATCH 1/6] gnu: Add swftools Tomasz Jeneralczyk
  2022-07-27 19:00 ` [bug#56803] [PATCH 2/6] gnu: Add python-xvfbwrapper Tomasz Jeneralczyk
@ 2022-07-27 19:00 ` Tomasz Jeneralczyk
  2022-07-27 22:05   ` Maxime Devos
  2022-07-27 22:09   ` Maxime Devos
  2022-07-27 19:00 ` [bug#56803] [PATCH 4/6] gnu: Add opencv-with-python Tomasz Jeneralczyk
                   ` (3 subsequent siblings)
  6 siblings, 2 replies; 24+ messages in thread
From: Tomasz Jeneralczyk @ 2022-07-27 19:00 UTC (permalink / raw)
  To: 56803; +Cc: Tomasz Jeneralczyk

Author states that the license of the library is inherited from libmpv,
which can be either GPLv2 or LPGLv2.1. That's why the package's license is
set to be the same as mpv's.

One of the tests had to be disabled because it would neither fail or pass,
blocking all other tests from running and the package from finishing its build
process. I have no clue on why it happens.

Rarely some tests fail without any apparent reason. This is possibly related
to: https://github.com/jaseg/python-mpv/issues/209

Also add copyright.

* gnu/packages/python-xyz.scm (python-mpv): Add variable.
---
 gnu/packages/python-xyz.scm | 62 +++++++++++++++++++++++++++++++++++++
 1 file changed, 62 insertions(+)

diff --git a/gnu/packages/python-xyz.scm b/gnu/packages/python-xyz.scm
index ac7c0d6066..5bc40ecaea 100644
--- a/gnu/packages/python-xyz.scm
+++ b/gnu/packages/python-xyz.scm
@@ -124,6 +124,7 @@
 ;;; Copyright © 2022 Artyom V. Poptsov <poptsov.artyom@gmail.com>
 ;;; Copyright © 2022 Paul A. Patience <paul@apatience.com>
 ;;; Copyright © 2022 Jean-Pierre De Jesus DIAZ <me@jeandudey.tech>
+;;; Copyright © 2022 Tomasz Jeneralczyk <tj@schwi.pl>
 ;;;
 ;;; This file is part of GNU Guix.
 ;;;
@@ -30203,3 +30204,64 @@ (define-public python-bsdiff4
 binary diff utility.  It also provides two command-line tools, @code{bsdiff4}
 and @code{bspatch4}.")
     (license license:bsd-2)))
+
+(define-public python-mpv
+  (package
+    (name "python-mpv")
+    (version "v1.0.1")
+    (source
+     (origin
+       ;; python-mpv from pypi does not include the tests directory.
+       (method git-fetch)
+       (uri (git-reference
+             (url "https://github.com/jaseg/python-mpv")
+             (commit version)))
+       (file-name (git-file-name name version))
+       (sha256
+        (base32
+         "10w6j3n62ap45sf6q487kz8z6g58sha37i14fa2hhng794z7a8jh"))
+       (modules '((guix build utils)))
+       (snippet
+        (with-extensions (list mpv)
+          #~(begin
+              ;; Without an absolute path it is not able find and
+              ;; load the libmpv library.
+              (substitute* "mpv.py"
+                (("(sofile = )(.*)" _ pre post)
+                 (string-append pre "\"" #$mpv "/lib/\" + " post)))
+              ;; One of the tests never completes, so neutering it using
+              ;; early return allows other test to run without issue.
+              (substitute* "tests/test_mpv.py"
+                ;; Note the typo in "prooperty" - this was fixed later in
+                ;; upstream but has no effect on whether the tests hangs or not.
+                (("test_wait_for_prooperty_event_overflow.*" line)
+                 ;; The long whitespace between \n and return is to match the
+                 ;; identation level, which is significant in python.
+                 (string-append line "\n        return\n"))))))))
+    (build-system python-build-system)
+    (arguments
+     (list #:phases
+           (with-imported-modules '((guix build utils))
+             #~(modify-phases %standard-phases
+                 (add-before 'check 'prepare-for-tests
+                   (lambda _
+                     ;; Fontconfig throws errors when it has no cache dir to use.
+                     (setenv "XDG_CACHE_HOME" (getcwd))
+                     ;; Some tests fail without a writable and readable HOME.
+                     (setenv "HOME" (getcwd))))))))
+    (native-inputs
+     (list python-xvfbwrapper)) ; needed for tests only
+    (inputs (list mpv))
+    (propagated-inputs (list python-pillow)) ; for raw screenshots
+    (home-page "https://github.com/jaseg/python-mpv")
+    (synopsis "Python interface to the mpv media player")
+    (description
+     "python-mpv is a ctypes-based python interface to the mpv media player.
+It gives you more or less full control of all features of the player, just
+as the lua interface does.")
+    ;; From the project's README:
+    ;;  python-mpv inherits the underlying libmpv's license, which can be either
+    ;;  GPLv2 or later (default) or LGPLv2.1 or later. For details, see the mpv
+    ;;  copyright page.
+    (license (package-license mpv))))
+
-- 
2.37.1





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

* [bug#56803] [PATCH 4/6] gnu: Add opencv-with-python.
  2022-07-27 18:57 [bug#56803] [PATCH 0/6] Add hydrus network and its dependencies Tomasz Jeneralczyk
                   ` (2 preceding siblings ...)
  2022-07-27 19:00 ` [bug#56803] [PATCH 3/6] gnu: Add python-mpv Tomasz Jeneralczyk
@ 2022-07-27 19:00 ` Tomasz Jeneralczyk
  2022-07-27 19:00 ` [bug#56803] [PATCH 5/6] gnu: Update python-cloudscraper Tomasz Jeneralczyk
                   ` (2 subsequent siblings)
  6 siblings, 0 replies; 24+ messages in thread
From: Tomasz Jeneralczyk @ 2022-07-27 19:00 UTC (permalink / raw)
  To: 56803; +Cc: Tomasz Jeneralczyk

Also add copyright.

* gnu/packages/image-processing.scm (opencv-with-python): Add variable.
---
 gnu/packages/image-processing.scm | 12 ++++++++++++
 1 file changed, 12 insertions(+)

diff --git a/gnu/packages/image-processing.scm b/gnu/packages/image-processing.scm
index bcb1d7a2f6..9496155ec7 100644
--- a/gnu/packages/image-processing.scm
+++ b/gnu/packages/image-processing.scm
@@ -20,6 +20,7 @@
 ;;; Copyright © 2021 Guillaume Le Vaillant <glv@posteo.net>
 ;;; Copyright © 2021 Ivan Gankevich <i.gankevich@spbu.ru>
 ;;; Copyright © 2022 Maxim Cournoyer <maxim.cournoyer@gmail.com>
+;;; Copyright © 2022 Tomasz Jeneralczyk <tj@schwi.pl>
 ;;;
 ;;; This file is part of GNU Guix.
 ;;;
@@ -657,6 +658,17 @@ (define-public opencv
     (home-page "https://opencv.org/")
     (license license:bsd-3)))
 
+(define-public opencv-with-python
+  (package
+    (inherit opencv)
+    (name "opencv-with-python")
+    (arguments
+     (let* ((args (package-arguments opencv)))
+       (assoc-set! args #:configure-flags
+                   (append (list "-DBUILD_opencv_python3=ON")
+                           (assoc-ref args #:configure-flags)))
+       args))))
+
 (define-public vips
   (package
     (name "vips")
-- 
2.37.1





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

* [bug#56803] [PATCH 5/6] gnu: Update python-cloudscraper.
  2022-07-27 18:57 [bug#56803] [PATCH 0/6] Add hydrus network and its dependencies Tomasz Jeneralczyk
                   ` (3 preceding siblings ...)
  2022-07-27 19:00 ` [bug#56803] [PATCH 4/6] gnu: Add opencv-with-python Tomasz Jeneralczyk
@ 2022-07-27 19:00 ` Tomasz Jeneralczyk
  2022-07-27 19:00 ` [bug#56803] [PATCH 6/6] gnu: Add hydrus-network Tomasz Jeneralczyk
  2022-08-14 12:46 ` [bug#56803] [PATCH v2 1/6] gnu: Add swftools Tomasz Jeneralczyk
  6 siblings, 0 replies; 24+ messages in thread
From: Tomasz Jeneralczyk @ 2022-07-27 19:00 UTC (permalink / raw)
  To: 56803; +Cc: Tomasz Jeneralczyk

Neither 1.2.58 nor 1.2.60 version of python-cloudscraper requires
compatibility with python2 afaik.

This removes possible collisions with packages that depend on the mainstream
version of python-pyparsing.

* gnu/packages/python-web.scm (python-cloudscraper): Update to 1.2.60
* gnu/packages/python-web.scm (python-cloudscraper)[propagated-inputs]: Change
python-pyparsing to its mainstream version
---
 gnu/packages/python-web.scm | 10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)

diff --git a/gnu/packages/python-web.scm b/gnu/packages/python-web.scm
index 7c5e5651c8..42e501d3dd 100644
--- a/gnu/packages/python-web.scm
+++ b/gnu/packages/python-web.scm
@@ -53,6 +53,7 @@
 ;;; Copyright © 2022 Peter Polidoro <peter@polidoro.io>
 ;;; Copyright © 2022 Antero Mejr <antero@mailbox.org>
 ;;; Copyright © 2022 Luis Henrique Gomes Higino <luishenriquegh2701@gmail.com>
+;;; Copyright © 2022 Tomasz Jeneralczyk <tj@schwi.pl>
 ;;;
 ;;; This file is part of GNU Guix.
 ;;;
@@ -6243,17 +6244,16 @@ (define-public python-http-ece
 (define-public python-cloudscraper
   (package
     (name "python-cloudscraper")
-    (version "1.2.58")
+    (version "1.2.60")
     (source
      (origin
        (method git-fetch)
        (uri (git-reference
              (url "https://github.com/VeNoMouS/cloudscraper")
-             ;; Corresponds to 1.2.58
-             (commit "f3a3d067ea8b5238e9a0948aed0c3fa0d9c29b96")))
+             (commit "1.2.60")))
        (file-name (git-file-name name version))
        (sha256
-        (base32 "18fbp086imabjxly04rrchbf6n6m05bpd150zxbw7z2w3mjnpsqd"))
+        (base32 "00cmxgwdm0x1j4a4ipwvpzih735hdzidljbijk1b3laj3dgvnvsm"))
        (modules '((guix build utils)))
        (snippet
         '(with-directory-excursion "cloudscraper"
@@ -6293,7 +6293,7 @@ (define-public python-cloudscraper
            python-requests
            python-requests-toolbelt
            python-responses
-           python-pyparsing-2.4.7))
+           python-pyparsing))
     (native-inputs
      (list python-pytest))
     (home-page "https://github.com/venomous/cloudscraper")
-- 
2.37.1





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

* [bug#56803] [PATCH 6/6] gnu: Add hydrus-network.
  2022-07-27 18:57 [bug#56803] [PATCH 0/6] Add hydrus network and its dependencies Tomasz Jeneralczyk
                   ` (4 preceding siblings ...)
  2022-07-27 19:00 ` [bug#56803] [PATCH 5/6] gnu: Update python-cloudscraper Tomasz Jeneralczyk
@ 2022-07-27 19:00 ` Tomasz Jeneralczyk
  2022-08-09 15:09   ` [bug#56803] [PATCH 0/6] Add hydrus network and its dependencies Ludovic Courtès
  2022-08-14 12:46 ` [bug#56803] [PATCH v2 1/6] gnu: Add swftools Tomasz Jeneralczyk
  6 siblings, 1 reply; 24+ messages in thread
From: Tomasz Jeneralczyk @ 2022-07-27 19:00 UTC (permalink / raw)
  To: 56803; +Cc: Tomasz Jeneralczyk

Hydrus-network has a weekly release cycle and is meant to be used from its own
directory so I artificially spread it out to comply with guix's expectations.

Three binaries from inputs are copied into a directory hydrus knows about:
  * ffmpeg - works as expected
  * swftools - does not do anything neither on guix or Arch linux - possibly
  an unfinished feature, but I left it in, in case it gets fixed in a future version.
  * miniupnpc - times out on my system, but it should work otherwise.

I was not able to build the program's help files. Updating
python-pymdown-extensions to its latest version might be the solution, but
this would require also packaging its new build system that is not present in
guix yet. I decided to cut short there.

Also adds copyright and new used modules.

* gnu/packages/image-viewers.scm (hydrus-network): Add variable.
---
 gnu/packages/image-viewers.scm | 127 +++++++++++++++++++++++++++++++++
 1 file changed, 127 insertions(+)

diff --git a/gnu/packages/image-viewers.scm b/gnu/packages/image-viewers.scm
index 8d4d2351c3..9574384761 100644
--- a/gnu/packages/image-viewers.scm
+++ b/gnu/packages/image-viewers.scm
@@ -24,6 +24,7 @@
 ;;; Copyright © 2021 Zheng Junjie <873216071@qq.com>
 ;;; Copyright © 2021 dissent <disseminatedissent@protonmail.com>
 ;;; Copyright © 2022 Michael Rohleder <mike@rohleder.de>
+;;; Copyright © 2022 Tomasz Jeneralczyk <tj@schwi.pl>
 ;;;
 ;;; This file is part of GNU Guix.
 ;;;
@@ -54,6 +55,7 @@ (define-module (gnu packages image-viewers)
   #:use-module (guix build-system qt)
   #:use-module (gnu packages autotools)
   #:use-module (gnu packages algebra)
+  #:use-module (gnu packages animation)
   #:use-module (gnu packages backup)
   #:use-module (gnu packages base)
   #:use-module (gnu packages bash)
@@ -84,14 +86,20 @@ (define-module (gnu packages image-viewers)
   #:use-module (gnu packages photo)
   #:use-module (gnu packages pkg-config)
   #:use-module (gnu packages python)
+  #:use-module (gnu packages python-check)
+  #:use-module (gnu packages python-compression)
+  #:use-module (gnu packages python-crypto)
+  #:use-module (gnu packages python-web)
   #:use-module (gnu packages python-xyz)
   #:use-module (gnu packages qt)
   #:use-module (gnu packages suckless)
   #:use-module (gnu packages terminals)
+  #:use-module (gnu packages upnp)
   #:use-module (gnu packages version-control)
   #:use-module (gnu packages video)
   #:use-module (gnu packages web)
   #:use-module (gnu packages xdisorg)
+  #:use-module (gnu packages xml)
   #:use-module (gnu packages xorg)
   #:use-module (gnu packages))
 
@@ -973,3 +981,122 @@ (define-public xzgv
     (description
      "xzgv is a fast image viewer that provides extensive keyboard support.")
     (license license:gpl2+)))
+
+(define-public hydrus-network
+  (package
+    (name "hydrus-network")
+    (version "492")
+    (source
+     (origin
+       (method git-fetch)
+       (uri (git-reference
+             (url "https://github.com/hydrusnetwork/hydrus")
+             (commit (string-append "v" version))))
+       (file-name (git-file-name name version))
+       (sha256
+        (base32
+         "0cyc499is97r8wri0y86yw6kpfcvc0a1yslr8g8sk4vhlly8gnra"))))
+    (build-system python-build-system)
+    (arguments
+     (list
+      #:phases
+      (with-imported-modules '((guix build utils))
+        #~(let ((bin-dir "/libexec/hydrus")
+                (static-dir "/share/hydrus/static"))
+            (modify-phases %standard-phases
+              ;; Hydrus is a python program but does not uses setup.py or any
+              ;; other build system to build itself - it's delivered ready to
+              ;; run from the source.
+              (replace 'check
+                (lambda _
+                  (setenv "DISPLAY" ":0")
+                  (setenv "XDG_CACHE_HOME" (getcwd))
+                  (setenv "HOME" (getcwd))
+                  (system "Xvfb &")
+                  (invoke "python" "test.py")))
+              (delete 'build)
+              (add-before 'install 'patch-variables
+                (lambda* (#:key outputs #:allow-other-keys)
+                  (let ((out (assoc-ref outputs "out")))
+                    (substitute* "hydrus/core/HydrusConstants.py"
+                      (("STATIC_DIR = (.*)\n")
+                       (string-append "STATIC_DIR = \"" out static-dir "\""))
+                      (("BIN_DIR = (.*)\n")
+                       (string-append "BIN_DIR = \"" out bin-dir "\"\n"))))))
+              (replace 'install
+                (lambda* (#:key outputs inputs #:allow-other-keys)
+                  (let* ((out (assoc-ref outputs "out"))
+                         (python (assoc-ref inputs "python"))
+                         (client-path (string-append out "/bin/hydrus"))
+                         (server-path (string-append out "/bin/hydrus-server")))
+                    (copy-recursively "static"
+                                      (string-append out static-dir))
+                    (copy-recursively "hydrus"
+                                      (string-append out
+                                                     "/lib/python"
+                                                     (python-version python)
+                                                     "/site-packages/hydrus"))
+                    (mkdir (string-append out "/bin"))
+                    (copy-file "client.py" client-path)
+                    (chmod client-path #o0555)
+                    (copy-file "server.py" server-path)
+                    (chmod server-path #o0555))))
+              ;; Hydrus searches for some binaries at bin-dir so it's important
+              ;; to put them there so it can find and use them.
+              (add-after 'install 'pupulate-libexec
+                (lambda* (#:key outputs inputs #:allow-other-keys)
+                  (let* ((out (assoc-ref outputs "out"))
+                         (out/bin-dir (string-append out bin-dir)))
+                    (mkdir-p out/bin-dir)
+                    (copy-file
+                     (string-append (assoc-ref inputs "swftools") "/bin/swfrender")
+                     (string-append out/bin-dir "/swfrender_linux"))
+                    (copy-file
+                     (string-append (assoc-ref inputs "ffmpeg") "/bin/ffmpeg")
+                     (string-append out/bin-dir "/ffmpeg"))
+                    (copy-file
+                     (string-append (assoc-ref inputs "miniupnpc") "/bin/upnpc")
+                     (string-append out/bin-dir "/miniupnpc"))))))))))
+    ;; All native-inputs are only needed for the the check phase
+    (native-inputs
+     (list
+      python-nose
+      python-mock
+      python-httmock
+      xorg-server-for-tests))
+    ;; All python packages were taken from static/build_files/linux/requirements.txt
+    (propagated-inputs
+     (list
+      python-beautifulsoup4
+      python-cbor2
+      python-chardet
+      python-cloudscraper
+      python-html5lib
+      python-lxml
+      python-lz4
+      python-numpy
+      opencv-with-python ; drop-in replacement for opencv-python-headless
+      python-pillow
+      python-psutil
+      python-pylzma
+      python-pyopenssl
+      python-pyside-2
+      python-pysocks
+      python-mpv
+      python-pyyaml
+      python-qtpy
+      python-requests
+      python-send2trash
+      python-service-identity
+      python-six
+      python-twisted))
+    (inputs (list swftools ffmpeg miniupnpc))
+    (synopsis "Organize your media with tags like a dektop booru")
+    (description
+     "The hydrus network client is an application written for
+internet-fluent media nerds who have large image/swf/webm collections.
+It browses with tags instead of folders, a little like a booru on your desktop.
+Advanced users can share tags and files anonymously through custom servers that
+any user may run.  Everything is free and privacy is the first concern.")
+    (home-page "https://hydrusnetwork.github.io/hydrus/")
+    (license license:wtfpl2)))
-- 
2.37.1





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

* [bug#56803] [PATCH 3/6] gnu: Add python-mpv.
  2022-07-27 19:00 ` [bug#56803] [PATCH 3/6] gnu: Add python-mpv Tomasz Jeneralczyk
@ 2022-07-27 22:05   ` Maxime Devos
  2022-07-28 14:58     ` Tomasz Jeneralczyk
  2022-07-27 22:09   ` Maxime Devos
  1 sibling, 1 reply; 24+ messages in thread
From: Maxime Devos @ 2022-07-27 22:05 UTC (permalink / raw)
  To: Tomasz Jeneralczyk, 56803


[-- Attachment #1.1.1: Type: text/plain, Size: 1488 bytes --]


On 27-07-2022 21:00, Tomasz Jeneralczyk wrote:
> +        (with-extensions (list mpv)

IIUC, that's for using Guile modules defined in packages -- but mpv is 
not a Guile package, so I expect that the surrounding with-extensions 
can be dropped.

> +     (let* ((args (package-arguments opencv)))
> +       (assoc-set! args #:configure-flags
> +                   (append (list "-DBUILD_opencv_python3=ON")
> +                           (assoc-ref args #:configure-flags)))
Look for substitute-keyword-arguments, which isn't stateful and hence 
there is less risk of accidentally modifying the arguments of the parent 
package.  Also, any reason for not adding this to the original package? 
(Possibly there is one).

> +              (replace 'check
> +                (lambda _
> +                  (setenv "DISPLAY" ":0")
> +                  (setenv "XDG_CACHE_HOME" (getcwd))
> +                  (setenv "HOME" (getcwd))
> +                  (system "Xvfb &")
> +                  (invoke "python" "test.py")))
Run "./pre-inst-env guix lint hydrus-network", it will have a remark 
about this.  Also, technically this is racy -- it's possible for python 
to start before Xvfb is ready though so far this doesn't seem to have 
caused trouble for other packages yet AFAIK -- I recommend "xvfb-run" 
"--" "python" "test.py" instead.

(I just scrolled quickly through the patches, a more full review will 
have to come later.)

Greetings,
Maxime.


[-- Attachment #1.1.2: OpenPGP public key --]
[-- Type: application/pgp-keys, Size: 929 bytes --]

[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 236 bytes --]

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

* [bug#56803] [PATCH 3/6] gnu: Add python-mpv.
  2022-07-27 19:00 ` [bug#56803] [PATCH 3/6] gnu: Add python-mpv Tomasz Jeneralczyk
  2022-07-27 22:05   ` Maxime Devos
@ 2022-07-27 22:09   ` Maxime Devos
  1 sibling, 0 replies; 24+ messages in thread
From: Maxime Devos @ 2022-07-27 22:09 UTC (permalink / raw)
  To: Tomasz Jeneralczyk, 56803


[-- Attachment #1.1.1: Type: text/plain, Size: 403 bytes --]


On 27-07-2022 21:00, Tomasz Jeneralczyk wrote:
> One of the tests had to be disabled because it would neither fail or pass,
> blocking all other tests from running and the package from finishing its build
> process. I have no clue on why it happens.

This sounds like something upstream should be informed about, otherwise 
they wouldn't know there is something to fix.

Greetings,
Maxime


[-- Attachment #1.1.2: OpenPGP public key --]
[-- Type: application/pgp-keys, Size: 929 bytes --]

[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 236 bytes --]

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

* [bug#56803] [PATCH 3/6] gnu: Add python-mpv.
  2022-07-27 22:05   ` Maxime Devos
@ 2022-07-28 14:58     ` Tomasz Jeneralczyk
  2022-08-09 15:14       ` [bug#56803] [PATCH 0/6] Add hydrus network and its dependencies Ludovic Courtès
  2022-08-09 16:59       ` [bug#56803] [PATCH 3/6] gnu: Add python-mpv Maxime Devos
  0 siblings, 2 replies; 24+ messages in thread
From: Tomasz Jeneralczyk @ 2022-07-28 14:58 UTC (permalink / raw)
  To: Maxime Devos; +Cc: 56803

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

On 2022-07-27 22:05, Maxime Devos wrote:
> On 27-07-2022 21:00, Tomasz Jeneralczyk wrote:
> IIUC, that's for using Guile modules defined in packages -- but mpv is
> not a Guile package, so I expect that the surrounding with-extensions
> can be dropped.
You're right. I dropped it with no negative consequences.

> This sounds like something upstream should be informed about, otherwise 
> they wouldn't know there is something to fix.
I had a friend on arch linux run those tests and everything worked just 
fine, so it might have something to do with guix
itself or an incomplete package definition. In any case, I'll make sure 
to write a proper bug report in the upstream repo later.


> Look for substitute-keyword-arguments, which isn't stateful and hence
> there is less risk of accidentally modifying the arguments of the
> parent package.  Also, any reason for not adding this to the original
> package? (Possibly there is one).
Thanks, this macro is not documented in manual, but it looks much nicer 
now.
The reason I made a new package is simply because someone on irc 
recommended me to do as such. Though your question made me realize
that just adding one flag worked because all the necessary packages to 
build python buildings were in opencv package already...
maybe originally it was intended for the python bindings to be included 
in opencv? And so I added the flag to opencv and removed
my original package - it works all the same.


> Run "./pre-inst-env guix lint hydrus-network", it will have a remark
> about this.  Also, technically this is racy -- it's possible for
> python to start before Xvfb is ready though so far this doesn't seem
> to have caused trouble for other packages yet AFAIK -- I recommend
> "xvfb-run" "--" "python" "test.py" instead.
I though I missed something so I ran lint again, but it only said 
there's a new version of hydrus available.
Nevertheless I changed the invocation to what you recommended. I also 
updated hydrus to version 493.


> (I just scrolled quickly through the patches, a more full review will
> have to come later.)
Thank you for all your comments so far.
I made changes but I wont send them as patches until I fix all the 
problems or get a confirmation that there's nothing more to do.

However I'm attaching a "preview" diff of the changes I'll want to 
iclude in v2 of my patches.
I suppose I should only send v2 of the ones I changed, right?.

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: wip-changes-0.diff --]
[-- Type: text/x-diff; name=wip-changes-0.diff, Size: 5343 bytes --]

diff --git a/gnu/packages/image-processing.scm b/gnu/packages/image-processing.scm
index 9496155ec7..6417233245 100644
--- a/gnu/packages/image-processing.scm
+++ b/gnu/packages/image-processing.scm
@@ -511,6 +511,8 @@ (define-public opencv
              ;; DISPATCH is the list of optional dispatches.
              "-DCPU_BASELINE=SSE2"
 
+             "-DBUILD_opencv_python3=ON"
+
              ,@(match (%current-system)
                  ("x86_64-linux"
                   '("-DCPU_DISPATCH=NEON;VFPV3;FP16;SSE;SSE2;SSE3;SSSE3;SSE4_1;SSE4_2;POPCNT;AVX;FP16;AVX2;FMA3;AVX_512F;AVX512_SKX"
@@ -658,17 +660,6 @@ (define-public opencv
     (home-page "https://opencv.org/")
     (license license:bsd-3)))
 
-(define-public opencv-with-python
-  (package
-    (inherit opencv)
-    (name "opencv-with-python")
-    (arguments
-     (let* ((args (package-arguments opencv)))
-       (assoc-set! args #:configure-flags
-                   (append (list "-DBUILD_opencv_python3=ON")
-                           (assoc-ref args #:configure-flags)))
-       args))))
-
 (define-public vips
   (package
     (name "vips")
diff --git a/gnu/packages/image-viewers.scm b/gnu/packages/image-viewers.scm
index 9574384761..4ebc891427 100644
--- a/gnu/packages/image-viewers.scm
+++ b/gnu/packages/image-viewers.scm
@@ -985,7 +985,7 @@ (define-public xzgv
 (define-public hydrus-network
   (package
     (name "hydrus-network")
-    (version "492")
+    (version "493")
     (source
      (origin
        (method git-fetch)
@@ -995,7 +995,7 @@ (define-public hydrus-network
        (file-name (git-file-name name version))
        (sha256
         (base32
-         "0cyc499is97r8wri0y86yw6kpfcvc0a1yslr8g8sk4vhlly8gnra"))))
+         "1rr2mx3cxjmkbgqdp7827yl3smpgrjs58ljmhx1k1c7pa5cac4xi"))))
     (build-system python-build-system)
     (arguments
      (list
@@ -1012,8 +1012,7 @@ (define-public hydrus-network
                   (setenv "DISPLAY" ":0")
                   (setenv "XDG_CACHE_HOME" (getcwd))
                   (setenv "HOME" (getcwd))
-                  (system "Xvfb &")
-                  (invoke "python" "test.py")))
+                  (invoke "xvfb-run" "python" "test.py")))
               (delete 'build)
               (add-before 'install 'patch-variables
                 (lambda* (#:key outputs #:allow-other-keys)
@@ -1060,10 +1059,10 @@ (define-public hydrus-network
     ;; All native-inputs are only needed for the the check phase
     (native-inputs
      (list
+      xvfb-run
       python-nose
       python-mock
-      python-httmock
-      xorg-server-for-tests))
+      python-httmock))
     ;; All python packages were taken from static/build_files/linux/requirements.txt
     (propagated-inputs
      (list
@@ -1075,7 +1074,7 @@ (define-public hydrus-network
       python-lxml
       python-lz4
       python-numpy
-      opencv-with-python ; drop-in replacement for opencv-python-headless
+      opencv                     ; drop-in replacement for opencv-python-headless
       python-pillow
       python-psutil
       python-pylzma
diff --git a/gnu/packages/python-xyz.scm b/gnu/packages/python-xyz.scm
index 5bc40ecaea..ddfb2b12a4 100644
--- a/gnu/packages/python-xyz.scm
+++ b/gnu/packages/python-xyz.scm
@@ -30222,22 +30222,21 @@ (define-public python-mpv
          "10w6j3n62ap45sf6q487kz8z6g58sha37i14fa2hhng794z7a8jh"))
        (modules '((guix build utils)))
        (snippet
-        (with-extensions (list mpv)
-          #~(begin
-              ;; Without an absolute path it is not able find and
-              ;; load the libmpv library.
-              (substitute* "mpv.py"
-                (("(sofile = )(.*)" _ pre post)
-                 (string-append pre "\"" #$mpv "/lib/\" + " post)))
-              ;; One of the tests never completes, so neutering it using
-              ;; early return allows other test to run without issue.
-              (substitute* "tests/test_mpv.py"
-                ;; Note the typo in "prooperty" - this was fixed later in
-                ;; upstream but has no effect on whether the tests hangs or not.
-                (("test_wait_for_prooperty_event_overflow.*" line)
-                 ;; The long whitespace between \n and return is to match the
-                 ;; identation level, which is significant in python.
-                 (string-append line "\n        return\n"))))))))
+        #~(begin
+            ;; Without an absolute path it is not able find and
+            ;; load the libmpv library.
+            (substitute* "mpv.py"
+              (("(sofile = )(.*)" _ pre post)
+               (string-append pre "\"" #$mpv "/lib/\" + " post)))
+            ;; One of the tests never completes, so neutering it using
+            ;; early return allows other test to run without issue.
+            (substitute* "tests/test_mpv.py"
+              ;; Note the typo in "prooperty" - this was fixed later in
+              ;; upstream but has no effect on whether the tests hangs or not.
+              (("test_wait_for_prooperty_event_overflow.*" line)
+               ;; The long whitespace between \n and return is to match the
+               ;; identation level, which is significant in python.
+               (string-append line "\n        return\n")))))))
     (build-system python-build-system)
     (arguments
      (list #:phases

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

* [bug#56803] [PATCH 0/6] Add hydrus network and its dependencies
  2022-07-27 19:00 ` [bug#56803] [PATCH 6/6] gnu: Add hydrus-network Tomasz Jeneralczyk
@ 2022-08-09 15:09   ` Ludovic Courtès
  0 siblings, 0 replies; 24+ messages in thread
From: Ludovic Courtès @ 2022-08-09 15:09 UTC (permalink / raw)
  To: Tomasz Jeneralczyk; +Cc: 56803

Hi Tomasz,

Tomasz Jeneralczyk <tj@schwi.pl> skribis:

> Hydrus-network has a weekly release cycle and is meant to be used from its own
> directory so I artificially spread it out to comply with guix's expectations.
>
> Three binaries from inputs are copied into a directory hydrus knows about:
>   * ffmpeg - works as expected
>   * swftools - does not do anything neither on guix or Arch linux - possibly
>   an unfinished feature, but I left it in, in case it gets fixed in a future version.
>   * miniupnpc - times out on my system, but it should work otherwise.
>
> I was not able to build the program's help files. Updating
> python-pymdown-extensions to its latest version might be the solution, but
> this would require also packaging its new build system that is not present in
> guix yet. I decided to cut short there.

Perhaps these comments, or some of them, should go as comments in the
source?  That will prove helpful next time you or someone else tries to
work on the package.

> +      (with-imported-modules '((guix build utils))

This is unnecessary as (guix build utils) is always present on the build
side.

> +              (replace 'install
> +                (lambda* (#:key outputs inputs #:allow-other-keys)
> +                  (let* ((out (assoc-ref outputs "out"))
> +                         (python (assoc-ref inputs "python"))
> +                         (client-path (string-append out "/bin/hydrus"))
> +                         (server-path (string-append out "/bin/hydrus-server")))

Nitpick: GNU and Guix convention is to use the term “path” to denote a
search path (like $PATH, etc.) and to use “file name” (or “file”) to
denote a file name, as is the case here.

In this case it might be enough to write ‘client’ instead of
‘client-path’, and similarly for ‘server-path’.

> +              ;; Hydrus searches for some binaries at bin-dir so it's important
> +              ;; to put them there so it can find and use them.

In general, the solution here, rather than copy files like the ‘ffmpeg’
executable, would be to patch Hydrus so that it contains the absolute
file name of ‘ffmpeg’ as returned by (search-input-file inputs "/bin/ffmpeg").

How does that sound?

Thanks,
Ludo’.




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

* [bug#56803] [PATCH 0/6] Add hydrus network and its dependencies
  2022-07-28 14:58     ` Tomasz Jeneralczyk
@ 2022-08-09 15:14       ` Ludovic Courtès
  2022-08-13 14:34         ` Tomasz Jeneralczyk
  2022-08-09 16:59       ` [bug#56803] [PATCH 3/6] gnu: Add python-mpv Maxime Devos
  1 sibling, 1 reply; 24+ messages in thread
From: Ludovic Courtès @ 2022-08-09 15:14 UTC (permalink / raw)
  To: Tomasz Jeneralczyk; +Cc: Maxime Devos, 56803

Hi,

Tomasz Jeneralczyk <tj@schwi.pl> skribis:

> +        #~(begin
> +            ;; Without an absolute path it is not able find and
> +            ;; load the libmpv library.
> +            (substitute* "mpv.py"
> +              (("(sofile = )(.*)" _ pre post)
> +               (string-append pre "\"" #$mpv "/lib/\" + " post)))

In addition, this substitution should be done in a phase rather than in
a snippet, because (1) the result of ‘guix build -S’ should be
platform-independent and thus not include the file name of ‘mpv’ for a
particular system, and (2) the reference to variable ‘mpv’ at the top
level can cause problems due to circular dependencies among modules.

For clarity, could you resent the whole series with those changes,
squashing the relevant amendments?

Thanks in advance,
Ludo’.




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

* [bug#56803] [PATCH 3/6] gnu: Add python-mpv.
  2022-07-28 14:58     ` Tomasz Jeneralczyk
  2022-08-09 15:14       ` [bug#56803] [PATCH 0/6] Add hydrus network and its dependencies Ludovic Courtès
@ 2022-08-09 16:59       ` Maxime Devos
  1 sibling, 0 replies; 24+ messages in thread
From: Maxime Devos @ 2022-08-09 16:59 UTC (permalink / raw)
  To: Tomasz Jeneralczyk; +Cc: 56803


[-- Attachment #1.1.1.1: Type: text/plain, Size: 787 bytes --]


On 28-07-2022 16:58, Tomasz Jeneralczyk wrote:
>
>> Run "./pre-inst-env guix lint hydrus-network", it will have a remark
>> about this.  Also, technically this is racy -- it's possible for
>> python to start before Xvfb is ready though so far this doesn't seem
>> to have caused trouble for other packages yet AFAIK -- I recommend
>> "xvfb-run" "--" "python" "test.py" instead.
> I though I missed something so I ran lint again, but it only said 
> there's a new version of hydrus available.
> Nevertheless I changed the invocation to what you recommended. I also 
> updated hydrus to version 493. 

Looks like the linter ignored hydrus-network because it doesn't 
understand the 'let' construct ... work for later (not this patch 
series) ...

Greetings,
Maxime.


[-- Attachment #1.1.1.2: Type: text/html, Size: 1374 bytes --]

[-- Attachment #1.1.2: OpenPGP public key --]
[-- Type: application/pgp-keys, Size: 929 bytes --]

[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 236 bytes --]

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

* [bug#56803] [PATCH 0/6] Add hydrus network and its dependencies
  2022-08-09 15:14       ` [bug#56803] [PATCH 0/6] Add hydrus network and its dependencies Ludovic Courtès
@ 2022-08-13 14:34         ` Tomasz Jeneralczyk
  2022-08-13 21:26           ` ( via Guix-patches via
  0 siblings, 1 reply; 24+ messages in thread
From: Tomasz Jeneralczyk @ 2022-08-13 14:34 UTC (permalink / raw)
  To: Ludovic Courtès; +Cc: Maxime Devos, 56803

On 2022-08-09 15:09, Ludovic Courtès wrote:
> Perhaps these comments, or some of them, should go as comments in the
> source?  That will prove helpful next time you or someone else tries to
> work on the package.
They cluttered the code with meta-information that I didn't consider to 
be directly related to the package's source. Thought anyone searching 
would see the commit message and that would be enough. I'll add them 
back in if that's what you prefer.

> In general, the solution here, rather than copy files like the ‘ffmpeg’
> executable, would be to patch Hydrus so that it contains the absolute
> file name of ‘ffmpeg’ as returned by (search-input-file inputs 
> "/bin/ffmpeg").
> 
> How does that sound?
At the time I thought that directly patching the binary paths could 
break some logic, but I looked into it and it looks like I only had to 
patch one `if` statement. This could change in future releases, but it's 
not likely. It appears to work as well and maybe even better - Now 
miniupnpc isn't timing out for me, which might or might not be because 
of this change.

> In addition, this substitution should be done in a phase rather than in
> a snippet, because (1) the result of ‘guix build -S’ should be
> platform-independent and thus not include the file name of ‘mpv’ for a
> particular system, and (2) the reference to variable ‘mpv’ at the top
> level can cause problems due to circular dependencies among modules.
I didn't know that, but it makes sense. I moved the code into its own 
phase.
And if I understand the 2nd point correctly I should use something like 
`(assoc-ref inputs "mpv")` instead of `#$mpv`, right? I  cannot use 
`(search-input-file ...)` because the name of the mpv's lib is 
determined during runtime by the python code and I didn't want to 
hardcode the mpv so file's version.

After I finish making the changes I'll send the whole patchset again, it 
will also include updated packages to their newest release and be 
rebased onto current master.

Thank you for taking the time to review my work.




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

* [bug#56803] [PATCH 0/6] Add hydrus network and its dependencies
  2022-08-13 14:34         ` Tomasz Jeneralczyk
@ 2022-08-13 21:26           ` ( via Guix-patches via
  2022-08-14 10:10             ` Tomasz Jeneralczyk
  0 siblings, 1 reply; 24+ messages in thread
From: ( via Guix-patches via @ 2022-08-13 21:26 UTC (permalink / raw)
  To: Tomasz Jeneralczyk, Ludovic Courtès; +Cc: Maxime Devos, 56803

Hey,

On Sat Aug 13, 2022 at 3:34 PM BST, Tomasz Jeneralczyk wrote:
> > In addition, this substitution should be done in a phase rather than in
> > a snippet, because (1) the result of ‘guix build -S’ should be
> > platform-independent and thus not include the file name of ‘mpv’ for a
> > particular system, and (2) the reference to variable ‘mpv’ at the top
> > level can cause problems due to circular dependencies among modules.
> And if I understand the 2nd point correctly I should use something like 
> `(assoc-ref inputs "mpv")` instead of `#$mpv`, right? I  cannot use 
> `(search-input-file ...)` because the name of the mpv's lib is 
> determined during runtime by the python code and I didn't want to 
> hardcode the mpv so file's version.

No, the assoc-ref style is basically deprecated last I heard. The problem
is with snippets: apparently something with the definition of the `snippet`
field can cause module dependency issues, whereas `arguments` does not
suffer from the same. IIRC, the issue is that the former is not specifie
as a `(delayed)` field. So, #$pkg is okay in arguments, but sometimes not
in snippets.

    -- (




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

* [bug#56803] [PATCH 0/6] Add hydrus network and its dependencies
  2022-08-13 21:26           ` ( via Guix-patches via
@ 2022-08-14 10:10             ` Tomasz Jeneralczyk
  2022-08-14 10:11               ` ( via Guix-patches via
  0 siblings, 1 reply; 24+ messages in thread
From: Tomasz Jeneralczyk @ 2022-08-14 10:10 UTC (permalink / raw)
  To: (; +Cc: Ludovic Courtès, Maxime Devos, 56803



On 2022-08-13 21:26, ( wrote:
> No, the assoc-ref style is basically deprecated last I heard. The 
> problem
> is with snippets: apparently something with the definition of the 
> `snippet`
> field can cause module dependency issues, whereas `arguments` does not
> suffer from the same. IIRC, the issue is that the former is not 
> specifie
> as a `(delayed)` field. So, #$pkg is okay in arguments, but sometimes 
> not
> in snippets.

Does this mean I should replace `(assoc-ref inputs "python")` with 
`#$python` in the install phase of hydrus?
I checked and it didn't cause any problems.

I also noticed that python-mpv's mpv library cannot find libmpv.so 
during runtime (only in the check phase) so I hardcoded the path in 
source to `(search-input-file inputs "/lib/libmpv.so")`.
Was told on irc that most libraries are hardcoded so I take it's not a 
problem.




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

* [bug#56803] [PATCH 0/6] Add hydrus network and its dependencies
  2022-08-14 10:10             ` Tomasz Jeneralczyk
@ 2022-08-14 10:11               ` ( via Guix-patches via
  0 siblings, 0 replies; 24+ messages in thread
From: ( via Guix-patches via @ 2022-08-14 10:11 UTC (permalink / raw)
  To: Tomasz Jeneralczyk; +Cc: Ludovic Courtès, Maxime Devos, 56803

On Sun Aug 14, 2022 at 11:10 AM BST, Tomasz Jeneralczyk wrote:
> Does this mean I should replace `(assoc-ref inputs "python")` with 
> `#$python` in the install phase of hydrus?
> I checked and it didn't cause any problems.

You could, but I think #$(this-package-input "python") would be better style.

    -- (




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

* [bug#56803] [PATCH v2 1/6] gnu: Add swftools.
  2022-07-27 18:57 [bug#56803] [PATCH 0/6] Add hydrus network and its dependencies Tomasz Jeneralczyk
                   ` (5 preceding siblings ...)
  2022-07-27 19:00 ` [bug#56803] [PATCH 6/6] gnu: Add hydrus-network Tomasz Jeneralczyk
@ 2022-08-14 12:46 ` Tomasz Jeneralczyk
  2022-08-14 12:46   ` [bug#56803] [PATCH v2 2/6] gnu: Add python-xvfbwrapper Tomasz Jeneralczyk
                     ` (4 more replies)
  6 siblings, 5 replies; 24+ messages in thread
From: Tomasz Jeneralczyk @ 2022-08-14 12:46 UTC (permalink / raw)
  To: 56803; +Cc: Tomasz Jeneralczyk

This package will built all of swftools' tools but one: PDF2SWF, so I
purposefuly commented it out of description.
Swftools includes the source tarball of an old version of xpdf and I have not
been successful in replacing it with the version distributed in guix. However
I believe the near-completeness of the package warrants a release.

Also updated copyright and used modules.

*gnu/packages/animation.scm (swftools): Add variable.
---
 gnu/packages/animation.scm | 93 ++++++++++++++++++++++++++++++++++++++
 1 file changed, 93 insertions(+)

diff --git a/gnu/packages/animation.scm b/gnu/packages/animation.scm
index ba8ce00fbd..6a017895a3 100644
--- a/gnu/packages/animation.scm
+++ b/gnu/packages/animation.scm
@@ -3,6 +3,7 @@
 ;;; Copyright © 2018–2021 Tobias Geerinckx-Rice <me@tobias.gr>
 ;;; Copyright © 2019 Pkill -9 <pkill9@runbox.com>
 ;;; Copyright © 2020, 2021 Vinicius Monego <monego@posteo.net>
+;;; Copyright © 2022 Tomasz Jeneralczyk <tj@schwi.pl>
 ;;;
 ;;; This file is part of GNU Guix.
 ;;;
@@ -47,6 +48,7 @@ (define-module (gnu packages animation)
   #:use-module (gnu packages image)
   #:use-module (gnu packages imagemagick)
   #:use-module (gnu packages jemalloc)
+  #:use-module (gnu packages mp3)
   #:use-module (gnu packages networking)
   #:use-module (gnu packages pcre)
   #:use-module (gnu packages perl)
@@ -496,3 +498,94 @@ (define-public pencil2d
 lets you create traditional hand-drawn animations (cartoons) using both bitmap
 and vector graphics.")
     (license license:gpl2)))
+
+(define-public swftools
+  ;; Last release of swftools was 0.9.2 on 2012-04-21 - it is really old and
+  ;; does not compile with what's available in guix, master on the other hand works.
+  (let ((commit "772e55a271f66818b06c6e8c9b839befa51248f4")
+        (revision "1"))
+    (package
+      (name "swftools")
+      (version (git-version "0.9.2" revision commit))
+      (source
+       (origin
+         (method git-fetch)
+         (uri (git-reference
+               (url "https://github.com/matthiaskramm/swftools")
+               (commit commit)))
+         (sha256
+                 (base32 "0a8a29rn7gpxnba3spnvkpdgr7mdlssvr273mzw5b2wjvbzard3w"))
+         (file-name (git-file-name name version))
+         (modules '((guix build utils)))
+         (snippet
+          '(begin
+             ;; To fix a linking error I followed the workaround in:
+             ;; https://github.com/matthiaskramm/swftools/issues/178
+             ;; and implented it as a two-step snippet because substitute*
+             ;; does not match multiline regexes.
+             (substitute* "lib/lame/quantize.c"
+               ;; move inline keywords to the same line as their function headers
+               (("^inline.*\n") "inline "))
+             (substitute* "lib/lame/quantize.c"
+               ;; make this particular function not inline
+               (("inline (void bitpressure_strategy1)" _ f) f))))))
+      (build-system gnu-build-system)
+      (arguments
+       (list #:tests? #f)) ; no rule for check
+      (inputs (list zlib freetype giflib libjpeg-turbo lame))
+      (home-page "http://www.swftools.org")
+      (synopsis "Collection of utilities for working with Adobe Flash files")
+      (description "SWFTools is a collection of utilities for working with
+Adobe Flash files (SWF files).  The tool collection includes programs for
+reading SWF files, combining them, and creating them from other content (like
+images, sound files, videos or sourcecode).  The current collection is
+ comprised of the programs detailed below:
+
+@itemize
+@comment PDF2SWF is not currentlybeing  build alongside other tools. The next
+@comment two lines should be uncommented if this will ever get fixed.
+@comment @item
+@comment @command{PDF2SWF} A PDF to SWF Converter.
+
+@item
+@command{SWFCombine} A multi-function tool for inserting, contatenating,
+stacking and changing parameters in SWFs.
+
+@item
+@command{SWFStrings} Scans SWFs for text data.
+@item
+@command{SWFDump} Prints out various informations about SWFs.
+
+@item
+@command{JPEG2SWF} Takes one or more JPEG pictures and generates a SWF
+slideshow from them.
+
+@item
+@command{PNG2SWF} Like JPEG2SWF, only for PNGs.
+
+@item
+@command{GIF2SWF} Converts GIFs to SWF. Also able to handle animated gifs.
+
+@item
+@command{WAV2SWF} Converts WAV audio files to SWFs, using the L.A.M.E. MP3
+ encoder library.
+
+@item
+@command{Font2SWF} Converts font files (TTF, Type1) to SWF.
+
+@item
+@command{SWFBBox} Allows to read out, optimize and readjust SWF bounding boxes.
+
+@item
+@command{SWFC} A tool for creating SWF files from simple script files. Supports
+both ActionScript 2.0 aand 3.0.
+
+@item
+@command{SWFExtract} Allows to extract Movieclips, Sounds, Images etc. from SWF
+ files.
+
+@item
+@command{AS3Compile} A standalone ActionScript 3.0 compiler. Mostly compatible
+ with Flex.
+@end itemize")
+      (license license:gpl2))))

base-commit: ca8c7a36dfbefd66841a2a6df4c9e44ba525c3e0
-- 
2.37.1





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

* [bug#56803] [PATCH v2 2/6] gnu: Add python-xvfbwrapper.
  2022-08-14 12:46 ` [bug#56803] [PATCH v2 1/6] gnu: Add swftools Tomasz Jeneralczyk
@ 2022-08-14 12:46   ` Tomasz Jeneralczyk
  2022-08-14 12:46   ` [bug#56803] [PATCH v2 3/6] gnu: Add python-mpv Tomasz Jeneralczyk
                     ` (3 subsequent siblings)
  4 siblings, 0 replies; 24+ messages in thread
From: Tomasz Jeneralczyk @ 2022-08-14 12:46 UTC (permalink / raw)
  To: 56803; +Cc: Tomasz Jeneralczyk

Also updates copyright.

* gnu/packages/python-check.scm (python-xvfbwrapper): New variable.
---
 gnu/packages/python-check.scm | 22 ++++++++++++++++++++++
 1 file changed, 22 insertions(+)

diff --git a/gnu/packages/python-check.scm b/gnu/packages/python-check.scm
index e196f2eccb..ff5b956cad 100644
--- a/gnu/packages/python-check.scm
+++ b/gnu/packages/python-check.scm
@@ -15,6 +15,7 @@
 ;;; Copyright © 2021 Bonface Munyoki Kilyungi <me@bonfacemunyoki.com>
 ;;; Copyright © 2022 Malte Frank Gerdes <malte.f.gerdes@gmail.com>
 ;;; Copyright © 2022 Felix Gruber <felgru@posteo.net>
+;;; Copyright © 2022 Tomasz Jeneralczyk <tj@schwi.pl>
 ;;;
 ;;; This file is part of GNU Guix.
 ;;;
@@ -2373,3 +2374,24 @@ (define-public python-pycotap
 attachments).
 @end itemize")
     (license license:expat)))
+
+(define-public python-xvfbwrapper
+  (package
+    (name "python-xvfbwrapper")
+    (version "0.2.9")
+    (source (origin
+              (method url-fetch)
+              (uri (pypi-uri "xvfbwrapper" version))
+              (sha256
+               (base32
+                "097wxhvp01ikqpg1z3v8rqhss6f1vwr399zpz9a05d2135bsxx5w"))))
+    (build-system python-build-system)
+    (propagated-inputs (list xorg-server-for-tests))
+    (home-page "https://github.com/cgoldberg/xvfbwrapper")
+    (synopsis "Python module for controlling virtual displays with Xvfb")
+    (description
+     "Xvfb (X virtual framebuffer) is a display server implementing
+the X11 display server protocol.  It runs in memory and does not require a
+physical display.  Only a network layer is necessary.  Xvfb is useful for
+running acceptance tests on headless servers.")
+    (license license:expat)))
-- 
2.37.1





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

* [bug#56803] [PATCH v2 3/6] gnu: Add python-mpv.
  2022-08-14 12:46 ` [bug#56803] [PATCH v2 1/6] gnu: Add swftools Tomasz Jeneralczyk
  2022-08-14 12:46   ` [bug#56803] [PATCH v2 2/6] gnu: Add python-xvfbwrapper Tomasz Jeneralczyk
@ 2022-08-14 12:46   ` Tomasz Jeneralczyk
  2022-08-14 12:46   ` [bug#56803] [PATCH v2 4/6] gnu: Add support for python in opencv Tomasz Jeneralczyk
                     ` (2 subsequent siblings)
  4 siblings, 0 replies; 24+ messages in thread
From: Tomasz Jeneralczyk @ 2022-08-14 12:46 UTC (permalink / raw)
  To: 56803; +Cc: Tomasz Jeneralczyk

Author states that the license of the library is inherited from libmpv,
which can be either GPLv2 or LPGLv2.1. That's why the package's license is
set to be the same as mpv's.

One of the tests had to be disabled because it would neither fail or pass,
blocking all other tests from running and the package from finishing its build
process. I have no clue on why it happens.

Rarely some tests fail without any apparent reason. This is possibly related
to: https://github.com/jaseg/python-mpv/issues/209

Also add copyright.

* gnu/packages/python-xyz.scm (python-mpv): Add variable.
---
 gnu/packages/python-xyz.scm | 63 +++++++++++++++++++++++++++++++++++++
 1 file changed, 63 insertions(+)

diff --git a/gnu/packages/python-xyz.scm b/gnu/packages/python-xyz.scm
index 13ab2f2c8b..51bf4d5c0b 100644
--- a/gnu/packages/python-xyz.scm
+++ b/gnu/packages/python-xyz.scm
@@ -127,6 +127,7 @@
 ;;; Copyright © 2022 Philip McGrath <philip@philipmcgrath.com>
 ;;; Copyright © 2022 Marek Felšöci <marek@felsoci.sk>
 ;;; Copyright © 2022 Hilton Chain <hako@ultrarare.space>
+;;; Copyright © 2022 Tomasz Jeneralczyk <tj@schwi.pl>
 ;;;
 ;;; This file is part of GNU Guix.
 ;;;
@@ -30388,6 +30389,68 @@ (define-public python-bsdiff4
 and @code{bspatch4}.")
     (license license:bsd-2)))
 
+(define-public python-mpv
+  (package
+    (name "python-mpv")
+    (version "v1.0.1")
+    (source
+     (origin
+       ;; python-mpv from pypi does not include the tests directory.
+       (method git-fetch)
+       (uri (git-reference
+             (url "https://github.com/jaseg/python-mpv")
+             (commit version)))
+       (file-name (git-file-name name version))
+       (sha256
+        (base32
+         "10w6j3n62ap45sf6q487kz8z6g58sha37i14fa2hhng794z7a8jh"))
+       (modules '((guix build utils)))
+       (snippet
+        #~(begin
+            ;; One of the tests never completes, so neutering it using
+            ;; early return allows other test to run without issue.
+            (substitute* "tests/test_mpv.py"
+              ;; Note the typo in "prooperty" - this was fixed later in
+              ;; upstream but has no effect on whether the tests hangs or not.
+              (("test_wait_for_prooperty_event_overflow.*" line)
+               ;; The long whitespace between \n and return is to match the
+               ;; identation level, which is significant in python.
+               (string-append line "\n        return\n")))))))
+    (build-system python-build-system)
+    (arguments
+     (list #:phases
+           #~(modify-phases %standard-phases
+               (add-before 'build 'patch-reference-to-mpv
+                 (lambda* (#:key inputs #:allow-other-keys)
+                   ;; Without an absolute path it is not able find and
+                   ;; load the libmpv library.
+                   (substitute* "mpv.py"
+                     (("sofile = .*")
+                      (string-append "sofile = \""
+                                     (search-input-file inputs "/lib/libmpv.so")
+                                     "\"\n")))))
+               (add-before 'check 'prepare-for-tests
+                 (lambda _
+                   ;; Fontconfig throws errors when it has no cache dir to use.
+                   (setenv "XDG_CACHE_HOME" (getcwd))
+                   ;; Some tests fail without a writable and readable HOME.
+                   (setenv "HOME" (getcwd)))))))
+    (native-inputs
+     (list python-xvfbwrapper)) ; needed for tests only
+    (inputs (list mpv))
+    (propagated-inputs (list python-pillow)) ; for raw screenshots
+    (home-page "https://github.com/jaseg/python-mpv")
+    (synopsis "Python interface to the mpv media player")
+    (description
+     "python-mpv is a ctypes-based python interface to the mpv media player.
+It gives you more or less full control of all features of the player, just
+as the lua interface does.")
+    ;; From the project's README:
+    ;;  python-mpv inherits the underlying libmpv's license, which can be either
+    ;;  GPLv2 or later (default) or LGPLv2.1 or later. For details, see the mpv
+    ;;  copyright page.
+    (license (package-license mpv))))
+
 (define-public python-biblib
   (let ((upstream-version "0.1.0")
         (commit "ab0e857b9198fe425ec9b02fcc293b5d9fd0c406")
-- 
2.37.1





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

* [bug#56803] [PATCH v2 4/6] gnu: Add support for python in opencv
  2022-08-14 12:46 ` [bug#56803] [PATCH v2 1/6] gnu: Add swftools Tomasz Jeneralczyk
  2022-08-14 12:46   ` [bug#56803] [PATCH v2 2/6] gnu: Add python-xvfbwrapper Tomasz Jeneralczyk
  2022-08-14 12:46   ` [bug#56803] [PATCH v2 3/6] gnu: Add python-mpv Tomasz Jeneralczyk
@ 2022-08-14 12:46   ` Tomasz Jeneralczyk
  2022-08-14 12:46   ` [bug#56803] [PATCH v2 5/6] gnu: Update python-cloudscraper Tomasz Jeneralczyk
  2022-08-14 12:46   ` [bug#56803] [PATCH v2 6/6] gnu: Add hydrus-network Tomasz Jeneralczyk
  4 siblings, 0 replies; 24+ messages in thread
From: Tomasz Jeneralczyk @ 2022-08-14 12:46 UTC (permalink / raw)
  To: 56803; +Cc: Tomasz Jeneralczyk

The package already had all dependencies needed for its python bindings, so
enabling python support was as easy as adding a flag. Which makes me think
this was the intention from the start.

Also add copyright.

* gnu/packages/image-processing.scm (opencv)[arguments]: Change variable.
---
 gnu/packages/image-processing.scm | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/gnu/packages/image-processing.scm b/gnu/packages/image-processing.scm
index 3dfe086af8..f26691cad7 100644
--- a/gnu/packages/image-processing.scm
+++ b/gnu/packages/image-processing.scm
@@ -20,6 +20,7 @@
 ;;; Copyright © 2021 Guillaume Le Vaillant <glv@posteo.net>
 ;;; Copyright © 2021 Ivan Gankevich <i.gankevich@spbu.ru>
 ;;; Copyright © 2022 Maxim Cournoyer <maxim.cournoyer@gmail.com>
+;;; Copyright © 2022 Tomasz Jeneralczyk <tj@schwi.pl>
 ;;;
 ;;; This file is part of GNU Guix.
 ;;;
@@ -511,6 +512,8 @@ (define-public opencv
              ;; DISPATCH is the list of optional dispatches.
              "-DCPU_BASELINE=SSE2"
 
+             "-DBUILD_opencv_python3=ON"
+
              ,@(match (%current-system)
                  ("x86_64-linux"
                   '("-DCPU_DISPATCH=NEON;VFPV3;FP16;SSE;SSE2;SSE3;SSSE3;SSE4_1;SSE4_2;POPCNT;AVX;FP16;AVX2;FMA3;AVX_512F;AVX512_SKX"
-- 
2.37.1





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

* [bug#56803] [PATCH v2 5/6] gnu: Update python-cloudscraper.
  2022-08-14 12:46 ` [bug#56803] [PATCH v2 1/6] gnu: Add swftools Tomasz Jeneralczyk
                     ` (2 preceding siblings ...)
  2022-08-14 12:46   ` [bug#56803] [PATCH v2 4/6] gnu: Add support for python in opencv Tomasz Jeneralczyk
@ 2022-08-14 12:46   ` Tomasz Jeneralczyk
  2022-08-14 12:46   ` [bug#56803] [PATCH v2 6/6] gnu: Add hydrus-network Tomasz Jeneralczyk
  4 siblings, 0 replies; 24+ messages in thread
From: Tomasz Jeneralczyk @ 2022-08-14 12:46 UTC (permalink / raw)
  To: 56803; +Cc: Tomasz Jeneralczyk

Neither 1.2.58 nor 1.2.60 version of python-cloudscraper requires
compatibility with python2 afaik.

This removes possible collisions with packages that depend on the mainstream
version of python-pyparsing.

* gnu/packages/python-web.scm (python-cloudscraper): Update to 1.2.60
* gnu/packages/python-web.scm (python-cloudscraper)[propagated-inputs]: Change
python-pyparsing to its mainstream version
---
 gnu/packages/python-web.scm | 10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)

diff --git a/gnu/packages/python-web.scm b/gnu/packages/python-web.scm
index 896e60aba2..298c1e09de 100644
--- a/gnu/packages/python-web.scm
+++ b/gnu/packages/python-web.scm
@@ -53,6 +53,7 @@
 ;;; Copyright © 2022 Peter Polidoro <peter@polidoro.io>
 ;;; Copyright © 2022 Antero Mejr <antero@mailbox.org>
 ;;; Copyright © 2022 Luis Henrique Gomes Higino <luishenriquegh2701@gmail.com>
+;;; Copyright © 2022 Tomasz Jeneralczyk <tj@schwi.pl>
 ;;;
 ;;; This file is part of GNU Guix.
 ;;;
@@ -6262,17 +6263,16 @@ (define-public python-http-ece
 (define-public python-cloudscraper
   (package
     (name "python-cloudscraper")
-    (version "1.2.58")
+    (version "1.2.60")
     (source
      (origin
        (method git-fetch)
        (uri (git-reference
              (url "https://github.com/VeNoMouS/cloudscraper")
-             ;; Corresponds to 1.2.58
-             (commit "f3a3d067ea8b5238e9a0948aed0c3fa0d9c29b96")))
+             (commit "1.2.60")))
        (file-name (git-file-name name version))
        (sha256
-        (base32 "18fbp086imabjxly04rrchbf6n6m05bpd150zxbw7z2w3mjnpsqd"))
+        (base32 "00cmxgwdm0x1j4a4ipwvpzih735hdzidljbijk1b3laj3dgvnvsm"))
        (modules '((guix build utils)))
        (snippet
         '(with-directory-excursion "cloudscraper"
@@ -6312,7 +6312,7 @@ (define-public python-cloudscraper
            python-requests
            python-requests-toolbelt
            python-responses
-           python-pyparsing-2.4.7))
+           python-pyparsing))
     (native-inputs
      (list python-pytest))
     (home-page "https://github.com/venomous/cloudscraper")
-- 
2.37.1





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

* [bug#56803] [PATCH v2 6/6] gnu: Add hydrus-network.
  2022-08-14 12:46 ` [bug#56803] [PATCH v2 1/6] gnu: Add swftools Tomasz Jeneralczyk
                     ` (3 preceding siblings ...)
  2022-08-14 12:46   ` [bug#56803] [PATCH v2 5/6] gnu: Update python-cloudscraper Tomasz Jeneralczyk
@ 2022-08-14 12:46   ` Tomasz Jeneralczyk
  2022-08-29 22:46     ` bug#56803: [PATCH 0/6] Add hydrus network and its dependencies Ludovic Courtès
  4 siblings, 1 reply; 24+ messages in thread
From: Tomasz Jeneralczyk @ 2022-08-14 12:46 UTC (permalink / raw)
  To: 56803; +Cc: Tomasz Jeneralczyk

Hydrus-network has a weekly release cycle and is meant to be used from its own
directory so I artificially spread it out to comply with guix's expectations.

I was not able to build the program's help files. Fixing it would probably
mean packaging a whole new build system for guix - more info in source
comments.

Also adds copyright and new used modules.

* gnu/packages/image-viewers.scm (hydrus-network): Add variable.
---
 gnu/packages/image-viewers.scm | 133 +++++++++++++++++++++++++++++++++
 1 file changed, 133 insertions(+)

diff --git a/gnu/packages/image-viewers.scm b/gnu/packages/image-viewers.scm
index 88dbba866b..7878fe1048 100644
--- a/gnu/packages/image-viewers.scm
+++ b/gnu/packages/image-viewers.scm
@@ -24,6 +24,7 @@
 ;;; Copyright © 2021 Zheng Junjie <873216071@qq.com>
 ;;; Copyright © 2021 dissent <disseminatedissent@protonmail.com>
 ;;; Copyright © 2022 Michael Rohleder <mike@rohleder.de>
+;;; Copyright © 2022 Tomasz Jeneralczyk <tj@schwi.pl>
 ;;;
 ;;; This file is part of GNU Guix.
 ;;;
@@ -54,6 +55,7 @@ (define-module (gnu packages image-viewers)
   #:use-module (guix build-system qt)
   #:use-module (gnu packages autotools)
   #:use-module (gnu packages algebra)
+  #:use-module (gnu packages animation)
   #:use-module (gnu packages backup)
   #:use-module (gnu packages base)
   #:use-module (gnu packages bash)
@@ -84,14 +86,20 @@ (define-module (gnu packages image-viewers)
   #:use-module (gnu packages photo)
   #:use-module (gnu packages pkg-config)
   #:use-module (gnu packages python)
+  #:use-module (gnu packages python-check)
+  #:use-module (gnu packages python-compression)
+  #:use-module (gnu packages python-crypto)
+  #:use-module (gnu packages python-web)
   #:use-module (gnu packages python-xyz)
   #:use-module (gnu packages qt)
   #:use-module (gnu packages suckless)
   #:use-module (gnu packages terminals)
+  #:use-module (gnu packages upnp)
   #:use-module (gnu packages version-control)
   #:use-module (gnu packages video)
   #:use-module (gnu packages web)
   #:use-module (gnu packages xdisorg)
+  #:use-module (gnu packages xml)
   #:use-module (gnu packages xorg)
   #:use-module (gnu packages))
 
@@ -973,3 +981,128 @@ (define-public xzgv
     (description
      "xzgv is a fast image viewer that provides extensive keyboard support.")
     (license license:gpl2+)))
+
+(define-public hydrus-network
+  (package
+    (name "hydrus-network")
+    (version "495") ; upstream has a weekly release cycle.
+    (source
+     (origin
+       (method git-fetch)
+       (uri (git-reference
+             (url "https://github.com/hydrusnetwork/hydrus")
+             (commit (string-append "v" version))))
+       (file-name (git-file-name name version))
+       (sha256
+        (base32
+         "03zhrcmjzbk37sl9nwjahfmr8aflss84c4xhg5ci5b8jvbbqmr1j"))))
+    (build-system python-build-system)
+    (arguments
+     (list
+      #:phases
+      #~(let ((static-dir "/share/hydrus/static"))
+          (modify-phases %standard-phases
+            ;; Hydrus is a python program but does not uses setup.py or any
+            ;; other build system to build itself - it's delivered ready to
+            ;; run from the source.
+            (replace 'check
+              (lambda _
+                (setenv "DISPLAY" ":0")
+                (setenv "XDG_CACHE_HOME" (getcwd))
+                (setenv "HOME" (getcwd))
+                (invoke "xvfb-run" "python" "test.py")))
+            ;; I was not able to build the program's help files. Updating
+            ;; python-pymdown-extensions to its latest version might be the
+            ;; solution, but this would require also packaging its new build
+            ;; system that is not present in guix yet. I decided to cut short there.
+            (delete 'build)
+            (add-before 'install 'patch-variables
+              (lambda* (#:key outputs inputs #:allow-other-keys)
+                (let ((ffmpeg    (search-input-file inputs "/bin/ffmpeg"))
+                      (swfrender (search-input-file inputs "/bin/swfrender"))
+                      (upnpc     (search-input-file inputs "/bin/upnpc"))
+                      (out       (assoc-ref outputs "out")))
+                  (with-directory-excursion "hydrus"
+                    ;; Without this the program would incorrectly assume
+                    ;; that it uses user's ffmpeg binary when it isn't.
+                    (substitute* "client/ClientController.py"
+                      (("if (HydrusVideoHandling\\.FFMPEG_PATH).*" _ var)
+                       (string-append "if " var " == \"" ffmpeg "\":\n")))
+                    (with-directory-excursion "core"
+                      (substitute* "HydrusConstants.py"
+                        (("STATIC_DIR = .*")
+                         (string-append "STATIC_DIR = \"" out static-dir "\"\n")))
+                      (substitute* "HydrusFlashHandling.py"
+                        (("SWFRENDER_PATH = .*\n")
+                         (string-append "SWFRENDER_PATH = \"" swfrender "\"\n")))
+                      (substitute* "HydrusVideoHandling.py"
+                        (("FFMPEG_PATH = .*\n")
+                         (string-append "FFMPEG_PATH = \"" ffmpeg "\"\n")))
+                      (substitute* "networking/HydrusNATPunch.py"
+                        (("UPNPC_PATH = .*\n")
+                         (string-append "UPNPC_PATH = \"" upnpc "\"\n"))))))))
+            ;; Since everything lives in hydrus's root directory, it needs to
+            ;; be spread out to comply with guix's expectations.
+            (replace 'install
+              (lambda* (#:key outputs #:allow-other-keys)
+                (let* ((out (assoc-ref outputs "out"))
+                       (client (string-append out "/bin/hydrus"))
+                       (server (string-append out "/bin/hydrus-server")))
+                  (copy-recursively "static"
+                                    (string-append out static-dir))
+                  (copy-recursively "hydrus"
+                                    (string-append out
+                                                   "/lib/python"
+                                                   (python-version
+                                                    #$(this-package-input "python"))
+                                                   "/site-packages/hydrus"))
+                  (mkdir (string-append out "/bin"))
+                  (copy-file "client.py" client)
+                  (chmod client #o0555)
+                  (copy-file "server.py" server)
+                  (chmod server #o0555))))))))
+    ;; All native-inputs are only needed for the the check phase
+    (native-inputs
+     (list
+      xvfb-run
+      python-nose
+      python-mock
+      python-httmock))
+    ;; All python packages were taken from static/build_files/linux/requirements.txt
+    (propagated-inputs
+     (list
+      python-beautifulsoup4
+      python-cbor2
+      python-chardet
+      python-cloudscraper
+      python-html5lib
+      python-lxml
+      python-lz4
+      python-numpy
+      opencv       ; its python bindings are a drop-in replacement for opencv-python-headless
+      python-pillow
+      python-psutil
+      python-pylzma
+      python-pyopenssl
+      ;; since hydrus' version 494 it supports python-pyside-6 but it's not yet
+      ;; in guix. pyside-2 is still supported as a fallback.
+      python-pyside-2
+      python-pysocks
+      python-mpv
+      python-pyyaml
+      python-qtpy
+      python-requests
+      python-send2trash
+      python-service-identity
+      python-six
+      python-twisted))
+    (inputs (list swftools ffmpeg miniupnpc python))
+    (synopsis "Organize your media with tags like a dektop booru")
+    (description
+     "The hydrus network client is an application written for
+internet-fluent media nerds who have large image/swf/webm collections.
+It browses with tags instead of folders, a little like a booru on your desktop.
+Advanced users can share tags and files anonymously through custom servers that
+any user may run.  Everything is free and privacy is the first concern.")
+    (home-page "https://hydrusnetwork.github.io/hydrus/")
+    (license license:wtfpl2)))
-- 
2.37.1





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

* bug#56803: [PATCH 0/6] Add hydrus network and its dependencies
  2022-08-14 12:46   ` [bug#56803] [PATCH v2 6/6] gnu: Add hydrus-network Tomasz Jeneralczyk
@ 2022-08-29 22:46     ` Ludovic Courtès
  0 siblings, 0 replies; 24+ messages in thread
From: Ludovic Courtès @ 2022-08-29 22:46 UTC (permalink / raw)
  To: Tomasz Jeneralczyk; +Cc: 56803-done

Hi,

Tomasz Jeneralczyk <tj@schwi.pl> skribis:

> Hydrus-network has a weekly release cycle and is meant to be used from its own
> directory so I artificially spread it out to comply with guix's expectations.
>
> I was not able to build the program's help files. Fixing it would probably
> mean packaging a whole new build system for guix - more info in source
> comments.
>
> Also adds copyright and new used modules.
>
> * gnu/packages/image-viewers.scm (hydrus-network): Add variable.

I pushed the whole series:

  9b8507df11 gnu: Add hydrus-network.
  f82a8873d3 gnu: python-cloudscraper: Update to 1.2.60.
  5920196e47 gnu: opencv: Build Python bindings.
  619af9f307 gnu: Add python-mpv.
  e1ea628776 gnu: Add python-xvfbwrapper.
  05246c691b gnu: Add swftools.

I had to make a number of adjustments, such as tweaking commit logs,
moving info from the commit log to comments for swftools, changing the
swftools license to ‘gpl2+’ (because source file headers carry the “or
any later version” wording), avoiding “(package-license mpv)” as this
leads to a top-level circular dependency, and removing bundled binaries
from hydrus-network.

Thanks,
Ludo’.




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

end of thread, other threads:[~2022-08-29 22:47 UTC | newest]

Thread overview: 24+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-07-27 18:57 [bug#56803] [PATCH 0/6] Add hydrus network and its dependencies Tomasz Jeneralczyk
2022-07-27 19:00 ` [bug#56803] [PATCH 1/6] gnu: Add swftools Tomasz Jeneralczyk
2022-07-27 19:00 ` [bug#56803] [PATCH 2/6] gnu: Add python-xvfbwrapper Tomasz Jeneralczyk
2022-07-27 19:00 ` [bug#56803] [PATCH 3/6] gnu: Add python-mpv Tomasz Jeneralczyk
2022-07-27 22:05   ` Maxime Devos
2022-07-28 14:58     ` Tomasz Jeneralczyk
2022-08-09 15:14       ` [bug#56803] [PATCH 0/6] Add hydrus network and its dependencies Ludovic Courtès
2022-08-13 14:34         ` Tomasz Jeneralczyk
2022-08-13 21:26           ` ( via Guix-patches via
2022-08-14 10:10             ` Tomasz Jeneralczyk
2022-08-14 10:11               ` ( via Guix-patches via
2022-08-09 16:59       ` [bug#56803] [PATCH 3/6] gnu: Add python-mpv Maxime Devos
2022-07-27 22:09   ` Maxime Devos
2022-07-27 19:00 ` [bug#56803] [PATCH 4/6] gnu: Add opencv-with-python Tomasz Jeneralczyk
2022-07-27 19:00 ` [bug#56803] [PATCH 5/6] gnu: Update python-cloudscraper Tomasz Jeneralczyk
2022-07-27 19:00 ` [bug#56803] [PATCH 6/6] gnu: Add hydrus-network Tomasz Jeneralczyk
2022-08-09 15:09   ` [bug#56803] [PATCH 0/6] Add hydrus network and its dependencies Ludovic Courtès
2022-08-14 12:46 ` [bug#56803] [PATCH v2 1/6] gnu: Add swftools Tomasz Jeneralczyk
2022-08-14 12:46   ` [bug#56803] [PATCH v2 2/6] gnu: Add python-xvfbwrapper Tomasz Jeneralczyk
2022-08-14 12:46   ` [bug#56803] [PATCH v2 3/6] gnu: Add python-mpv Tomasz Jeneralczyk
2022-08-14 12:46   ` [bug#56803] [PATCH v2 4/6] gnu: Add support for python in opencv Tomasz Jeneralczyk
2022-08-14 12:46   ` [bug#56803] [PATCH v2 5/6] gnu: Update python-cloudscraper Tomasz Jeneralczyk
2022-08-14 12:46   ` [bug#56803] [PATCH v2 6/6] gnu: Add hydrus-network Tomasz Jeneralczyk
2022-08-29 22:46     ` bug#56803: [PATCH 0/6] Add hydrus network and its dependencies Ludovic Courtès

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