-
-
Notifications
You must be signed in to change notification settings - Fork 404
/
graphviz.py
116 lines (92 loc) · 3.38 KB
/
graphviz.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
r"""
Features for testing the presence of ``graphviz``
"""
# ****************************************************************************
# Copyright (C) 2018 Sebastien Labbe <slabqc@gmail.com>
# 2021 Matthias Koeppe
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 2 of the License, or
# (at your option) any later version.
# https://www.gnu.org/licenses/
# ****************************************************************************
from . import Executable
from .join_feature import JoinFeature
class dot(Executable):
r"""
A :class:`~sage.features.Feature` describing the presence of ``dot``.
TESTS::
sage: from sage.features.graphviz import dot
sage: dot().is_present() # optional - graphviz
FeatureTestResult('dot', True)
"""
def __init__(self):
r"""
TESTS::
sage: from sage.features.graphviz import dot
sage: isinstance(dot(), dot)
True
"""
Executable.__init__(self, "dot", executable="dot",
spkg="graphviz",
url="https://www.graphviz.org/")
class neato(Executable):
r"""
A :class:`~sage.features.Feature` describing the presence of ``neato``.
TESTS:
sage: from sage.features.graphviz import neato
sage: neato().is_present() # optional - graphviz
FeatureTestResult('neato', True)
"""
def __init__(self):
r"""
TESTS::
sage: from sage.features.graphviz import neato
sage: isinstance(neato(), neato)
True
"""
Executable.__init__(self, "neato", executable="neato",
spkg="graphviz",
url="https://www.graphviz.org/")
class twopi(Executable):
r"""
A :class:`~sage.features.Feature` describing the presence of ``twopi``.
TESTS::
sage: from sage.features.graphviz import twopi
sage: twopi().is_present() # optional - graphviz
FeatureTestResult('twopi', True)
"""
def __init__(self):
r"""
TESTS::
sage: from sage.features.graphviz import twopi
sage: isinstance(twopi(), twopi)
True
"""
Executable.__init__(self, "twopi", executable="twopi",
spkg="graphviz",
url="https://www.graphviz.org/")
class Graphviz(JoinFeature):
r"""
A :class:`~sage.features.Feature` describing the presence of
the :class:`dot`, :class:`neato`, and :class:`twopi` executables from the
:ref:`graphviz <spkg_graphviz>` package.
EXAMPLES::
sage: from sage.features.graphviz import Graphviz
sage: Graphviz().is_present() # optional - graphviz
FeatureTestResult('graphviz', True)
"""
def __init__(self):
r"""
TESTS::
sage: from sage.features.graphviz import Graphviz
sage: isinstance(Graphviz(), Graphviz)
True
"""
JoinFeature.__init__(self, "graphviz",
[dot(), neato(), twopi()],
spkg="graphviz",
url="https://www.graphviz.org/")
def all_features():
return [Graphviz()]