freetype-py: init at 2.1.0.post1

This commit is contained in:
Daniel Goertzen 2020-02-04 13:54:03 -06:00
parent 2c58b1d464
commit 5142e21492
3 changed files with 68 additions and 0 deletions

View file

@ -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; [ ];
};
}

View file

@ -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)

View file

@ -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 { };