Merge pull request #208522 from bgamari/wip/vtk-egg-info

vtk: Generate egg-info
This commit is contained in:
Thiago Kenji Okada 2023-01-09 09:23:14 +00:00 committed by GitHub
commit 4cf45a9fea
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 15 additions and 8 deletions

View file

@ -2,7 +2,7 @@
{ stdenv, lib, fetchurl, cmake, libGLU, libGL, libX11, xorgproto, libXt, libpng, libtiff
, fetchpatch
, enableQt ? false, qtbase, qtx11extras, qttools, qtdeclarative, qtEnv
, enablePython ? false, pythonInterpreter ? throw "vtk: Python support requested, but no python interpreter was given."
, enablePython ? false, python ? throw "vtk: Python support requested, but no python interpreter was given."
# Darwin support
, Cocoa, CoreServices, DiskArbitration, IOKit, CFNetwork, Security, GLUT, OpenGL
, ApplicationServices, CoreText, IOSurface, ImageIO, xpc, libobjc
@ -11,7 +11,7 @@
let
inherit (lib) optionalString optionals optional;
pythonMajor = lib.substring 0 1 pythonInterpreter.pythonVersion;
pythonMajor = lib.substring 0 1 python.pythonVersion;
in stdenv.mkDerivation rec {
pname = "vtk${optionalString enableQt "-qvtk"}";
@ -47,7 +47,7 @@ in stdenv.mkDerivation rec {
OpenGL
GLUT
] ++ optionals enablePython [
pythonInterpreter
python
];
propagatedBuildInputs = optionals stdenv.isDarwin [ libobjc ]
++ optionals stdenv.isLinux [ libX11 libGL ];
@ -89,6 +89,13 @@ in stdenv.mkDerivation rec {
sed -i 's/fprintf(output, shift)/fprintf(output, "%s", shift)/g' ./ThirdParty/libxml2/vtklibxml2/xpath.c
'';
postInstall = optionalString enablePython ''
substitute \
${./vtk.egg-info} \
$out/lib/python${python.pythonVersion}/site-packages/vtk-${version}.egg-info \
--subst-var-by VTK_VER "${version}"
'';
meta = with lib; {
description = "Open source libraries for 3D computer graphics, image processing and visualization";
homepage = "https://www.vtk.org/";

View file

@ -0,0 +1,4 @@
Metadata-Version: 2.1
Version: @VTK_VER@
Summary: VTK is an open-source toolkit for 3D computer graphics, image processing, and visualization
Platform: UNKNOWN

View file

@ -27,10 +27,6 @@ buildPythonPackage rec {
};
postPatch = ''
# Discovery of 'vtk' in setuptools is not working properly, due to a missing
# .egg-info in the vtk package. It does however import and run just fine.
substituteInPlace mayavi/__init__.py --replace "'vtk'" ""
# building the docs fails with the usual Qt xcb error, so skip:
substituteInPlace setup.py \
--replace "build.build.run(self)" "build.build.run(self); return"

View file

@ -11909,7 +11909,7 @@ self: super: with self; {
vt-py = callPackage ../development/python-modules/vt-py { };
vtk = toPythonModule (pkgs.vtk_9.override {
pythonInterpreter = python;
inherit python;
enablePython = true;
});