summary refs log tree commit diff
diff options
context:
space:
mode:
authorVivien Kraus <vivien@planete-kraus.eu>2022-02-11 00:34:54 +0100
committerTobias Geerinckx-Rice <me@tobias.gr>2022-02-13 01:00:04 +0100
commit506263860650baa3fd6247d0bc44a10045127751 (patch)
tree7f97f6aac740c597d256932cbbb27f96d98f4077
parent13b5e767b029175d25dc994f3c9c40503711598d (diff)
downloadguix-506263860650baa3fd6247d0bc44a10045127751.tar.gz
gnu: vtk: Also install a .egg-info.
* gnu/packages/image-processing.scm (vtk) [phase install-egg-info]: New phase.
-rw-r--r--gnu/packages/image-processing.scm30
1 files changed, 28 insertions, 2 deletions
diff --git a/gnu/packages/image-processing.scm b/gnu/packages/image-processing.scm
index 00c8db7f34..6c02eb8cce 100644
--- a/gnu/packages/image-processing.scm
+++ b/gnu/packages/image-processing.scm
@@ -279,7 +279,7 @@ many popular formats.")
     (properties `((release-monitoring-url . "https://vtk.org/download/")))
     (build-system cmake-build-system)
     (arguments
-     '(#:build-type "Release"           ;Build without '-g' to save space.
+     `(#:build-type "Release"           ;Build without '-g' to save space.
        #:configure-flags '(;"-DBUILD_TESTING:BOOL=TRUE"
                            ;    ; not honored
                            "-DVTK_USE_EXTERNAL=OFF" ;; default
@@ -313,7 +313,32 @@ many popular formats.")
                (substitute* "Common/Core/vtkFloatingPointExceptions.cxx"
                  (("<fenv.h>") "<cfenv>"))
                (substitute* "Common/Core/CMakeLists.txt"
-                 (("fenv.h") "cfenv")))))
+                 (("fenv.h") "cfenv"))))
+           (add-after 'install 'install-egg-info
+             (lambda* (#:key outputs #:allow-other-keys)
+               (use-modules (ice-9 rdelim) (guix build utils))
+               (call-with-output-file "get-python-version.py"
+                 (lambda (port)
+                   (format port "import sys
+v = sys.version_info
+with open('path', 'w') as f:
+    f.write('{0}.{1}'.format(v.major, v.minor))
+" port)))
+               (invoke "python3" "get-python-version.py")
+               (let* ((python-version
+                       (call-with-input-file "path" read-line))
+                      (egg-info
+                       (format #f "~a/lib/python~a/site-packages/vtk-~a-py~a.egg-info"
+                               (assoc-ref outputs "out")
+                               python-version ,version python-version)))
+                 (mkdir-p egg-info)
+                 (call-with-output-file (string-append egg-info "/PKG-INFO")
+                   (lambda (port)
+                     (format port "Metadata-Version: 2.1
+Name: vtk
+Version: ~a
+"
+                             ,version)))))))
        #:tests? #f))        ;XXX: test data not included
     (inputs
      `(("double-conversion" ,double-conversion)
@@ -345,6 +370,7 @@ many popular formats.")
      ;; VTK's 'VTK-vtk-module-find-packages.cmake' calls
      ;; 'find_package(THEORA)', which in turns looks for libogg.
      (list libogg))
+    (native-inputs (list python))
     (home-page "https://vtk.org/")
     (synopsis "Libraries for 3D computer graphics")
     (description