2020-04-24 23:36:52 +00:00
|
|
|
{ lib
|
2022-04-15 01:41:22 +00:00
|
|
|
, stdenv
|
2020-04-24 23:36:52 +00:00
|
|
|
, buildPythonPackage
|
2021-08-05 21:33:18 +00:00
|
|
|
, pythonOlder
|
2020-04-24 23:36:52 +00:00
|
|
|
, fetchFromGitHub
|
2024-01-13 08:15:51 +00:00
|
|
|
, fetchpatch
|
2020-04-24 23:36:52 +00:00
|
|
|
, substituteAll
|
2024-02-29 20:09:43 +00:00
|
|
|
, graphviz-nox
|
2021-12-06 16:07:01 +00:00
|
|
|
, xdg-utils
|
2020-04-24 23:36:52 +00:00
|
|
|
, makeFontsConf
|
|
|
|
, freefont_ttf
|
2024-01-13 08:15:51 +00:00
|
|
|
, setuptools
|
2020-04-24 23:36:52 +00:00
|
|
|
, mock
|
2024-04-21 15:54:59 +00:00
|
|
|
, pytest_7
|
2020-04-24 23:36:52 +00:00
|
|
|
, pytest-mock
|
2021-12-30 13:39:12 +00:00
|
|
|
, python
|
2020-04-24 23:36:52 +00:00
|
|
|
}:
|
|
|
|
|
|
|
|
buildPythonPackage rec {
|
|
|
|
pname = "graphviz";
|
2022-11-21 17:40:18 +00:00
|
|
|
version = "0.20.1";
|
2024-01-13 08:15:51 +00:00
|
|
|
pyproject = true;
|
2021-08-05 21:33:18 +00:00
|
|
|
|
2022-05-18 14:49:53 +00:00
|
|
|
disabled = pythonOlder "3.7";
|
2020-04-24 23:36:52 +00:00
|
|
|
|
|
|
|
# patch does not apply to PyPI tarball due to different line endings
|
|
|
|
src = fetchFromGitHub {
|
|
|
|
owner = "xflr6";
|
|
|
|
repo = "graphviz";
|
|
|
|
rev = version;
|
2022-11-21 17:40:18 +00:00
|
|
|
hash = "sha256-plhWG9mE9DoTMg7mWCvFLAgtBx01LAgJ0gQ/mqBU3yc=";
|
2020-04-24 23:36:52 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
patches = [
|
|
|
|
(substituteAll {
|
2021-12-06 16:07:01 +00:00
|
|
|
src = ./paths.patch;
|
2024-02-29 20:09:43 +00:00
|
|
|
graphviz = graphviz-nox;
|
2021-12-06 16:07:01 +00:00
|
|
|
xdgutils = xdg-utils;
|
2020-04-24 23:36:52 +00:00
|
|
|
})
|
2024-01-13 08:15:51 +00:00
|
|
|
# https://github.com/xflr6/graphviz/issues/209
|
|
|
|
(fetchpatch {
|
|
|
|
name = "fix-tests-with-python312.patch";
|
|
|
|
url = "https://github.com/xflr6/graphviz/commit/5ce9fc5de4f2284baa27d7a8d68ab0885d032868.patch";
|
|
|
|
hash = "sha256-jREPACSc4aoHY3G+39e8Axqajw4eeKkAeVu2s40v1nI=";
|
|
|
|
})
|
2020-04-24 23:36:52 +00:00
|
|
|
];
|
|
|
|
|
2021-07-14 22:03:04 +00:00
|
|
|
postPatch = ''
|
|
|
|
sed -i "/--cov/d" setup.cfg
|
|
|
|
'';
|
|
|
|
|
2020-09-25 04:45:31 +00:00
|
|
|
# Fontconfig error: Cannot load default config file
|
|
|
|
FONTCONFIG_FILE = makeFontsConf {
|
|
|
|
fontDirectories = [ freefont_ttf ];
|
2020-04-24 23:36:52 +00:00
|
|
|
};
|
|
|
|
|
2024-01-13 08:15:51 +00:00
|
|
|
nativeBuildInputs = [
|
|
|
|
setuptools
|
|
|
|
];
|
|
|
|
|
2023-02-02 18:25:31 +00:00
|
|
|
nativeCheckInputs = [
|
2021-12-30 13:39:12 +00:00
|
|
|
mock
|
2024-04-21 15:54:59 +00:00
|
|
|
pytest_7
|
2021-12-30 13:39:12 +00:00
|
|
|
pytest-mock
|
|
|
|
];
|
|
|
|
|
|
|
|
checkPhase = ''
|
|
|
|
runHook preCheck
|
|
|
|
|
|
|
|
HOME=$TMPDIR ${python.interpreter} run-tests.py
|
2021-07-14 22:03:04 +00:00
|
|
|
|
2021-12-30 13:39:12 +00:00
|
|
|
runHook postCheck
|
2021-07-14 22:03:04 +00:00
|
|
|
'';
|
2020-04-24 23:36:52 +00:00
|
|
|
|
2022-04-15 01:41:22 +00:00
|
|
|
# Too many failures due to attempting to connect to com.apple.fonts daemon
|
|
|
|
doCheck = !stdenv.isDarwin;
|
|
|
|
|
2020-04-24 23:36:52 +00:00
|
|
|
meta = with lib; {
|
|
|
|
description = "Simple Python interface for Graphviz";
|
|
|
|
homepage = "https://github.com/xflr6/graphviz";
|
2022-05-18 14:49:53 +00:00
|
|
|
changelog = "https://github.com/xflr6/graphviz/blob/${src.rev}/CHANGES.rst";
|
2020-04-24 23:36:52 +00:00
|
|
|
license = licenses.mit;
|
|
|
|
maintainers = with maintainers; [ dotlambda ];
|
|
|
|
};
|
|
|
|
|
|
|
|
}
|