Subject: bug#79205: Package python-pylzma Fails to Build

From: Benjamin <[email-masked]>
Date: Mon, 11 Aug 2025 19:15:55 +0000

I do still use it, but it is also on flatpak so I could move to using that since I might be the only person on Guix using this package anymore. I have it working up to 626a on my personal channel, but this newest issue might be to much for my non existent Python knowledge to handle. Here is the code I have for 626a which worked until pylzma started failing:

(define-public swftools-fix
  (package
    (inherit swftools)
    (arguments
     (substitute-keyword-arguments (package-arguments swftools)
       ((#:configure-flags _
         ''())
        #~(list "DISABLEPDF2SWF=true"))))))

(define-public python-qtpy-fix
  (package
    (inherit python-qtpy)
    (name "python-qtpy")
    (version "2.4.0")
    (source
     (origin
       (method url-fetch)
       (uri (pypi-uri "QtPy" version))
       (sha256
        (base32 "1m14sjbqkyimvk71jdd3rfxdx1qldxfdmj352mw0cqdacy0m0bfv"))))
    (native-inputs (modify-inputs (package-native-inputs python-qtpy)
                     (append python-pyside-6)))))

(define-public hydrus-network-fix
  (package
    (inherit hydrus-network)
    (name "hydrus-network")
    (version "626a")
    (source
     (origin
       (inherit (package-source hydrus-network))
       (uri (git-reference
             (url "https://github.com/hydrusnetwork/hydrus")
             (commit (string-append "v" version))))
       (sha256
        (base32 "0lhqi5295arg62w3lg10wcpw48z7a1x4pgmfjy7ma6v21rv75yz9"))))
    (arguments
     (substitute-keyword-arguments (package-arguments hydrus-network)
       ((#:tests? _ #f)
        #f)
       ((#:phases p)
        #~(let ((static-dir "/share/hydrus/static"))
            (modify-phases #$p
              (add-before 'install 'fix-test-py
                (lambda _
                  (rename-file "hydrus_test.py" "test.py")))
              (replace '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")))
                        (with-directory-excursion "files"
                          (substitute* "HydrusFlashHandling.py"
                            (("SWFRENDER_PATH = .*\n")
                             (string-append "SWFRENDER_PATH = \"" swfrender
                                            "\"\n")))
                          (substitute* "HydrusVideoHandling.py"
                            (("FFMPEG_PATH = .*\n")
                             (string-append "FFMPEG_PATH = \"" ffmpeg "\"\n"))))
                        (with-directory-excursion "networking"
                          (substitute* "HydrusNATPunch.py"
                            (("UPNPC_PATH = .*\n")
                             (string-append "UPNPC_PATH = \"" upnpc "\"\n")))))))))
              (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 "hydrus_client.py" client)
                    (chmod client #o555)
                    (copy-file "hydrus_server.py" server)
                    (chmod server #o555)))))))))
    (inputs (modify-inputs (package-inputs hydrus-network)
			   (replace "swftools" swftools-fix)
			   (append python-dateparser)))
    (propagated-inputs (modify-inputs (package-propagated-inputs
                                       hydrus-network)
				      (replace "python-pyside-2" python-pyside-6)
				      (replace "python-qtpy" python-qtpy-fix)))))