1{
2 lib,
3 stdenv,
4 buildPythonPackage,
5 fetchPypi,
6 fontconfig,
7 graphviz,
8 mock,
9 pycodestyle,
10 pygraphviz,
11 pytestCheckHook,
12 setuptools,
13 six,
14}:
15
16buildPythonPackage rec {
17 pname = "transitions";
18 version = "0.9.2";
19 pyproject = true;
20
21 src = fetchPypi {
22 inherit pname version;
23 hash = "sha256-L4SQ29vUGTZs7xUWAyqwbQfMtYOe9UkF6EKkcmktQgQ=";
24 };
25
26 build-system = [ setuptools ];
27
28 dependencies = [
29 six
30 pygraphviz # optional
31 ];
32
33 nativeCheckInputs = [
34 pytestCheckHook
35 mock
36 graphviz
37 pycodestyle
38 ];
39
40 preCheck = ''
41 export FONTCONFIG_FILE=${fontconfig.out}/etc/fonts/fonts.conf
42 export HOME=$TMPDIR
43 '';
44
45 disabledTestPaths = lib.optionals stdenv.hostPlatform.isDarwin [
46 # sleep is not accurate on Darwin
47 "tests/test_async.py"
48 ];
49
50 disabledTests =
51 [
52 "test_diagram"
53 "test_ordered_with_graph"
54 ]
55 ++ lib.optionals stdenv.hostPlatform.isDarwin [
56 # Upstream issue https://github.com/pygraphviz/pygraphviz/issues/441
57 "test_binary_stream"
58
59 # sleep is not accurate on Darwin
60 "test_timeout"
61 "test_timeout_callbacks"
62 "test_timeout_transitioning"
63 "test_thread_access"
64 "test_parallel_access"
65 "test_parallel_deep"
66 "test_conditional_access"
67 "test_pickle"
68 ];
69
70 pythonImportsCheck = [ "transitions" ];
71
72 meta = with lib; {
73 homepage = "https://github.com/pytransitions/transitions";
74 description = "Lightweight, object-oriented finite state machine implementation in Python";
75 changelog = "https://github.com/pytransitions/transitions/releases/tag/${version}";
76 license = licenses.mit;
77 maintainers = with maintainers; [ dotlambda ];
78 };
79}