From 5142e214923e35cd8f2b417b38370f6eca849ced Mon Sep 17 00:00:00 2001 From: Daniel Goertzen Date: Tue, 4 Feb 2020 13:54:03 -0600 Subject: [PATCH 1/4] freetype-py: init at 2.1.0.post1 --- .../python-modules/freetype-py/default.nix | 29 +++++++++++++++ .../freetype-py/library-paths.patch | 37 +++++++++++++++++++ pkgs/top-level/python-packages.nix | 2 + 3 files changed, 68 insertions(+) create mode 100644 pkgs/development/python-modules/freetype-py/default.nix create mode 100644 pkgs/development/python-modules/freetype-py/library-paths.patch diff --git a/pkgs/development/python-modules/freetype-py/default.nix b/pkgs/development/python-modules/freetype-py/default.nix new file mode 100644 index 00000000000..52b9b2ea1fa --- /dev/null +++ b/pkgs/development/python-modules/freetype-py/default.nix @@ -0,0 +1,29 @@ +{ lib, buildPythonPackage, fetchPypi, substituteAll, stdenv, setuptools_scm, freetype }: + +buildPythonPackage rec { + pname = "freetype-py"; + version = "2.1.0.post1"; + + src = fetchPypi { + inherit pname version; + sha256 = "1k62fx53qrv9nb73mpqi2r11wzbx41qfv5qppvh6rylywnrknf3n"; + }; + + patches = [ + (substituteAll { + src = ./library-paths.patch; + freetype = "${freetype.out}/lib/libfreetype${stdenv.hostPlatform.extensions.sharedLibrary}"; + }) + ]; + + nativeBuildInputs = [ setuptools_scm ]; + + propagatedBuildInputs = [ freetype ]; + + meta = with lib; { + homepage = https://github.com/rougier/freetype-py; + description = "FreeType (high-level Python API)"; + license = licenses.bsd3; + maintainers = with maintainers; [ ]; + }; +} diff --git a/pkgs/development/python-modules/freetype-py/library-paths.patch b/pkgs/development/python-modules/freetype-py/library-paths.patch new file mode 100644 index 00000000000..a30c7e7355f --- /dev/null +++ b/pkgs/development/python-modules/freetype-py/library-paths.patch @@ -0,0 +1,37 @@ +diff --git a/freetype/raw.py b/freetype/raw.py +index ff3bea3..78c68ab 100644 +--- a/freetype/raw.py ++++ b/freetype/raw.py +@@ -19,31 +19,7 @@ from freetype.ft_enums import * + from freetype.ft_errors import * + from freetype.ft_structs import * + +-# First, look for a bundled FreeType shared object on the top-level of the +-# installed freetype-py module. +-system = platform.system() +-if system == 'Windows': +- library_name = 'libfreetype.dll' +-elif system == 'Darwin': +- library_name = 'libfreetype.dylib' +-else: +- library_name = 'libfreetype.so' +- +-filename = os.path.join(os.path.dirname(freetype.__file__), library_name) +- +-# If no bundled shared object is found, look for a system-wide installed one. +-if not os.path.exists(filename): +- # on windows all ctypes does when checking for the library +- # is to append .dll to the end and look for an exact match +- # within any entry in PATH. +- filename = ctypes.util.find_library('freetype') +- +- if filename is None: +- if platform.system() == 'Windows': +- # Check current working directory for dll as ctypes fails to do so +- filename = os.path.join(os.path.realpath('.'), "freetype.dll") +- else: +- filename = library_name ++filename = "@freetype@" + + try: + _lib = ctypes.CDLL(filename) diff --git a/pkgs/top-level/python-packages.nix b/pkgs/top-level/python-packages.nix index 6f07d73493f..71de105067c 100644 --- a/pkgs/top-level/python-packages.nix +++ b/pkgs/top-level/python-packages.nix @@ -742,6 +742,8 @@ in { foxdot = callPackage ../development/python-modules/foxdot { }; + freetype-py = callPackage ../development/python-modules/freetype-py { }; + fsspec = callPackage ../development/python-modules/fsspec { }; furl = callPackage ../development/python-modules/furl { }; From 81bc4bb78abb41f043e0dc75efc3e7c312caab05 Mon Sep 17 00:00:00 2001 From: Daniel Goertzen Date: Tue, 4 Feb 2020 13:54:20 -0600 Subject: [PATCH 2/4] 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 00000000000..fb44a4911ae --- /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 00000000000..05b583c12e4 --- /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 71de105067c..dce0c979f47 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 { }; From 6adf6268ae6658dd170dae8408dcee05a402e433 Mon Sep 17 00:00:00 2001 From: Daniel Goertzen Date: Thu, 26 Mar 2020 08:16:12 -0500 Subject: [PATCH 3/4] quote homepage values, add self as maintainer --- maintainers/maintainer-list.nix | 6 ++++++ pkgs/development/python-modules/freetype-py/default.nix | 4 ++-- pkgs/development/python-modules/vispy/default.nix | 4 ++-- 3 files changed, 10 insertions(+), 4 deletions(-) diff --git a/maintainers/maintainer-list.nix b/maintainers/maintainer-list.nix index 426aad99b45..7e0f92e7092 100644 --- a/maintainers/maintainer-list.nix +++ b/maintainers/maintainer-list.nix @@ -2910,6 +2910,12 @@ githubId = 25820499; name = "Roman Kretschmer"; }; + goertzenator = { + email = "daniel.goertzen@gmail.com"; + github = "goertzenator"; + githubId = 605072; + name = "Daniel Goertzen"; + }; goibhniu = { email = "cillian.deroiste@gmail.com"; github = "cillianderoiste"; diff --git a/pkgs/development/python-modules/freetype-py/default.nix b/pkgs/development/python-modules/freetype-py/default.nix index 52b9b2ea1fa..71b29a54d82 100644 --- a/pkgs/development/python-modules/freetype-py/default.nix +++ b/pkgs/development/python-modules/freetype-py/default.nix @@ -21,9 +21,9 @@ buildPythonPackage rec { propagatedBuildInputs = [ freetype ]; meta = with lib; { - homepage = https://github.com/rougier/freetype-py; + homepage = "https://github.com/rougier/freetype-py"; description = "FreeType (high-level Python API)"; license = licenses.bsd3; - maintainers = with maintainers; [ ]; + maintainers = with maintainers; [ goertzenator ]; }; } diff --git a/pkgs/development/python-modules/vispy/default.nix b/pkgs/development/python-modules/vispy/default.nix index fb44a4911ae..61fb42dd2eb 100644 --- a/pkgs/development/python-modules/vispy/default.nix +++ b/pkgs/development/python-modules/vispy/default.nix @@ -31,9 +31,9 @@ buildPythonPackage rec { doCheck = false; # otherwise runs OSX code on linux. meta = with lib; { - homepage = http://vispy.org/index.html; + homepage = "http://vispy.org/index.html"; description = "Interactive scientific visualization in Python"; license = licenses.bsd3; - maintainers = with maintainers; [ ]; + maintainers = with maintainers; [ goertzenator ]; }; } From 5f57e9fcbe9ea685760412cdcc9c68aa1f874538 Mon Sep 17 00:00:00 2001 From: Daniel Goertzen Date: Thu, 7 May 2020 14:12:34 -0500 Subject: [PATCH 4/4] add pythonImportsCheck --- pkgs/development/python-modules/freetype-py/default.nix | 2 ++ pkgs/development/python-modules/vispy/default.nix | 1 + 2 files changed, 3 insertions(+) diff --git a/pkgs/development/python-modules/freetype-py/default.nix b/pkgs/development/python-modules/freetype-py/default.nix index 71b29a54d82..a1259b85673 100644 --- a/pkgs/development/python-modules/freetype-py/default.nix +++ b/pkgs/development/python-modules/freetype-py/default.nix @@ -20,6 +20,8 @@ buildPythonPackage rec { propagatedBuildInputs = [ freetype ]; + pythonImportsCheck = [ "freetype" ]; + meta = with lib; { homepage = "https://github.com/rougier/freetype-py"; description = "FreeType (high-level Python API)"; diff --git a/pkgs/development/python-modules/vispy/default.nix b/pkgs/development/python-modules/vispy/default.nix index 61fb42dd2eb..029132933a9 100644 --- a/pkgs/development/python-modules/vispy/default.nix +++ b/pkgs/development/python-modules/vispy/default.nix @@ -29,6 +29,7 @@ buildPythonPackage rec { ]; doCheck = false; # otherwise runs OSX code on linux. + pythonImportsCheck = [ "vispy" ]; meta = with lib; { homepage = "http://vispy.org/index.html";