Message ID | 3bdaf7497d56169b334ef85b65694fea@schwi.pl |
---|---|
State | Accepted |
Headers | show |
Series | None | expand |
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’.
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.
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.
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. -- (
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.
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. -- (
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