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.3";
19 pyproject = true;
20
21 src = fetchPypi {
22 inherit pname version;
23 hash = "sha256-iB+3W7FlTtVdhgYLsGfyxxb44VX1e7c/1ETlNxOq/sg=";
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 "test_diagram"
52 "test_ordered_with_graph"
53 ]
54 ++ lib.optionals stdenv.hostPlatform.isDarwin [
55 # Upstream issue https://github.com/pygraphviz/pygraphviz/issues/441
56 "test_binary_stream"
57
58 # sleep is not accurate on Darwin
59 "test_timeout"
60 "test_timeout_callbacks"
61 "test_timeout_transitioning"
62 "test_thread_access"
63 "test_parallel_access"
64 "test_parallel_deep"
65 "test_conditional_access"
66 "test_pickle"
67 ];
68
69 pythonImportsCheck = [ "transitions" ];
70
71 meta = with lib; {
72 homepage = "https://github.com/pytransitions/transitions";
73 description = "Lightweight, object-oriented finite state machine implementation in Python";
74 changelog = "https://github.com/pytransitions/transitions/releases/tag/${version}";
75 license = licenses.mit;
76 maintainers = with maintainers; [ dotlambda ];
77 };
78}