blob: 6d71715b7163dc306e71b4c1a77249d29974a0b4 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
|
{
stdenv,
lib,
buildPythonPackage,
fetchFromGitLab,
pytestCheckHook,
setuptools,
ghostscript_headless,
}:
buildPythonPackage rec {
pname = "ghostscript";
version = "0.7";
pyproject = true;
src = fetchFromGitLab {
owner = "pdftools";
repo = "python-ghostscript";
tag = "v${version}";
hash = "sha256-yBJuAnLK/4YDU9PBsSWPQay4pDws3bP+3rCplysq41w=";
};
postPatch =
let
extLib = stdenv.hostPlatform.extensions.sharedLibrary;
in
''
substituteInPlace ghostscript/__init__.py \
--replace-fail '__version__ = gs.__version__' '__version__ = "${version}"'
substituteInPlace ghostscript/_gsprint.py \
--replace-fail 'cdll.LoadLibrary("libgs.so")' 'cdll.LoadLibrary("${lib.getLib ghostscript_headless}/lib/libgs${extLib}")'
'';
build-system = [
setuptools
];
nativeCheckInputs = [
pytestCheckHook
];
disabledTests = [
# Some tests don't (fully) match anymore.
# Not sure if ghostscript ever promised to keep producing the same outputs, bit-by-bit…
"test_simple"
"test_unicode_arguments"
"test_run_string"
"test_stdin"
];
pythonImportsCheck = [ "ghostscript" ];
meta = {
description = "Interface to the Ghostscript C-API using ctypes";
homepage = "https://gitlab.com/pdftools/python-ghostscript";
changelog = "https://gitlab.com/pdftools/python-ghostscript/-/blob/v${version}/CHANGES.txt";
license = lib.licenses.gpl3Plus;
maintainers = with lib.maintainers; [ flokli ];
};
}
|