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
sage/features/latex.py
ADDED
@@ -0,0 +1,300 @@
|
|
1
|
+
# sage_setup: distribution = sagemath-environment
|
2
|
+
r"""
|
3
|
+
Features for testing the presence of ``latex`` and equivalent programs
|
4
|
+
"""
|
5
|
+
|
6
|
+
# ****************************************************************************
|
7
|
+
# Copyright (C) 2021 Sebastien Labbe <slabqc@gmail.com>
|
8
|
+
# 2021 Matthias Koeppe
|
9
|
+
# 2022 Kwankyu Lee
|
10
|
+
# 2022 Sebastian Oehms
|
11
|
+
#
|
12
|
+
# This program is free software: you can redistribute it and/or modify
|
13
|
+
# it under the terms of the GNU General Public License as published by
|
14
|
+
# the Free Software Foundation, either version 2 of the License, or
|
15
|
+
# (at your option) any later version.
|
16
|
+
# https://www.gnu.org/licenses/
|
17
|
+
# ****************************************************************************
|
18
|
+
|
19
|
+
from . import StaticFile, Executable, FeatureTestResult, FeatureNotPresentError
|
20
|
+
|
21
|
+
latex_url = 'https://www.latex-project.org/'
|
22
|
+
latex_spkg = 'texlive'
|
23
|
+
|
24
|
+
|
25
|
+
class LaTeX(Executable):
|
26
|
+
r"""
|
27
|
+
A :class:`~sage.features.Feature` describing the presence of ``latex``.
|
28
|
+
|
29
|
+
EXAMPLES::
|
30
|
+
|
31
|
+
sage: from sage.features.latex import latex
|
32
|
+
sage: latex().is_present() # optional - latex
|
33
|
+
FeatureTestResult('latex', True)
|
34
|
+
"""
|
35
|
+
def __init__(self, name):
|
36
|
+
r"""
|
37
|
+
TESTS::
|
38
|
+
|
39
|
+
sage: from sage.features.latex import latex
|
40
|
+
sage: isinstance(latex(), latex)
|
41
|
+
True
|
42
|
+
"""
|
43
|
+
super().__init__(name, executable=name, spkg=latex_spkg, url=latex_url)
|
44
|
+
|
45
|
+
def is_functional(self):
|
46
|
+
r"""
|
47
|
+
Return whether ``latex`` in the path is functional.
|
48
|
+
|
49
|
+
EXAMPLES::
|
50
|
+
|
51
|
+
sage: from sage.features.latex import latex
|
52
|
+
sage: latex().is_functional() # optional - latex
|
53
|
+
FeatureTestResult('latex', True)
|
54
|
+
|
55
|
+
When the feature is not functional, more information on the reason
|
56
|
+
can be obtained as follows::
|
57
|
+
|
58
|
+
sage: result = latex().is_functional() # not tested
|
59
|
+
sage: print(result.reason) # not tested
|
60
|
+
Running latex on a sample file
|
61
|
+
(with command='latex -interaction=nonstopmode tmp_wmpos8ak.tex')
|
62
|
+
returned nonzero exit status='1' with stderr=''
|
63
|
+
and stdout='This is pdfTeX,
|
64
|
+
...
|
65
|
+
Runaway argument?
|
66
|
+
{document
|
67
|
+
! File ended while scanning use of \end.
|
68
|
+
...
|
69
|
+
No pages of output.
|
70
|
+
Transcript written on tmp_wmpos8ak.log.'
|
71
|
+
"""
|
72
|
+
lines = []
|
73
|
+
lines.append(r"\documentclass{article}")
|
74
|
+
lines.append(r"\begin{document}")
|
75
|
+
lines.append(r"$\alpha+2$")
|
76
|
+
lines.append(r"\end{document}")
|
77
|
+
content = '\n'.join(lines)
|
78
|
+
|
79
|
+
# create a simple tex file with the content
|
80
|
+
from sage.misc.temporary_file import tmp_filename
|
81
|
+
base_filename_tex = tmp_filename(ext='.tex')
|
82
|
+
with open(base_filename_tex, 'w') as f:
|
83
|
+
f.write(content)
|
84
|
+
import os
|
85
|
+
base, filename_tex = os.path.split(base_filename_tex)
|
86
|
+
|
87
|
+
# running latex
|
88
|
+
from subprocess import run
|
89
|
+
cmd = [self.name, '-interaction=nonstopmode', filename_tex]
|
90
|
+
cmd = ' '.join(cmd)
|
91
|
+
result = run(cmd, shell=True, cwd=base, capture_output=True, text=True)
|
92
|
+
|
93
|
+
# return
|
94
|
+
if result.returncode == 0:
|
95
|
+
return FeatureTestResult(self, True)
|
96
|
+
else:
|
97
|
+
return FeatureTestResult(self, False, reason="Running latex on "
|
98
|
+
"a sample file (with command='{}') returned nonzero "
|
99
|
+
"exit status='{}' with stderr='{}' "
|
100
|
+
"and stdout='{}'".format(result.args,
|
101
|
+
result.returncode,
|
102
|
+
result.stderr.strip(),
|
103
|
+
result.stdout.strip()))
|
104
|
+
|
105
|
+
|
106
|
+
class latex(LaTeX):
|
107
|
+
r"""
|
108
|
+
A :class:`~sage.features.Feature` describing the presence of ``latex``.
|
109
|
+
|
110
|
+
EXAMPLES::
|
111
|
+
|
112
|
+
sage: from sage.features.latex import latex
|
113
|
+
sage: latex().is_present() # optional - latex
|
114
|
+
FeatureTestResult('latex', True)
|
115
|
+
"""
|
116
|
+
def __init__(self):
|
117
|
+
r"""
|
118
|
+
TESTS::
|
119
|
+
|
120
|
+
sage: from sage.features.latex import latex
|
121
|
+
sage: isinstance(latex(), latex)
|
122
|
+
True
|
123
|
+
"""
|
124
|
+
super().__init__("latex")
|
125
|
+
|
126
|
+
|
127
|
+
class pdflatex(LaTeX):
|
128
|
+
r"""
|
129
|
+
A :class:`~sage.features.Feature` describing the presence of ``pdflatex``.
|
130
|
+
|
131
|
+
EXAMPLES::
|
132
|
+
|
133
|
+
sage: from sage.features.latex import pdflatex
|
134
|
+
sage: pdflatex().is_present() # optional - pdflatex
|
135
|
+
FeatureTestResult('pdflatex', True)
|
136
|
+
"""
|
137
|
+
def __init__(self):
|
138
|
+
r"""
|
139
|
+
TESTS::
|
140
|
+
|
141
|
+
sage: from sage.features.latex import pdflatex
|
142
|
+
sage: isinstance(pdflatex(), pdflatex)
|
143
|
+
True
|
144
|
+
"""
|
145
|
+
super().__init__("pdflatex")
|
146
|
+
|
147
|
+
|
148
|
+
class xelatex(LaTeX):
|
149
|
+
r"""
|
150
|
+
A :class:`~sage.features.Feature` describing the presence of ``xelatex``.
|
151
|
+
|
152
|
+
EXAMPLES::
|
153
|
+
|
154
|
+
sage: from sage.features.latex import xelatex
|
155
|
+
sage: xelatex().is_present() # optional - xelatex
|
156
|
+
FeatureTestResult('xelatex', True)
|
157
|
+
"""
|
158
|
+
def __init__(self):
|
159
|
+
r"""
|
160
|
+
TESTS::
|
161
|
+
|
162
|
+
sage: from sage.features.latex import xelatex
|
163
|
+
sage: isinstance(xelatex(), xelatex)
|
164
|
+
True
|
165
|
+
"""
|
166
|
+
super().__init__("xelatex")
|
167
|
+
|
168
|
+
|
169
|
+
class lualatex(LaTeX):
|
170
|
+
r"""
|
171
|
+
A :class:`~sage.features.Feature` describing the presence of ``lualatex``.
|
172
|
+
|
173
|
+
EXAMPLES::
|
174
|
+
|
175
|
+
sage: from sage.features.latex import lualatex
|
176
|
+
sage: lualatex().is_present() # optional - lualatex
|
177
|
+
FeatureTestResult('lualatex', True)
|
178
|
+
"""
|
179
|
+
def __init__(self):
|
180
|
+
r"""
|
181
|
+
TESTS::
|
182
|
+
|
183
|
+
sage: from sage.features.latex import lualatex
|
184
|
+
sage: isinstance(lualatex(), lualatex)
|
185
|
+
True
|
186
|
+
"""
|
187
|
+
super().__init__("lualatex")
|
188
|
+
|
189
|
+
|
190
|
+
class dvips(Executable):
|
191
|
+
r"""
|
192
|
+
A :class:`~sage.features.Feature` describing the presence of ``dvips``.
|
193
|
+
|
194
|
+
EXAMPLES::
|
195
|
+
|
196
|
+
sage: from sage.features.latex import dvips
|
197
|
+
sage: dvips().is_present() # optional - dvips
|
198
|
+
FeatureTestResult('dvips', True)
|
199
|
+
"""
|
200
|
+
def __init__(self):
|
201
|
+
r"""
|
202
|
+
TESTS::
|
203
|
+
|
204
|
+
sage: from sage.features.latex import dvips
|
205
|
+
sage: isinstance(dvips(), dvips)
|
206
|
+
True
|
207
|
+
"""
|
208
|
+
Executable.__init__(self, 'dvips', executable='dvips',
|
209
|
+
url='https://tug.org/texinfohtml/dvips.html')
|
210
|
+
|
211
|
+
class TeXFile(StaticFile):
|
212
|
+
r"""
|
213
|
+
A :class:`sage.features.Feature` describing the presence of a TeX file.
|
214
|
+
|
215
|
+
EXAMPLES::
|
216
|
+
|
217
|
+
sage: from sage.features.latex import TeXFile
|
218
|
+
sage: TeXFile('x', 'x.tex').is_present() # optional - latex
|
219
|
+
FeatureTestResult('x', True)
|
220
|
+
"""
|
221
|
+
def __init__(self, name, filename, **kwds):
|
222
|
+
r"""
|
223
|
+
Initialize.
|
224
|
+
|
225
|
+
TESTS::
|
226
|
+
|
227
|
+
sage: from sage.features.latex import TeXFile
|
228
|
+
sage: TeXFile('nonexisting', 'xxxxxx-nonexisting-file.tex').is_present() # optional - latex
|
229
|
+
FeatureTestResult('nonexisting', False)
|
230
|
+
"""
|
231
|
+
StaticFile.__init__(self, name, filename, search_path=[], **kwds)
|
232
|
+
|
233
|
+
def absolute_filename(self) -> str:
|
234
|
+
r"""
|
235
|
+
The absolute path of the file.
|
236
|
+
|
237
|
+
EXAMPLES::
|
238
|
+
|
239
|
+
sage: from sage.features.latex import TeXFile
|
240
|
+
sage: feature = TeXFile('latex_class_article', 'article.cls')
|
241
|
+
sage: feature.absolute_filename() # optional - latex
|
242
|
+
'.../latex/base/article.cls'
|
243
|
+
"""
|
244
|
+
from subprocess import run, CalledProcessError, PIPE
|
245
|
+
try:
|
246
|
+
proc = run(['kpsewhich', self.filename],
|
247
|
+
capture_output=True, text=True, check=True)
|
248
|
+
return proc.stdout.strip()
|
249
|
+
except CalledProcessError:
|
250
|
+
reason = "{filename!r} not found by kpsewhich".format(filename=self.filename)
|
251
|
+
raise FeatureNotPresentError(self, reason)
|
252
|
+
|
253
|
+
def _is_present(self):
|
254
|
+
r"""
|
255
|
+
Test for the presence of the TeX file.
|
256
|
+
|
257
|
+
EXAMPLES::
|
258
|
+
|
259
|
+
sage: from sage.features.latex import LaTeXPackage, latex
|
260
|
+
sage: f = LaTeXPackage("tkz-graph")
|
261
|
+
sage: g = latex()
|
262
|
+
sage: not f.is_present() or bool(g.is_present()) # indirect doctest
|
263
|
+
True
|
264
|
+
"""
|
265
|
+
return latex().is_present() and super()._is_present()
|
266
|
+
|
267
|
+
|
268
|
+
class LaTeXPackage(TeXFile):
|
269
|
+
r"""
|
270
|
+
A :class:`sage.features.Feature` describing the presence of a LaTeX package
|
271
|
+
(``.sty`` file).
|
272
|
+
|
273
|
+
EXAMPLES::
|
274
|
+
|
275
|
+
sage: from sage.features.latex import LaTeXPackage
|
276
|
+
sage: LaTeXPackage('graphics').is_present() # optional - latex
|
277
|
+
FeatureTestResult('latex_package_graphics', True)
|
278
|
+
"""
|
279
|
+
@staticmethod
|
280
|
+
def __classcall__(cls, package_name, **kwds):
|
281
|
+
"""
|
282
|
+
TESTS::
|
283
|
+
|
284
|
+
sage: from sage.features.latex import LaTeXPackage
|
285
|
+
sage: LaTeXPackage('graphics') is LaTeXPackage('graphics')
|
286
|
+
True
|
287
|
+
"""
|
288
|
+
return TeXFile.__classcall__(cls,
|
289
|
+
f'latex_package_{package_name}'.replace('-', '_'),
|
290
|
+
f'{package_name}.sty',
|
291
|
+
**kwds)
|
292
|
+
|
293
|
+
|
294
|
+
def all_features():
|
295
|
+
return [latex(),
|
296
|
+
pdflatex(),
|
297
|
+
xelatex(),
|
298
|
+
lualatex(),
|
299
|
+
dvips(),
|
300
|
+
LaTeXPackage("tkz-graph")]
|
sage/features/latte.py
ADDED
@@ -0,0 +1,85 @@
|
|
1
|
+
# sage_setup: distribution = sagemath-environment
|
2
|
+
r"""
|
3
|
+
Features for testing the presence of ``latte_int``
|
4
|
+
"""
|
5
|
+
|
6
|
+
# ****************************************************************************
|
7
|
+
# Copyright (C) 2018 Vincent Delecroix
|
8
|
+
# 2019 Frédéric Chapoton
|
9
|
+
# 2021 Matthias Koeppe
|
10
|
+
# 2021 Kwankyu Lee
|
11
|
+
#
|
12
|
+
# This program is free software: you can redistribute it and/or modify
|
13
|
+
# it under the terms of the GNU General Public License as published by
|
14
|
+
# the Free Software Foundation, either version 2 of the License, or
|
15
|
+
# (at your option) any later version.
|
16
|
+
# https://www.gnu.org/licenses/
|
17
|
+
# ****************************************************************************
|
18
|
+
|
19
|
+
from . import Executable
|
20
|
+
from .join_feature import JoinFeature
|
21
|
+
|
22
|
+
|
23
|
+
LATTE_URL = "https://www.math.ucdavis.edu/~latte/software.php"
|
24
|
+
|
25
|
+
|
26
|
+
class Latte_count(Executable):
|
27
|
+
r"""
|
28
|
+
Feature for the executable ``count`` from :ref:`LattE integrale <spkg_latte_int>`.
|
29
|
+
"""
|
30
|
+
def __init__(self):
|
31
|
+
r"""
|
32
|
+
TESTS::
|
33
|
+
|
34
|
+
sage: from sage.features.latte import Latte_count
|
35
|
+
sage: isinstance(Latte_count(), Latte_count)
|
36
|
+
True
|
37
|
+
"""
|
38
|
+
Executable.__init__(self, 'count', executable='count',
|
39
|
+
spkg='latte_int',
|
40
|
+
url=LATTE_URL)
|
41
|
+
|
42
|
+
|
43
|
+
class Latte_integrate(Executable):
|
44
|
+
r"""
|
45
|
+
Feature for the executable ``integrate`` from :ref:`LattE integrale <spkg_latte_int>`.
|
46
|
+
"""
|
47
|
+
def __init__(self):
|
48
|
+
r"""
|
49
|
+
TESTS::
|
50
|
+
|
51
|
+
sage: from sage.features.latte import Latte_integrate
|
52
|
+
sage: isinstance(Latte_integrate(), Latte_integrate)
|
53
|
+
True
|
54
|
+
"""
|
55
|
+
Executable.__init__(self, 'integrate', executable='integrate',
|
56
|
+
spkg='latte_int',
|
57
|
+
url=LATTE_URL)
|
58
|
+
|
59
|
+
|
60
|
+
class Latte(JoinFeature):
|
61
|
+
r"""
|
62
|
+
A :class:`~sage.features.Feature` describing the presence of excecutables
|
63
|
+
from :ref:`LattE integrale <spkg_latte_int>`.
|
64
|
+
|
65
|
+
EXAMPLES::
|
66
|
+
|
67
|
+
sage: from sage.features.latte import Latte
|
68
|
+
sage: Latte().is_present() # optional - latte_int
|
69
|
+
FeatureTestResult('latte_int', True)
|
70
|
+
"""
|
71
|
+
def __init__(self):
|
72
|
+
r"""
|
73
|
+
TESTS::
|
74
|
+
|
75
|
+
sage: from sage.features.latte import Latte
|
76
|
+
sage: isinstance(Latte(), Latte)
|
77
|
+
True
|
78
|
+
"""
|
79
|
+
JoinFeature.__init__(self, 'latte_int',
|
80
|
+
(Latte_count(), Latte_integrate()),
|
81
|
+
description='LattE')
|
82
|
+
|
83
|
+
|
84
|
+
def all_features():
|
85
|
+
return [Latte()]
|
sage/features/lrs.py
ADDED
@@ -0,0 +1,164 @@
|
|
1
|
+
# sage_setup: distribution = sagemath-environment
|
2
|
+
r"""
|
3
|
+
Feature for testing the presence of ``lrslib``
|
4
|
+
"""
|
5
|
+
|
6
|
+
# *****************************************************************************
|
7
|
+
# Copyright (C) 2016 Julian Rüth
|
8
|
+
# 2018 Jeroen Demeyer
|
9
|
+
# 2021-2022 Matthias Koeppe
|
10
|
+
# 2021 Kwankyu Lee
|
11
|
+
# 2022 Sébastien Labbé
|
12
|
+
#
|
13
|
+
# Distributed under the terms of the GNU General Public License (GPL)
|
14
|
+
# as published by the Free Software Foundation; either version 2 of
|
15
|
+
# the License, or (at your option) any later version.
|
16
|
+
# https://www.gnu.org/licenses/
|
17
|
+
# *****************************************************************************
|
18
|
+
|
19
|
+
import subprocess
|
20
|
+
|
21
|
+
from . import Executable, FeatureTestResult
|
22
|
+
from .join_feature import JoinFeature
|
23
|
+
|
24
|
+
|
25
|
+
class Lrs(Executable):
|
26
|
+
r"""
|
27
|
+
A :class:`~sage.features.Feature` describing the presence of the ``lrs``
|
28
|
+
binary which comes as a part of ``lrslib``.
|
29
|
+
|
30
|
+
EXAMPLES::
|
31
|
+
|
32
|
+
sage: from sage.features.lrs import Lrs
|
33
|
+
sage: Lrs().is_present() # optional - lrslib
|
34
|
+
FeatureTestResult('lrs', True)
|
35
|
+
"""
|
36
|
+
def __init__(self):
|
37
|
+
r"""
|
38
|
+
TESTS::
|
39
|
+
|
40
|
+
sage: from sage.features.lrs import Lrs
|
41
|
+
sage: isinstance(Lrs(), Lrs)
|
42
|
+
True
|
43
|
+
"""
|
44
|
+
Executable.__init__(self, "lrs", executable='lrs', spkg='lrslib',
|
45
|
+
url='http://cgm.cs.mcgill.ca/~avis/C/lrs.html')
|
46
|
+
|
47
|
+
def is_functional(self):
|
48
|
+
r"""
|
49
|
+
Test whether ``lrs`` works on a trivial input.
|
50
|
+
|
51
|
+
EXAMPLES::
|
52
|
+
|
53
|
+
sage: from sage.features.lrs import Lrs
|
54
|
+
sage: Lrs().is_functional() # optional - lrslib
|
55
|
+
FeatureTestResult('lrs', True)
|
56
|
+
"""
|
57
|
+
from sage.misc.temporary_file import tmp_filename
|
58
|
+
|
59
|
+
tf_name = tmp_filename()
|
60
|
+
with open(tf_name, 'w') as tf:
|
61
|
+
tf.write("V-representation\nbegin\n 1 1 rational\n 1 \nend\nvolume")
|
62
|
+
command = [self.absolute_filename(), tf_name]
|
63
|
+
try:
|
64
|
+
result = subprocess.run(command, capture_output=True, text=True)
|
65
|
+
except OSError as e:
|
66
|
+
return FeatureTestResult(self, False, reason='Running command "{}" '
|
67
|
+
'raised an OSError "{}" '.format(' '.join(command), e))
|
68
|
+
|
69
|
+
if result.returncode:
|
70
|
+
return FeatureTestResult(self, False,
|
71
|
+
reason="Call to `{command}` failed with exit code {result.returncode}.".format(command=" ".join(command), result=result))
|
72
|
+
|
73
|
+
expected_list = ["Volume= 1", "Volume=1"]
|
74
|
+
if all(result.stdout.find(expected) == -1 for expected in expected_list):
|
75
|
+
return FeatureTestResult(self, False,
|
76
|
+
reason="Output of `{command}` did not contain the expected result {expected}; output: {result.stdout}".format(
|
77
|
+
command=" ".join(command),
|
78
|
+
expected=" or ".join(expected_list),
|
79
|
+
result=result))
|
80
|
+
|
81
|
+
return FeatureTestResult(self, True)
|
82
|
+
|
83
|
+
|
84
|
+
class LrsNash(Executable):
|
85
|
+
r"""
|
86
|
+
A :class:`~sage.features.Feature` describing the presence of the ``lrsnash``
|
87
|
+
binary which comes as a part of ``lrslib``.
|
88
|
+
|
89
|
+
EXAMPLES::
|
90
|
+
|
91
|
+
sage: from sage.features.lrs import LrsNash
|
92
|
+
sage: LrsNash().is_present() # optional - lrslib
|
93
|
+
FeatureTestResult('lrsnash', True)
|
94
|
+
"""
|
95
|
+
def __init__(self):
|
96
|
+
r"""
|
97
|
+
TESTS::
|
98
|
+
|
99
|
+
sage: from sage.features.lrs import LrsNash
|
100
|
+
sage: isinstance(LrsNash(), LrsNash)
|
101
|
+
True
|
102
|
+
"""
|
103
|
+
Executable.__init__(self, "lrsnash", executable='lrsnash', spkg='lrslib',
|
104
|
+
url='http://cgm.cs.mcgill.ca/~avis/C/lrs.html')
|
105
|
+
|
106
|
+
def is_functional(self):
|
107
|
+
r"""
|
108
|
+
Test whether ``lrsnash`` works on a trivial input.
|
109
|
+
|
110
|
+
EXAMPLES::
|
111
|
+
|
112
|
+
sage: from sage.features.lrs import LrsNash
|
113
|
+
sage: LrsNash().is_functional() # optional - lrslib
|
114
|
+
FeatureTestResult('lrsnash', True)
|
115
|
+
"""
|
116
|
+
from sage.misc.temporary_file import tmp_filename
|
117
|
+
|
118
|
+
# Checking whether `lrsnash` can handle the new input format
|
119
|
+
# This test is currently done in build/pkgs/lrslib/spkg-configure.m4
|
120
|
+
tf_name = tmp_filename()
|
121
|
+
with open(tf_name, 'w') as tf:
|
122
|
+
tf.write("1 1\n \n 0\n \n 0\n")
|
123
|
+
command = [self.absolute_filename(), tf_name]
|
124
|
+
try:
|
125
|
+
result = subprocess.run(command, capture_output=True, text=True)
|
126
|
+
except OSError as e:
|
127
|
+
return FeatureTestResult(self, False, reason='Running command "{}" '
|
128
|
+
'raised an OSError "{}" '.format(' '.join(command), e))
|
129
|
+
if result.returncode:
|
130
|
+
return FeatureTestResult(self, False, reason='Running command "{}" '
|
131
|
+
'returned nonzero exit status "{}" with stderr '
|
132
|
+
'"{}" and stdout "{}".'.format(' '.join(result.args),
|
133
|
+
result.returncode,
|
134
|
+
result.stderr.strip(),
|
135
|
+
result.stdout.strip()))
|
136
|
+
|
137
|
+
return FeatureTestResult(self, True)
|
138
|
+
|
139
|
+
|
140
|
+
class Lrslib(JoinFeature):
|
141
|
+
r"""
|
142
|
+
A :class:`~sage.features.Feature` describing the presence of the executables
|
143
|
+
:class:`lrs <Lrs>` and :class:`lrsnash <LrsNash>` provided by the :ref:`lrslib <spkg_lrslib>` package.
|
144
|
+
|
145
|
+
EXAMPLES::
|
146
|
+
|
147
|
+
sage: from sage.features.lrs import Lrslib
|
148
|
+
sage: Lrslib().is_present() # optional - lrslib
|
149
|
+
FeatureTestResult('lrslib', True)
|
150
|
+
"""
|
151
|
+
def __init__(self):
|
152
|
+
r"""
|
153
|
+
TESTS::
|
154
|
+
|
155
|
+
sage: from sage.features.lrs import Lrslib
|
156
|
+
sage: isinstance(Lrslib(), Lrslib)
|
157
|
+
True
|
158
|
+
"""
|
159
|
+
JoinFeature.__init__(self, "lrslib",
|
160
|
+
(Lrs(), LrsNash()))
|
161
|
+
|
162
|
+
|
163
|
+
def all_features():
|
164
|
+
return [Lrslib()]
|
sage/features/mcqd.py
ADDED
@@ -0,0 +1,45 @@
|
|
1
|
+
# sage_setup: distribution = sagemath-environment
|
2
|
+
r"""
|
3
|
+
Features for testing the presence of ``mcqd``
|
4
|
+
"""
|
5
|
+
|
6
|
+
# *****************************************************************************
|
7
|
+
# Copyright (C) 2021 Matthias Koeppe
|
8
|
+
#
|
9
|
+
# Distributed under the terms of the GNU General Public License (GPL)
|
10
|
+
# as published by the Free Software Foundation; either version 2 of
|
11
|
+
# the License, or (at your option) any later version.
|
12
|
+
# https://www.gnu.org/licenses/
|
13
|
+
# *****************************************************************************
|
14
|
+
|
15
|
+
from . import PythonModule
|
16
|
+
from .join_feature import JoinFeature
|
17
|
+
|
18
|
+
|
19
|
+
class Mcqd(JoinFeature):
|
20
|
+
r"""
|
21
|
+
A :class:`~sage.features.Feature` describing the presence of the :mod:`~sage.graphs.mcqd` module,
|
22
|
+
which is the SageMath interface to the :ref:`mcqd <spkg_mcqd>` library
|
23
|
+
|
24
|
+
EXAMPLES::
|
25
|
+
|
26
|
+
sage: from sage.features.mcqd import Mcqd
|
27
|
+
sage: Mcqd().is_present() # optional - mcqd
|
28
|
+
FeatureTestResult('mcqd', True)
|
29
|
+
"""
|
30
|
+
|
31
|
+
def __init__(self):
|
32
|
+
"""
|
33
|
+
TESTS::
|
34
|
+
|
35
|
+
sage: from sage.features.mcqd import Mcqd
|
36
|
+
sage: isinstance(Mcqd(), Mcqd)
|
37
|
+
True
|
38
|
+
"""
|
39
|
+
JoinFeature.__init__(self, 'mcqd',
|
40
|
+
[PythonModule('sage.graphs.mcqd',
|
41
|
+
spkg='sagemath_mcqd')])
|
42
|
+
|
43
|
+
|
44
|
+
def all_features():
|
45
|
+
return [Mcqd()]
|
sage/features/meataxe.py
ADDED
@@ -0,0 +1,46 @@
|
|
1
|
+
# sage_setup: distribution = sagemath-environment
|
2
|
+
r"""
|
3
|
+
Feature for testing the presence of ``meataxe``
|
4
|
+
"""
|
5
|
+
|
6
|
+
# *****************************************************************************
|
7
|
+
# Copyright (C) 2021 Matthias Koeppe
|
8
|
+
# 2021 Kwankyu Lee
|
9
|
+
#
|
10
|
+
# Distributed under the terms of the GNU General Public License (GPL)
|
11
|
+
# as published by the Free Software Foundation; either version 2 of
|
12
|
+
# the License, or (at your option) any later version.
|
13
|
+
# https://www.gnu.org/licenses/
|
14
|
+
# *****************************************************************************
|
15
|
+
|
16
|
+
|
17
|
+
from . import PythonModule
|
18
|
+
from .join_feature import JoinFeature
|
19
|
+
|
20
|
+
|
21
|
+
class Meataxe(JoinFeature):
|
22
|
+
r"""
|
23
|
+
A :class:`~sage.features.Feature` describing the presence of the Sage modules
|
24
|
+
that depend on the :ref:`meataxe <spkg_meataxe>` library.
|
25
|
+
|
26
|
+
EXAMPLES::
|
27
|
+
|
28
|
+
sage: from sage.features.meataxe import Meataxe
|
29
|
+
sage: Meataxe().is_present() # optional - meataxe
|
30
|
+
FeatureTestResult('meataxe', True)
|
31
|
+
"""
|
32
|
+
def __init__(self):
|
33
|
+
r"""
|
34
|
+
TESTS::
|
35
|
+
|
36
|
+
sage: from sage.features.meataxe import Meataxe
|
37
|
+
sage: isinstance(Meataxe(), Meataxe)
|
38
|
+
True
|
39
|
+
"""
|
40
|
+
JoinFeature.__init__(self, 'meataxe',
|
41
|
+
[PythonModule('sage.matrix.matrix_gfpn_dense',
|
42
|
+
spkg='sagemath_meataxe')])
|
43
|
+
|
44
|
+
|
45
|
+
def all_features():
|
46
|
+
return [Meataxe()]
|