1{
2 lib,
3 buildPythonPackage,
4 fetchFromGitHub,
5 pythonOlder,
6 fonttools,
7 lxml,
8 fs, # for fonttools extras
9 setuptools-scm,
10 pytestCheckHook,
11 pytest-cov-stub,
12 pytest-xdist,
13 runAllTests ? false,
14 psautohint, # for passthru.tests
15}:
16
17buildPythonPackage rec {
18 pname = "psautohint";
19 version = "2.4.0";
20 format = "setuptools";
21
22 disabled = pythonOlder "3.7";
23
24 src = fetchFromGitHub {
25 owner = "adobe-type-tools";
26 repo = "psautohint";
27 rev = "v${version}";
28 sha256 = "125nx7accvbk626qlfar90va1995kp9qfrz6a978q4kv2kk37xai";
29 fetchSubmodules = true; # data dir for tests
30 };
31
32 postPatch = ''
33 echo '#define PSAUTOHINT_VERSION "${version}"' > libpsautohint/src/version.h
34 sed -i '/use_scm_version/,+3d' setup.py
35 sed -i '/setup(/a \ version="${version}",' setup.py
36 '';
37
38 nativeBuildInputs = [ setuptools-scm ];
39
40 propagatedBuildInputs = [
41 fonttools
42 lxml
43 fs
44 ];
45
46 nativeCheckInputs = [
47 pytestCheckHook
48 pytest-cov-stub
49 pytest-xdist
50 ];
51 disabledTests = lib.optionals (!runAllTests) [
52 # Slow tests, reduces test time from ~5 mins to ~30s
53 "test_mmufo"
54 "test_flex_ufo"
55 "test_ufo"
56 "test_flex_otf"
57 "test_multi_outpath"
58 "test_mmhint"
59 "test_otf"
60 # flaky tests (see https://github.com/adobe-type-tools/psautohint/issues/385)
61 "test_hashmap_old_version"
62 "test_hashmap_no_version"
63 ];
64
65 passthru.tests = {
66 fullTestsuite = psautohint.override { runAllTests = true; };
67 };
68
69 meta = with lib; {
70 description = "Script to normalize the XML and other data inside of a UFO";
71 homepage = "https://github.com/adobe-type-tools/psautohint";
72 license = licenses.bsd3;
73 maintainers = [ maintainers.sternenseemann ];
74 };
75}