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