2022-02-10 20:34:41 +00:00
|
|
|
{ lib, stdenv, buildPythonPackage, fetchPypi, fetchpatch, pythonOlder
|
2020-09-25 04:45:31 +00:00
|
|
|
, fonttools, defcon, lxml, fs, unicodedata2, zopfli, brotlipy, fontpens
|
|
|
|
, brotli, fontmath, mutatormath, booleanoperations
|
2020-10-16 20:44:37 +00:00
|
|
|
, ufoprocessor, ufonormalizer, psautohint, tqdm
|
2021-12-26 17:43:05 +00:00
|
|
|
, setuptools-scm, scikit-build
|
|
|
|
, cmake
|
|
|
|
, antlr4_9
|
2020-12-25 13:55:36 +00:00
|
|
|
, pytestCheckHook
|
2021-12-26 17:43:05 +00:00
|
|
|
# Enables some expensive tests, useful for verifying an update
|
|
|
|
, runAllTests ? false
|
|
|
|
, afdko
|
2020-09-25 04:45:31 +00:00
|
|
|
}:
|
|
|
|
|
|
|
|
buildPythonPackage rec {
|
|
|
|
pname = "afdko";
|
2021-12-26 17:43:05 +00:00
|
|
|
version = "3.7.1";
|
2020-09-25 04:45:31 +00:00
|
|
|
|
|
|
|
disabled = pythonOlder "3.6";
|
|
|
|
|
|
|
|
src = fetchPypi {
|
|
|
|
inherit pname version;
|
2021-12-26 17:43:05 +00:00
|
|
|
sha256 = "05hj2mw3ppfjaig5zdk5db9vfrbbq5gmv5rzggmvvrj0yyfpr0pd";
|
2020-09-25 04:45:31 +00:00
|
|
|
};
|
|
|
|
|
2021-12-26 17:43:05 +00:00
|
|
|
format = "pyproject";
|
|
|
|
|
|
|
|
nativeBuildInputs = [
|
|
|
|
setuptools-scm
|
|
|
|
scikit-build
|
|
|
|
cmake
|
|
|
|
];
|
|
|
|
|
|
|
|
buildInputs = [
|
|
|
|
antlr4_9.runtime.cpp
|
|
|
|
];
|
|
|
|
|
2020-10-16 20:44:37 +00:00
|
|
|
patches = [
|
2021-12-26 17:43:05 +00:00
|
|
|
# Don't try to install cmake and ninja using pip
|
|
|
|
./no-pypi-build-tools.patch
|
2022-02-10 20:34:41 +00:00
|
|
|
|
2021-12-26 17:43:05 +00:00
|
|
|
# Use antlr4 runtime from nixpkgs and link it dynamically
|
|
|
|
./use-dynamic-system-antlr4-runtime.patch
|
2022-02-10 20:34:41 +00:00
|
|
|
|
|
|
|
# Fix compatibility with latest fonttools.
|
|
|
|
(fetchpatch {
|
|
|
|
url = "https://github.com/adobe-type-tools/afdko/commit/120752c50a562e4f6c12ff4be1e3bd96ed664e82.patch";
|
|
|
|
sha256 = "RDGIpNAuCmK+zqZOeOK7ddCjr9BuqPpcnbnxdtoE48M=";
|
|
|
|
})
|
2020-10-16 20:44:37 +00:00
|
|
|
];
|
|
|
|
|
2021-12-26 17:43:05 +00:00
|
|
|
# setup.py will always (re-)execute cmake in buildPhase
|
|
|
|
dontConfigure = true;
|
2020-09-25 04:45:31 +00:00
|
|
|
|
|
|
|
propagatedBuildInputs = [
|
|
|
|
booleanoperations
|
|
|
|
fonttools
|
|
|
|
lxml # fonttools[lxml], defcon[lxml] extra
|
|
|
|
fs # fonttools[ufo] extra
|
|
|
|
unicodedata2 # fonttools[unicode] extra
|
|
|
|
brotlipy # fonttools[woff] extra
|
|
|
|
zopfli # fonttools[woff] extra
|
|
|
|
fontpens
|
|
|
|
brotli
|
|
|
|
defcon
|
|
|
|
fontmath
|
|
|
|
mutatormath
|
|
|
|
ufoprocessor
|
|
|
|
ufonormalizer
|
|
|
|
psautohint
|
2020-10-16 20:44:37 +00:00
|
|
|
tqdm
|
2020-09-25 04:45:31 +00:00
|
|
|
];
|
|
|
|
|
2020-12-25 13:55:36 +00:00
|
|
|
checkInputs = [ pytestCheckHook ];
|
2021-12-06 16:07:01 +00:00
|
|
|
preCheck = ''
|
|
|
|
export PATH=$PATH:$out/bin
|
|
|
|
|
|
|
|
# Update tests to match ufinormalizer-0.6.1 expectations:
|
|
|
|
# https://github.com/adobe-type-tools/afdko/issues/1418
|
|
|
|
find tests -name layerinfo.plist -delete
|
|
|
|
'';
|
2021-12-26 17:43:05 +00:00
|
|
|
disabledTests = lib.optionals (!runAllTests) [
|
2020-12-25 13:55:36 +00:00
|
|
|
# Disable slow tests, reduces test time ~25 %
|
|
|
|
"test_report"
|
|
|
|
"test_post_overflow"
|
|
|
|
"test_cjk"
|
|
|
|
"test_extrapolate"
|
|
|
|
"test_filename_without_dir"
|
|
|
|
"test_overwrite"
|
|
|
|
"test_options"
|
2022-01-13 20:06:32 +00:00
|
|
|
] ++ lib.optionals (stdenv.hostPlatform.isAarch64 || stdenv.hostPlatform.isRiscV) [
|
2021-12-26 17:43:05 +00:00
|
|
|
# aarch64-only (?) failure, unknown reason so far
|
|
|
|
# https://github.com/adobe-type-tools/afdko/issues/1425
|
|
|
|
"test_spec"
|
2022-04-15 01:41:22 +00:00
|
|
|
] ++ lib.optionals (stdenv.hostPlatform.isi686) [
|
|
|
|
"test_type1mm_inputs"
|
2020-12-25 13:55:36 +00:00
|
|
|
];
|
2020-09-25 04:45:31 +00:00
|
|
|
|
2021-12-26 17:43:05 +00:00
|
|
|
passthru.tests = {
|
|
|
|
fullTestsuite = afdko.override { runAllTests = true; };
|
|
|
|
};
|
|
|
|
|
2021-01-15 22:18:51 +00:00
|
|
|
meta = with lib; {
|
2020-09-25 04:45:31 +00:00
|
|
|
description = "Adobe Font Development Kit for OpenType";
|
|
|
|
homepage = "https://adobe-type-tools.github.io/afdko/";
|
|
|
|
license = licenses.asl20;
|
|
|
|
maintainers = [ maintainers.sternenseemann ];
|
|
|
|
};
|
|
|
|
}
|