passagemath-environment 10.4.1__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- passagemath_environment-10.4.1.data/scripts/sage +1140 -0
- passagemath_environment-10.4.1.data/scripts/sage-env +667 -0
- passagemath_environment-10.4.1.data/scripts/sage-num-threads.py +105 -0
- passagemath_environment-10.4.1.data/scripts/sage-python +2 -0
- passagemath_environment-10.4.1.data/scripts/sage-venv-config +42 -0
- passagemath_environment-10.4.1.data/scripts/sage-version.sh +9 -0
- passagemath_environment-10.4.1.dist-info/METADATA +76 -0
- passagemath_environment-10.4.1.dist-info/RECORD +70 -0
- passagemath_environment-10.4.1.dist-info/WHEEL +5 -0
- passagemath_environment-10.4.1.dist-info/top_level.txt +1 -0
- sage/all__sagemath_environment.py +4 -0
- sage/env.py +496 -0
- sage/features/__init__.py +981 -0
- sage/features/all.py +126 -0
- sage/features/bliss.py +85 -0
- sage/features/cddlib.py +38 -0
- sage/features/coxeter3.py +45 -0
- sage/features/csdp.py +83 -0
- sage/features/cython.py +38 -0
- sage/features/databases.py +302 -0
- sage/features/dvipng.py +40 -0
- sage/features/ecm.py +42 -0
- sage/features/ffmpeg.py +119 -0
- sage/features/four_ti_2.py +55 -0
- sage/features/fricas.py +66 -0
- sage/features/gap.py +86 -0
- sage/features/gfan.py +38 -0
- sage/features/giac.py +30 -0
- sage/features/graph_generators.py +171 -0
- sage/features/graphviz.py +117 -0
- sage/features/igraph.py +44 -0
- sage/features/imagemagick.py +138 -0
- sage/features/interfaces.py +256 -0
- sage/features/internet.py +65 -0
- sage/features/jmol.py +44 -0
- sage/features/join_feature.py +146 -0
- sage/features/kenzo.py +77 -0
- sage/features/latex.py +300 -0
- sage/features/latte.py +85 -0
- sage/features/lrs.py +164 -0
- sage/features/mcqd.py +45 -0
- sage/features/meataxe.py +46 -0
- sage/features/mip_backends.py +114 -0
- sage/features/msolve.py +68 -0
- sage/features/nauty.py +70 -0
- sage/features/normaliz.py +43 -0
- sage/features/palp.py +65 -0
- sage/features/pandoc.py +42 -0
- sage/features/pdf2svg.py +41 -0
- sage/features/phitigra.py +42 -0
- sage/features/pkg_systems.py +195 -0
- sage/features/polymake.py +43 -0
- sage/features/poppler.py +58 -0
- sage/features/rubiks.py +180 -0
- sage/features/sagemath.py +1205 -0
- sage/features/sat.py +103 -0
- sage/features/singular.py +48 -0
- sage/features/sirocco.py +45 -0
- sage/features/sphinx.py +71 -0
- sage/features/standard.py +38 -0
- sage/features/symengine_py.py +44 -0
- sage/features/tdlib.py +38 -0
- sage/features/threejs.py +75 -0
- sage/features/topcom.py +67 -0
- sage/misc/all__sagemath_environment.py +2 -0
- sage/misc/package.py +570 -0
- sage/misc/package_dir.py +621 -0
- sage/misc/temporary_file.py +546 -0
- sage/misc/viewer.py +369 -0
- sage/version.py +5 -0
@@ -0,0 +1,256 @@
|
|
1
|
+
# sage_setup: distribution = sagemath-environment
|
2
|
+
r"""
|
3
|
+
Features for testing whether interpreter interfaces to ``magma``, ``maple``, ``mathematica`` etc. are functional
|
4
|
+
"""
|
5
|
+
|
6
|
+
# ****************************************************************************
|
7
|
+
# Copyright (C) 2021 Matthias Koeppe
|
8
|
+
#
|
9
|
+
# This program is free software: you can redistribute it and/or modify
|
10
|
+
# it under the terms of the GNU General Public License as published by
|
11
|
+
# the Free Software Foundation, either version 2 of the License, or
|
12
|
+
# (at your option) any later version.
|
13
|
+
# https://www.gnu.org/licenses/
|
14
|
+
# ****************************************************************************
|
15
|
+
|
16
|
+
import importlib
|
17
|
+
|
18
|
+
from . import Feature, FeatureTestResult, PythonModule
|
19
|
+
|
20
|
+
|
21
|
+
class InterfaceFeature(Feature):
|
22
|
+
r"""
|
23
|
+
A :class:`~sage.features.Feature` describing whether an :class:`~sage.interfaces.interface.Interface` is present and functional.
|
24
|
+
|
25
|
+
TESTS::
|
26
|
+
|
27
|
+
sage: from sage.features.interfaces import InterfaceFeature
|
28
|
+
sage: broken = InterfaceFeature("broken_interface", "sage.interfaces.does_not_exist")
|
29
|
+
sage: broken.is_present()
|
30
|
+
FeatureTestResult('sage.interfaces.does_not_exist', False)
|
31
|
+
sage: _.reason
|
32
|
+
"Failed to import `sage.interfaces.does_not_exist`: No module named 'sage.interfaces.does_not_exist'"
|
33
|
+
|
34
|
+
sage: also_broken = InterfaceFeature("also_broken_interface", "sage.interfaces.interface")
|
35
|
+
sage: also_broken.is_present()
|
36
|
+
FeatureTestResult('also_broken_interface', False)
|
37
|
+
sage: _.reason
|
38
|
+
"Interface also_broken_interface cannot be imported: module 'sage.interfaces.interface' has no attribute 'also_broken_interface'"
|
39
|
+
"""
|
40
|
+
@staticmethod
|
41
|
+
def __classcall__(cls, name, module, description=None):
|
42
|
+
"""
|
43
|
+
TESTS::
|
44
|
+
|
45
|
+
sage: from sage.features import PythonModule
|
46
|
+
sage: from sage.features.interfaces import InterfaceFeature
|
47
|
+
sage: f = InterfaceFeature("test_interface", "sage.interfaces.interface")
|
48
|
+
sage: f is InterfaceFeature("test_interface", PythonModule("sage.interfaces.interface"))
|
49
|
+
True
|
50
|
+
"""
|
51
|
+
if isinstance(module, str):
|
52
|
+
module = PythonModule(module)
|
53
|
+
return Feature.__classcall__(cls, name, module, description)
|
54
|
+
|
55
|
+
def __init__(self, name, module, description):
|
56
|
+
"""
|
57
|
+
TESTS::
|
58
|
+
|
59
|
+
sage: from sage.features.interfaces import InterfaceFeature
|
60
|
+
sage: f = InterfaceFeature("test_interface", "sage.interfaces.interface")
|
61
|
+
sage: isinstance(f, InterfaceFeature)
|
62
|
+
True
|
63
|
+
"""
|
64
|
+
super().__init__(name, description=description)
|
65
|
+
self.module = module
|
66
|
+
|
67
|
+
def _is_present(self):
|
68
|
+
"""
|
69
|
+
TESTS::
|
70
|
+
|
71
|
+
sage: from sage.features.interfaces import InterfaceFeature
|
72
|
+
sage: from sage.interfaces.sage0 import Sage
|
73
|
+
sage: f = InterfaceFeature("sage0", "sage.interfaces.sage0")
|
74
|
+
sage: f.is_present()
|
75
|
+
FeatureTestResult('sage0', True)
|
76
|
+
"""
|
77
|
+
result = self.module.is_present()
|
78
|
+
if not result:
|
79
|
+
return result
|
80
|
+
m = importlib.import_module(self.module.name)
|
81
|
+
try:
|
82
|
+
interface = getattr(m, self.name)
|
83
|
+
except Exception as exception:
|
84
|
+
return FeatureTestResult(self, False,
|
85
|
+
reason=f"Interface {self.name} cannot be imported: {exception}")
|
86
|
+
try:
|
87
|
+
interface('2+3')
|
88
|
+
return FeatureTestResult(self, True)
|
89
|
+
except Exception as exception:
|
90
|
+
return FeatureTestResult(self, False,
|
91
|
+
reason=f"Interface {interface} is not functional: {exception}")
|
92
|
+
|
93
|
+
|
94
|
+
class Mathics(InterfaceFeature):
|
95
|
+
r"""
|
96
|
+
A :class:`~sage.features.Feature` describing whether :class:`sage.interfaces.mathics.Mathics`
|
97
|
+
is present and functional.
|
98
|
+
|
99
|
+
EXAMPLES::
|
100
|
+
|
101
|
+
sage: from sage.features.interfaces import Mathics
|
102
|
+
sage: Mathics().is_present() # not tested
|
103
|
+
FeatureTestResult('mathics', False)
|
104
|
+
"""
|
105
|
+
|
106
|
+
@staticmethod
|
107
|
+
def __classcall__(cls):
|
108
|
+
return InterfaceFeature.__classcall__(cls, 'mathics', 'sage.interfaces.mathics')
|
109
|
+
|
110
|
+
|
111
|
+
# The following are provided by external software only (no SPKG)
|
112
|
+
|
113
|
+
class Magma(InterfaceFeature):
|
114
|
+
r"""
|
115
|
+
A :class:`~sage.features.Feature` describing whether :class:`sage.interfaces.magma.Magma`
|
116
|
+
is present and functional.
|
117
|
+
|
118
|
+
EXAMPLES::
|
119
|
+
|
120
|
+
sage: from sage.features.interfaces import Magma
|
121
|
+
sage: Magma().is_present() # random
|
122
|
+
FeatureTestResult('magma', False)
|
123
|
+
"""
|
124
|
+
|
125
|
+
@staticmethod
|
126
|
+
def __classcall__(cls):
|
127
|
+
return InterfaceFeature.__classcall__(cls, 'magma', 'sage.interfaces.magma')
|
128
|
+
|
129
|
+
|
130
|
+
class Matlab(InterfaceFeature):
|
131
|
+
r"""
|
132
|
+
A :class:`~sage.features.Feature` describing whether :class:`sage.interfaces.matlab.Matlab`
|
133
|
+
is present and functional.
|
134
|
+
|
135
|
+
EXAMPLES::
|
136
|
+
|
137
|
+
sage: from sage.features.interfaces import Matlab
|
138
|
+
sage: Matlab().is_present() # random
|
139
|
+
FeatureTestResult('matlab', False)
|
140
|
+
"""
|
141
|
+
|
142
|
+
@staticmethod
|
143
|
+
def __classcall__(cls):
|
144
|
+
return InterfaceFeature.__classcall__(cls, 'matlab', 'sage.interfaces.matlab')
|
145
|
+
|
146
|
+
|
147
|
+
class Mathematica(InterfaceFeature):
|
148
|
+
r"""
|
149
|
+
A :class:`~sage.features.Feature` describing whether :class:`sage.interfaces.mathematica.Mathematica`
|
150
|
+
is present and functional.
|
151
|
+
|
152
|
+
EXAMPLES::
|
153
|
+
|
154
|
+
sage: from sage.features.interfaces import Mathematica
|
155
|
+
sage: Mathematica().is_present() # not tested
|
156
|
+
FeatureTestResult('mathematica', False)
|
157
|
+
"""
|
158
|
+
|
159
|
+
@staticmethod
|
160
|
+
def __classcall__(cls):
|
161
|
+
return InterfaceFeature.__classcall__(cls, 'mathematica', 'sage.interfaces.mathematica')
|
162
|
+
|
163
|
+
|
164
|
+
class Maple(InterfaceFeature):
|
165
|
+
r"""
|
166
|
+
A :class:`~sage.features.Feature` describing whether :class:`sage.interfaces.maple.Maple`
|
167
|
+
is present and functional.
|
168
|
+
|
169
|
+
EXAMPLES::
|
170
|
+
|
171
|
+
sage: from sage.features.interfaces import Maple
|
172
|
+
sage: Maple().is_present() # random
|
173
|
+
FeatureTestResult('maple', False)
|
174
|
+
"""
|
175
|
+
|
176
|
+
@staticmethod
|
177
|
+
def __classcall__(cls):
|
178
|
+
return InterfaceFeature.__classcall__(cls, 'maple', 'sage.interfaces.maple')
|
179
|
+
|
180
|
+
|
181
|
+
class Macaulay2(InterfaceFeature):
|
182
|
+
r"""
|
183
|
+
A :class:`~sage.features.Feature` describing whether :class:`sage.interfaces.macaulay2.Macaulay2`
|
184
|
+
is present and functional.
|
185
|
+
|
186
|
+
EXAMPLES::
|
187
|
+
|
188
|
+
sage: from sage.features.interfaces import Macaulay2
|
189
|
+
sage: Macaulay2().is_present() # random
|
190
|
+
FeatureTestResult('macaulay2', False)
|
191
|
+
"""
|
192
|
+
|
193
|
+
@staticmethod
|
194
|
+
def __classcall__(cls):
|
195
|
+
return InterfaceFeature.__classcall__(cls, 'macaulay2', 'sage.interfaces.macaulay2')
|
196
|
+
|
197
|
+
|
198
|
+
class Octave(InterfaceFeature):
|
199
|
+
r"""
|
200
|
+
A :class:`~sage.features.Feature` describing whether :class:`sage.interfaces.octave.Octave`
|
201
|
+
is present and functional.
|
202
|
+
|
203
|
+
EXAMPLES::
|
204
|
+
|
205
|
+
sage: from sage.features.interfaces import Octave
|
206
|
+
sage: Octave().is_present() # random
|
207
|
+
FeatureTestResult('octave', False)
|
208
|
+
"""
|
209
|
+
|
210
|
+
@staticmethod
|
211
|
+
def __classcall__(cls):
|
212
|
+
return InterfaceFeature.__classcall__(cls, 'octave', 'sage.interfaces.octave')
|
213
|
+
|
214
|
+
|
215
|
+
class Scilab(InterfaceFeature):
|
216
|
+
r"""
|
217
|
+
A :class:`~sage.features.Feature` describing whether :class:`sage.interfaces.scilab.Scilab`
|
218
|
+
is present and functional.
|
219
|
+
|
220
|
+
EXAMPLES::
|
221
|
+
|
222
|
+
sage: from sage.features.interfaces import Scilab
|
223
|
+
sage: Scilab().is_present() # random
|
224
|
+
FeatureTestResult('scilab', False)
|
225
|
+
"""
|
226
|
+
|
227
|
+
@staticmethod
|
228
|
+
def __classcall__(cls):
|
229
|
+
return InterfaceFeature.__classcall__(cls, 'scilab', 'sage.interfaces.scilab')
|
230
|
+
|
231
|
+
|
232
|
+
def all_features():
|
233
|
+
r"""
|
234
|
+
Return features corresponding to interpreter interfaces.
|
235
|
+
|
236
|
+
EXAMPLES::
|
237
|
+
|
238
|
+
sage: from sage.features.interfaces import all_features
|
239
|
+
sage: list(all_features())
|
240
|
+
[Feature('magma'),
|
241
|
+
Feature('matlab'),
|
242
|
+
Feature('mathematica'),
|
243
|
+
Feature('mathics'),
|
244
|
+
Feature('maple'),
|
245
|
+
Feature('macaulay2'),
|
246
|
+
Feature('octave'),
|
247
|
+
Feature('scilab')]
|
248
|
+
"""
|
249
|
+
return [Magma(),
|
250
|
+
Matlab(),
|
251
|
+
Mathematica(),
|
252
|
+
Mathics(),
|
253
|
+
Maple(),
|
254
|
+
Macaulay2(),
|
255
|
+
Octave(),
|
256
|
+
Scilab()]
|
@@ -0,0 +1,65 @@
|
|
1
|
+
# sage_setup: distribution = sagemath-environment
|
2
|
+
r"""
|
3
|
+
Feature for testing if the Internet is available
|
4
|
+
"""
|
5
|
+
|
6
|
+
# ****************************************************************************
|
7
|
+
# Copyright (C) 2021 Matthias Koeppe
|
8
|
+
#
|
9
|
+
# This program is free software: you can redistribute it and/or modify
|
10
|
+
# it under the terms of the GNU General Public License as published by
|
11
|
+
# the Free Software Foundation, either version 2 of the License, or
|
12
|
+
# (at your option) any later version.
|
13
|
+
# https://www.gnu.org/licenses/
|
14
|
+
# ****************************************************************************
|
15
|
+
|
16
|
+
from . import Feature, FeatureTestResult
|
17
|
+
|
18
|
+
|
19
|
+
class Internet(Feature):
|
20
|
+
r"""
|
21
|
+
A :class:`~sage.features.Feature` describing if Internet is available.
|
22
|
+
|
23
|
+
Failure of connecting to the site "https://www.sagemath.org" within a second
|
24
|
+
is regarded as internet being not available.
|
25
|
+
|
26
|
+
EXAMPLES::
|
27
|
+
|
28
|
+
sage: from sage.features.internet import Internet
|
29
|
+
sage: Internet()
|
30
|
+
Feature('internet')
|
31
|
+
"""
|
32
|
+
def __init__(self):
|
33
|
+
r"""
|
34
|
+
TESTS::
|
35
|
+
|
36
|
+
sage: from sage.features.internet import Internet
|
37
|
+
sage: Internet() is Internet()
|
38
|
+
True
|
39
|
+
"""
|
40
|
+
Feature.__init__(self, 'internet')
|
41
|
+
|
42
|
+
def _is_present(self):
|
43
|
+
r"""
|
44
|
+
Test whether Internet is available.
|
45
|
+
|
46
|
+
EXAMPLES::
|
47
|
+
|
48
|
+
sage: from sage.features.internet import Internet
|
49
|
+
sage: Internet()._is_present() # random, optional - internet
|
50
|
+
FeatureTestResult('internet', True)
|
51
|
+
"""
|
52
|
+
import urllib.error
|
53
|
+
from urllib.request import Request, urlopen
|
54
|
+
from ssl import create_default_context as default_context
|
55
|
+
|
56
|
+
req = Request("https://www.sagemath.org", headers={"User-Agent": "sage-doctest"})
|
57
|
+
try:
|
58
|
+
urlopen(req, timeout=1, context=default_context())
|
59
|
+
return FeatureTestResult(self, True)
|
60
|
+
except (urllib.error.URLError, TimeoutError):
|
61
|
+
return FeatureTestResult(self, False)
|
62
|
+
|
63
|
+
|
64
|
+
def all_features():
|
65
|
+
return [Internet()]
|
sage/features/jmol.py
ADDED
@@ -0,0 +1,44 @@
|
|
1
|
+
# sage_setup: distribution = sagemath-environment
|
2
|
+
import os
|
3
|
+
|
4
|
+
from . import StaticFile
|
5
|
+
|
6
|
+
|
7
|
+
class JmolDataJar(StaticFile):
|
8
|
+
r"""
|
9
|
+
A :class:`~sage.features.Feature` which describes the presence of
|
10
|
+
JmolData.jar in a few standard locations.
|
11
|
+
|
12
|
+
EXAMPLES::
|
13
|
+
|
14
|
+
sage: from sage.features.jmol import JmolDataJar
|
15
|
+
sage: bool(JmolDataJar().is_present()) # needs jmol
|
16
|
+
True
|
17
|
+
"""
|
18
|
+
|
19
|
+
def __init__(self):
|
20
|
+
r"""
|
21
|
+
TESTS::
|
22
|
+
|
23
|
+
sage: from sage.features.jmol import JmolDataJar
|
24
|
+
sage: isinstance(JmolDataJar(), JmolDataJar)
|
25
|
+
True
|
26
|
+
"""
|
27
|
+
from sage.env import SAGE_SHARE, JMOL_DIR
|
28
|
+
|
29
|
+
jmol_search_path = JMOL_DIR or (
|
30
|
+
os.path.join(SAGE_SHARE, "sagemath", "jmol"),
|
31
|
+
os.path.join(SAGE_SHARE, "jmol")
|
32
|
+
)
|
33
|
+
|
34
|
+
StaticFile.__init__(
|
35
|
+
self, name='jmol',
|
36
|
+
filename='JmolData.jar',
|
37
|
+
search_path=jmol_search_path,
|
38
|
+
spkg='jmol',
|
39
|
+
type='optional',
|
40
|
+
description="Java viewer for chemical structures in 3D")
|
41
|
+
|
42
|
+
|
43
|
+
def all_features():
|
44
|
+
return [JmolDataJar()]
|
@@ -0,0 +1,146 @@
|
|
1
|
+
# sage_setup: distribution = sagemath-environment
|
2
|
+
r"""
|
3
|
+
Join features
|
4
|
+
"""
|
5
|
+
|
6
|
+
# ****************************************************************************
|
7
|
+
# Copyright (C) 2021-2022 Matthias Koeppe
|
8
|
+
# 2021-2022 Kwankyu Lee
|
9
|
+
#
|
10
|
+
# This program is free software: you can redistribute it and/or modify
|
11
|
+
# it under the terms of the GNU General Public License as published by
|
12
|
+
# the Free Software Foundation, either version 2 of the License, or
|
13
|
+
# (at your option) any later version.
|
14
|
+
# https://www.gnu.org/licenses/
|
15
|
+
# ****************************************************************************
|
16
|
+
|
17
|
+
from . import Feature, FeatureTestResult
|
18
|
+
|
19
|
+
|
20
|
+
class JoinFeature(Feature):
|
21
|
+
r"""
|
22
|
+
Join of several :class:`~sage.features.Feature` instances.
|
23
|
+
|
24
|
+
This creates a new feature as the union of the given features. Typically
|
25
|
+
these are executables of an SPKG. For an example, see
|
26
|
+
:class:`~sage.features.rubiks.Rubiks`.
|
27
|
+
|
28
|
+
Furthermore, this can be the union of a single feature. This is used to map
|
29
|
+
the given feature to a more convenient name to be used in ``optional`` tags
|
30
|
+
of doctests. Thus you can equip a feature such as a
|
31
|
+
:class:`~sage.features.PythonModule` with a tag name that differs from the
|
32
|
+
systematic tag name. As an example for this use case, see
|
33
|
+
:class:`~sage.features.meataxe.Meataxe`.
|
34
|
+
|
35
|
+
EXAMPLES::
|
36
|
+
|
37
|
+
sage: from sage.features import Executable
|
38
|
+
sage: from sage.features.join_feature import JoinFeature
|
39
|
+
sage: F = JoinFeature("shell-boolean",
|
40
|
+
....: (Executable('shell-true', 'true'),
|
41
|
+
....: Executable('shell-false', 'false')))
|
42
|
+
sage: F.is_present()
|
43
|
+
FeatureTestResult('shell-boolean', True)
|
44
|
+
sage: F = JoinFeature("asdfghjkl",
|
45
|
+
....: (Executable('shell-true', 'true'),
|
46
|
+
....: Executable('xxyyyy', 'xxyyyy-does-not-exist')))
|
47
|
+
sage: F.is_present()
|
48
|
+
FeatureTestResult('xxyyyy', False)
|
49
|
+
"""
|
50
|
+
|
51
|
+
def __init__(self, name, features, spkg=None, url=None, description=None, type=None,
|
52
|
+
**kwds):
|
53
|
+
"""
|
54
|
+
TESTS:
|
55
|
+
|
56
|
+
The empty join feature is present::
|
57
|
+
|
58
|
+
sage: from sage.features.join_feature import JoinFeature
|
59
|
+
sage: JoinFeature("empty", ()).is_present()
|
60
|
+
FeatureTestResult('empty', True)
|
61
|
+
"""
|
62
|
+
if spkg is None:
|
63
|
+
spkgs = set(f.spkg for f in features if f.spkg)
|
64
|
+
if len(spkgs) > 1:
|
65
|
+
raise ValueError('given features have more than one spkg; provide spkg argument')
|
66
|
+
elif len(spkgs) == 1:
|
67
|
+
spkg = next(iter(spkgs))
|
68
|
+
if url is None:
|
69
|
+
urls = set(f.url for f in features if f.url)
|
70
|
+
if len(urls) > 1:
|
71
|
+
raise ValueError('given features have more than one url; provide url argument')
|
72
|
+
elif len(urls) == 1:
|
73
|
+
url = next(iter(urls))
|
74
|
+
if type is None:
|
75
|
+
if any(f._spkg_type() == 'experimental' for f in features):
|
76
|
+
type = 'experimental'
|
77
|
+
elif any(f._spkg_type() == 'optional' for f in features):
|
78
|
+
type = 'optional'
|
79
|
+
else:
|
80
|
+
type = 'standard'
|
81
|
+
|
82
|
+
super().__init__(name, spkg=spkg, url=url, description=description, type=type, **kwds)
|
83
|
+
self._features = features
|
84
|
+
|
85
|
+
def _is_present(self):
|
86
|
+
r"""
|
87
|
+
Test for the presence of the join feature.
|
88
|
+
|
89
|
+
EXAMPLES::
|
90
|
+
|
91
|
+
sage: from sage.features.latte import Latte
|
92
|
+
sage: Latte()._is_present() # optional - latte_int
|
93
|
+
FeatureTestResult('latte_int', True)
|
94
|
+
"""
|
95
|
+
for f in self._features:
|
96
|
+
test = f._is_present()
|
97
|
+
if not test:
|
98
|
+
return test
|
99
|
+
return FeatureTestResult(self, True)
|
100
|
+
|
101
|
+
def hide(self):
|
102
|
+
r"""
|
103
|
+
Hide this feature and all its joined features.
|
104
|
+
|
105
|
+
EXAMPLES::
|
106
|
+
|
107
|
+
sage: from sage.features.sagemath import sage__groups
|
108
|
+
sage: f = sage__groups()
|
109
|
+
sage: f.hide()
|
110
|
+
sage: f._features[0].is_present()
|
111
|
+
FeatureTestResult('sage.groups.perm_gps.permgroup', False)
|
112
|
+
|
113
|
+
sage: f.require()
|
114
|
+
Traceback (most recent call last):
|
115
|
+
...
|
116
|
+
FeatureNotPresentError: sage.groups is not available.
|
117
|
+
Feature `sage.groups` is hidden.
|
118
|
+
Use method `unhide` to make it available again.
|
119
|
+
"""
|
120
|
+
for f in self._features:
|
121
|
+
f.hide()
|
122
|
+
super().hide()
|
123
|
+
|
124
|
+
def unhide(self):
|
125
|
+
r"""
|
126
|
+
Revert what :meth:`hide` did.
|
127
|
+
|
128
|
+
EXAMPLES::
|
129
|
+
|
130
|
+
sage: from sage.features.sagemath import sage__groups
|
131
|
+
sage: f = sage__groups()
|
132
|
+
sage: f.hide()
|
133
|
+
sage: f.is_present()
|
134
|
+
FeatureTestResult('sage.groups', False)
|
135
|
+
sage: f._features[0].is_present()
|
136
|
+
FeatureTestResult('sage.groups.perm_gps.permgroup', False)
|
137
|
+
|
138
|
+
sage: f.unhide()
|
139
|
+
sage: f.is_present() # optional sage.groups
|
140
|
+
FeatureTestResult('sage.groups', True)
|
141
|
+
sage: f._features[0].is_present() # optional sage.groups
|
142
|
+
FeatureTestResult('sage.groups.perm_gps.permgroup', True)
|
143
|
+
"""
|
144
|
+
for f in self._features:
|
145
|
+
f.unhide()
|
146
|
+
super().unhide()
|
sage/features/kenzo.py
ADDED
@@ -0,0 +1,77 @@
|
|
1
|
+
# sage_setup: distribution = sagemath-environment
|
2
|
+
r"""
|
3
|
+
Feature for testing the presence of ``kenzo``
|
4
|
+
"""
|
5
|
+
|
6
|
+
# ****************************************************************************
|
7
|
+
# Copyright (C) 2020 Travis Scrimshaw
|
8
|
+
# 2021 Matthias Koeppe
|
9
|
+
# 2021 Michael Orlitzky
|
10
|
+
#
|
11
|
+
# This program is free software: you can redistribute it and/or modify
|
12
|
+
# it under the terms of the GNU General Public License as published by
|
13
|
+
# the Free Software Foundation, either version 2 of the License, or
|
14
|
+
# (at your option) any later version.
|
15
|
+
# https://www.gnu.org/licenses/
|
16
|
+
# ****************************************************************************
|
17
|
+
|
18
|
+
|
19
|
+
from . import Feature, FeatureTestResult
|
20
|
+
|
21
|
+
class Kenzo(Feature):
|
22
|
+
r"""
|
23
|
+
A :class:`~sage.features.Feature` describing the presence of :ref:`Kenzo <spkg_kenzo>`.
|
24
|
+
|
25
|
+
EXAMPLES::
|
26
|
+
|
27
|
+
sage: from sage.features.kenzo import Kenzo
|
28
|
+
sage: Kenzo().is_present() # optional - kenzo
|
29
|
+
FeatureTestResult('kenzo', True)
|
30
|
+
"""
|
31
|
+
def __init__(self):
|
32
|
+
r"""
|
33
|
+
TESTS::
|
34
|
+
|
35
|
+
sage: from sage.features.kenzo import Kenzo
|
36
|
+
sage: isinstance(Kenzo(), Kenzo)
|
37
|
+
True
|
38
|
+
"""
|
39
|
+
Feature.__init__(self, name='kenzo', spkg='kenzo',
|
40
|
+
url='https://github.com/miguelmarco/kenzo/')
|
41
|
+
|
42
|
+
def _is_present(self):
|
43
|
+
r"""
|
44
|
+
Check whether Kenzo is installed and works.
|
45
|
+
|
46
|
+
EXAMPLES::
|
47
|
+
|
48
|
+
sage: from sage.features.kenzo import Kenzo
|
49
|
+
sage: Kenzo()._is_present() # optional - kenzo
|
50
|
+
FeatureTestResult('kenzo', True)
|
51
|
+
"""
|
52
|
+
try:
|
53
|
+
from sage.libs.ecl import ecl_eval
|
54
|
+
except ImportError:
|
55
|
+
return FeatureTestResult(self, False, reason="sage.libs.ecl is not available")
|
56
|
+
# Redirection of ECL and Maxima stdout to /dev/null
|
57
|
+
# This is also done in the Maxima library, but we
|
58
|
+
# also do it here for redundancy.
|
59
|
+
ecl_eval(r"""(defparameter *dev-null* (make-two-way-stream
|
60
|
+
(make-concatenated-stream) (make-broadcast-stream)))""")
|
61
|
+
ecl_eval("(setf original-standard-output *standard-output*)")
|
62
|
+
ecl_eval("(setf *standard-output* *dev-null*)")
|
63
|
+
|
64
|
+
try:
|
65
|
+
from sage.env import KENZO_FAS
|
66
|
+
if KENZO_FAS:
|
67
|
+
ecl_eval("(require :kenzo \"{}\")".format(KENZO_FAS))
|
68
|
+
else:
|
69
|
+
ecl_eval("(require :kenzo)")
|
70
|
+
|
71
|
+
except RuntimeError:
|
72
|
+
return FeatureTestResult(self, False, reason="Unable to make ECL require kenzo")
|
73
|
+
return FeatureTestResult(self, True)
|
74
|
+
|
75
|
+
|
76
|
+
def all_features():
|
77
|
+
return [Kenzo()]
|