2019-05-06 22:42:31 +02:00
|
|
|
{
|
|
|
|
lib,
|
2022-06-03 22:05:33 +00:00
|
|
|
stdenv,
|
2019-05-06 22:42:31 +02:00
|
|
|
buildPythonPackage,
|
2020-08-25 16:45:29 +02:00
|
|
|
pythonOlder,
|
2022-06-03 22:05:33 +00:00
|
|
|
isPyPy,
|
|
|
|
fetchFromGitHub,
|
2024-03-08 02:40:13 +01:00
|
|
|
setuptools,
|
2022-06-03 22:05:33 +00:00
|
|
|
setuptools-scm,
|
|
|
|
fs,
|
2020-08-25 16:45:29 +02:00
|
|
|
lxml,
|
2022-06-03 22:05:33 +00:00
|
|
|
brotli,
|
|
|
|
brotlicffi,
|
|
|
|
zopfli,
|
|
|
|
unicodedata2,
|
|
|
|
lz4,
|
2020-08-25 16:45:29 +02:00
|
|
|
scipy,
|
|
|
|
munkres,
|
2024-03-08 02:40:13 +01:00
|
|
|
pycairo,
|
2022-06-03 22:05:33 +00:00
|
|
|
matplotlib,
|
2020-08-25 16:45:29 +02:00
|
|
|
sympy,
|
2022-06-03 22:05:33 +00:00
|
|
|
xattr,
|
|
|
|
skia-pathops,
|
|
|
|
uharfbuzz,
|
2024-03-24 20:53:29 +01:00
|
|
|
pytest7CheckHook,
|
2017-05-31 10:30:24 +09:00
|
|
|
}:
|
|
|
|
|
|
|
|
buildPythonPackage rec {
|
|
|
|
pname = "fonttools";
|
2025-04-03 09:06:23 +02:00
|
|
|
version = "4.56.0";
|
2024-03-08 02:40:13 +01:00
|
|
|
pyproject = true;
|
2021-10-05 16:17:28 +02:00
|
|
|
|
2024-03-08 02:40:13 +01:00
|
|
|
disabled = pythonOlder "3.8";
|
2017-05-31 10:30:24 +09:00
|
|
|
|
2020-08-25 16:45:29 +02:00
|
|
|
src = fetchFromGitHub {
|
2024-08-04 18:12:24 +02:00
|
|
|
owner = "fonttools";
|
|
|
|
repo = "fonttools";
|
2024-12-09 13:36:47 +01:00
|
|
|
tag = version;
|
2025-04-03 09:06:23 +02:00
|
|
|
hash = "sha256-ZkC1+I2d9wY9J7IoCGHGWG2gOVN7wW274UpN1lQxmJY=";
|
2017-05-31 10:30:24 +09:00
|
|
|
};
|
|
|
|
|
2025-06-09 10:40:07 +03:00
|
|
|
patches = [
|
|
|
|
# https://github.com/fonttools/fonttools/pull/3855
|
|
|
|
# FIXME: remove when merged
|
|
|
|
./python-3.13.4.patch
|
|
|
|
];
|
|
|
|
|
2024-03-08 02:40:13 +01:00
|
|
|
build-system = [
|
|
|
|
setuptools
|
|
|
|
setuptools-scm
|
|
|
|
];
|
2022-04-27 22:41:29 +10:00
|
|
|
|
2024-03-08 02:40:13 +01:00
|
|
|
optional-dependencies =
|
|
|
|
let
|
2022-06-03 22:05:33 +00:00
|
|
|
extras = {
|
|
|
|
ufo = [ fs ];
|
|
|
|
lxml = [ lxml ];
|
|
|
|
woff = [
|
|
|
|
(if isPyPy then brotlicffi else brotli)
|
|
|
|
zopfli
|
|
|
|
];
|
2024-12-09 13:36:47 +01:00
|
|
|
unicode = lib.optional (pythonOlder "3.13") unicodedata2;
|
2022-06-03 22:05:33 +00:00
|
|
|
graphite = [ lz4 ];
|
2024-03-08 02:40:13 +01:00
|
|
|
interpolatable = [
|
|
|
|
pycairo
|
|
|
|
(if isPyPy then munkres else scipy)
|
|
|
|
];
|
2022-06-03 22:05:33 +00:00
|
|
|
plot = [ matplotlib ];
|
|
|
|
symfont = [ sympy ];
|
|
|
|
type1 = lib.optional stdenv.hostPlatform.isDarwin xattr;
|
|
|
|
pathops = [ skia-pathops ];
|
|
|
|
repacker = [ uharfbuzz ];
|
|
|
|
};
|
|
|
|
in
|
|
|
|
extras // { all = lib.concatLists (lib.attrValues extras); };
|
2021-11-28 23:45:15 -08:00
|
|
|
|
2023-01-21 12:00:00 +00:00
|
|
|
nativeCheckInputs =
|
|
|
|
[
|
2024-03-08 02:40:13 +01:00
|
|
|
# test suite fails with pytest>=8.0.1
|
|
|
|
# https://github.com/fonttools/fonttools/issues/3458
|
2024-03-24 20:53:29 +01:00
|
|
|
pytest7CheckHook
|
2022-06-30 18:53:13 -04:00
|
|
|
]
|
|
|
|
++ lib.concatLists (
|
|
|
|
lib.attrVals (
|
|
|
|
[
|
2022-06-03 22:05:33 +00:00
|
|
|
"woff"
|
2023-09-28 20:17:14 +02:00
|
|
|
# "interpolatable" is not included because it only contains 2 tests at the time of writing but adds 270 extra dependencies
|
2023-09-15 14:06:10 +02:00
|
|
|
"ufo"
|
2022-06-30 18:53:13 -04:00
|
|
|
]
|
|
|
|
++ lib.optionals (!skia-pathops.meta.broken) [
|
|
|
|
"pathops" # broken
|
|
|
|
]
|
2022-06-03 22:05:33 +00:00
|
|
|
++ [ "repacker" ]
|
2024-03-08 02:40:13 +01:00
|
|
|
) optional-dependencies
|
|
|
|
);
|
2017-05-31 10:30:24 +09:00
|
|
|
|
2022-04-27 22:41:29 +10:00
|
|
|
pythonImportsCheck = [ "fontTools" ];
|
|
|
|
|
2018-03-02 03:21:19 +01:00
|
|
|
preCheck = ''
|
2021-10-05 16:17:28 +02:00
|
|
|
# tests want to execute the "fonttools" executable from $PATH
|
|
|
|
export PATH="$out/bin:$PATH"
|
2018-03-02 03:21:19 +01:00
|
|
|
'';
|
|
|
|
|
2021-10-05 16:17:28 +02:00
|
|
|
# Timestamp tests have timing issues probably related
|
|
|
|
# to our file timestamp normalization
|
|
|
|
disabledTests = [
|
|
|
|
"test_recalc_timestamp_ttf"
|
|
|
|
"test_recalc_timestamp_otf"
|
|
|
|
"test_ttcompile_timestamp_calcs"
|
|
|
|
];
|
2020-08-25 16:45:29 +02:00
|
|
|
|
2021-11-28 23:45:15 -08:00
|
|
|
disabledTestPaths = [
|
|
|
|
# avoid test which depend on fs and matplotlib
|
|
|
|
# fs and matplotlib were removed to prevent strong cyclic dependencies
|
|
|
|
"Tests/misc/plistlib_test.py"
|
|
|
|
"Tests/pens"
|
|
|
|
"Tests/ufoLib"
|
2024-03-09 13:14:10 +09:00
|
|
|
|
|
|
|
# test suite fails with pytest>=8.0.1
|
|
|
|
# https://github.com/fonttools/fonttools/issues/3458
|
|
|
|
"Tests/ttLib/woff2_test.py"
|
|
|
|
"Tests/ttx/ttx_test.py"
|
2021-11-28 23:45:15 -08:00
|
|
|
];
|
|
|
|
|
2021-02-28 15:27:53 +01:00
|
|
|
meta = with lib; {
|
2020-03-31 21:11:51 -04:00
|
|
|
homepage = "https://github.com/fonttools/fonttools";
|
2017-05-31 10:30:24 +09:00
|
|
|
description = "Library to manipulate font files from Python";
|
2025-01-19 21:15:28 +01:00
|
|
|
changelog = "https://github.com/fonttools/fonttools/blob/${src.tag}/NEWS.rst";
|
2021-02-28 15:27:53 +01:00
|
|
|
license = licenses.mit;
|
|
|
|
maintainers = [ maintainers.sternenseemann ];
|
2017-05-31 10:30:24 +09:00
|
|
|
};
|
|
|
|
}
|