From 81bc4bb78abb41f043e0dc75efc3e7c312caab05 Mon Sep 17 00:00:00 2001 From: Daniel Goertzen Date: Tue, 4 Feb 2020 13:54:20 -0600 Subject: [PATCH] vispy: init at 0.6.4 --- .../python-modules/vispy/default.nix | 39 +++++++++++++++++++ .../python-modules/vispy/library-paths.patch | 39 +++++++++++++++++++ pkgs/top-level/python-packages.nix | 2 + 3 files changed, 80 insertions(+) create mode 100644 pkgs/development/python-modules/vispy/default.nix create mode 100644 pkgs/development/python-modules/vispy/library-paths.patch diff --git a/pkgs/development/python-modules/vispy/default.nix b/pkgs/development/python-modules/vispy/default.nix new file mode 100644 index 000000000000..fb44a4911ae4 --- /dev/null +++ b/pkgs/development/python-modules/vispy/default.nix @@ -0,0 +1,39 @@ +{ lib, buildPythonPackage, substituteAll, stdenv, + fetchPypi, numpy, cython, freetype-py, fontconfig, libGL, + setuptools_scm, setuptools-scm-git-archive + }: + +buildPythonPackage rec { + pname = "vispy"; + version = "0.6.4"; + + src = fetchPypi { + inherit pname version; + sha256 = "07sb4qww6mgzm66qsrr3pd66yz39r6jj4ibb3qmfg1kwnxs6ayv2"; + }; + + patches = [ + (substituteAll { + src = ./library-paths.patch; + fontconfig = "${fontconfig.lib}/lib/libfontconfig${stdenv.hostPlatform.extensions.sharedLibrary}"; + gl = "${libGL.out}/lib/libGL${stdenv.hostPlatform.extensions.sharedLibrary}"; + }) + ]; + + nativeBuildInputs = [ + cython setuptools_scm setuptools-scm-git-archive + ]; + + propagatedBuildInputs = [ + numpy freetype-py fontconfig libGL + ]; + + doCheck = false; # otherwise runs OSX code on linux. + + meta = with lib; { + homepage = http://vispy.org/index.html; + description = "Interactive scientific visualization in Python"; + license = licenses.bsd3; + maintainers = with maintainers; [ ]; + }; +} diff --git a/pkgs/development/python-modules/vispy/library-paths.patch b/pkgs/development/python-modules/vispy/library-paths.patch new file mode 100644 index 000000000000..05b583c12e4f --- /dev/null +++ b/pkgs/development/python-modules/vispy/library-paths.patch @@ -0,0 +1,39 @@ +diff --git a/vispy/ext/fontconfig.py b/vispy/ext/fontconfig.py +index ff24662b..6a5079f0 100644 +--- a/vispy/ext/fontconfig.py ++++ b/vispy/ext/fontconfig.py +@@ -7,10 +7,7 @@ from ..util.wrappers import run_subprocess + + # Some code adapted from Pyglet + +-fc = util.find_library('fontconfig') +-if fc is None: +- raise ImportError('fontconfig not found') +-fontconfig = cdll.LoadLibrary(fc) ++fontconfig = cdll.LoadLibrary('@fontconfig@') + + FC_FAMILY = 'family'.encode('ASCII') + FC_SIZE = 'size'.encode('ASCII') +diff --git a/vispy/gloo/gl/gl2.py b/vispy/gloo/gl/gl2.py +index d5bd9c38..63350e73 100644 +--- a/vispy/gloo/gl/gl2.py ++++ b/vispy/gloo/gl/gl2.py +@@ -39,16 +39,8 @@ elif sys.platform.startswith('win'): + pass + else: + # Unix-ish +- if sys.platform.startswith('darwin'): +- _fname = ctypes.util.find_library('OpenGL') +- else: +- _fname = ctypes.util.find_library('GL') +- if not _fname: +- logger.warning('Could not load OpenGL library.') +- _lib = None +- else: +- # Load lib +- _lib = ctypes.cdll.LoadLibrary(_fname) ++ # Load lib ++ _lib = ctypes.cdll.LoadLibrary("@gl@") + + + def _have_context(): diff --git a/pkgs/top-level/python-packages.nix b/pkgs/top-level/python-packages.nix index 71de105067c7..dce0c979f47c 100644 --- a/pkgs/top-level/python-packages.nix +++ b/pkgs/top-level/python-packages.nix @@ -5973,6 +5973,8 @@ in { virtualenv = callPackage ../development/python-modules/virtualenv { }; + vispy = callPackage ../development/python-modules/vispy { }; + vsts = callPackage ../development/python-modules/vsts { }; vsts-cd-manager = callPackage ../development/python-modules/vsts-cd-manager { };