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.
Files changed (70) hide show
  1. passagemath_environment-10.4.1.data/scripts/sage +1140 -0
  2. passagemath_environment-10.4.1.data/scripts/sage-env +667 -0
  3. passagemath_environment-10.4.1.data/scripts/sage-num-threads.py +105 -0
  4. passagemath_environment-10.4.1.data/scripts/sage-python +2 -0
  5. passagemath_environment-10.4.1.data/scripts/sage-venv-config +42 -0
  6. passagemath_environment-10.4.1.data/scripts/sage-version.sh +9 -0
  7. passagemath_environment-10.4.1.dist-info/METADATA +76 -0
  8. passagemath_environment-10.4.1.dist-info/RECORD +70 -0
  9. passagemath_environment-10.4.1.dist-info/WHEEL +5 -0
  10. passagemath_environment-10.4.1.dist-info/top_level.txt +1 -0
  11. sage/all__sagemath_environment.py +4 -0
  12. sage/env.py +496 -0
  13. sage/features/__init__.py +981 -0
  14. sage/features/all.py +126 -0
  15. sage/features/bliss.py +85 -0
  16. sage/features/cddlib.py +38 -0
  17. sage/features/coxeter3.py +45 -0
  18. sage/features/csdp.py +83 -0
  19. sage/features/cython.py +38 -0
  20. sage/features/databases.py +302 -0
  21. sage/features/dvipng.py +40 -0
  22. sage/features/ecm.py +42 -0
  23. sage/features/ffmpeg.py +119 -0
  24. sage/features/four_ti_2.py +55 -0
  25. sage/features/fricas.py +66 -0
  26. sage/features/gap.py +86 -0
  27. sage/features/gfan.py +38 -0
  28. sage/features/giac.py +30 -0
  29. sage/features/graph_generators.py +171 -0
  30. sage/features/graphviz.py +117 -0
  31. sage/features/igraph.py +44 -0
  32. sage/features/imagemagick.py +138 -0
  33. sage/features/interfaces.py +256 -0
  34. sage/features/internet.py +65 -0
  35. sage/features/jmol.py +44 -0
  36. sage/features/join_feature.py +146 -0
  37. sage/features/kenzo.py +77 -0
  38. sage/features/latex.py +300 -0
  39. sage/features/latte.py +85 -0
  40. sage/features/lrs.py +164 -0
  41. sage/features/mcqd.py +45 -0
  42. sage/features/meataxe.py +46 -0
  43. sage/features/mip_backends.py +114 -0
  44. sage/features/msolve.py +68 -0
  45. sage/features/nauty.py +70 -0
  46. sage/features/normaliz.py +43 -0
  47. sage/features/palp.py +65 -0
  48. sage/features/pandoc.py +42 -0
  49. sage/features/pdf2svg.py +41 -0
  50. sage/features/phitigra.py +42 -0
  51. sage/features/pkg_systems.py +195 -0
  52. sage/features/polymake.py +43 -0
  53. sage/features/poppler.py +58 -0
  54. sage/features/rubiks.py +180 -0
  55. sage/features/sagemath.py +1205 -0
  56. sage/features/sat.py +103 -0
  57. sage/features/singular.py +48 -0
  58. sage/features/sirocco.py +45 -0
  59. sage/features/sphinx.py +71 -0
  60. sage/features/standard.py +38 -0
  61. sage/features/symengine_py.py +44 -0
  62. sage/features/tdlib.py +38 -0
  63. sage/features/threejs.py +75 -0
  64. sage/features/topcom.py +67 -0
  65. sage/misc/all__sagemath_environment.py +2 -0
  66. sage/misc/package.py +570 -0
  67. sage/misc/package_dir.py +621 -0
  68. sage/misc/temporary_file.py +546 -0
  69. sage/misc/viewer.py +369 -0
  70. sage/version.py +5 -0
@@ -0,0 +1,302 @@
1
+ # sage_setup: distribution = sagemath-environment
2
+ r"""
3
+ Features for testing the presence of various databases
4
+ """
5
+
6
+ # *****************************************************************************
7
+ # Copyright (C) 2016 Julian Rüth
8
+ # 2018-2019 Jeroen Demeyer
9
+ # 2018 Timo Kaufmann
10
+ # 2020-2022 Matthias Koeppe
11
+ # 2020-2022 Sebastian Oehms
12
+ # 2021 Kwankyu Lee
13
+ #
14
+ # Distributed under the terms of the GNU General Public License (GPL)
15
+ # as published by the Free Software Foundation; either version 2 of
16
+ # the License, or (at your option) any later version.
17
+ # https://www.gnu.org/licenses/
18
+ # *****************************************************************************
19
+
20
+ import os
21
+
22
+ from . import StaticFile, PythonModule
23
+ from sage.env import SAGE_DATA_PATH
24
+
25
+
26
+ def sage_data_path(data_name):
27
+ r"""
28
+ Search path for database `data_name`.
29
+
30
+ EXAMPLES::
31
+
32
+ sage: from sage.features.databases import sage_data_path
33
+ sage: sage_data_path("cremona")
34
+ ['.../cremona']
35
+ """
36
+ if not SAGE_DATA_PATH:
37
+ return []
38
+
39
+ return [os.path.join(p, data_name)
40
+ for p in SAGE_DATA_PATH.split(os.pathsep)]
41
+
42
+
43
+ class DatabaseCremona(StaticFile):
44
+ r"""
45
+ A :class:`~sage.features.Feature` which describes the presence of :ref:`John Cremona's
46
+ database of elliptic curves <spkg_database_cremona_ellcurve>`.
47
+
48
+ INPUT:
49
+
50
+ - ``name`` -- either ``'cremona'`` (the default) for the full large
51
+ database or ``'cremona_mini'`` for the small database
52
+
53
+ EXAMPLES::
54
+
55
+ sage: from sage.features.databases import DatabaseCremona
56
+ sage: DatabaseCremona('cremona_mini', type='standard').is_present()
57
+ FeatureTestResult('database_cremona_mini_ellcurve', True)
58
+ sage: DatabaseCremona().is_present() # optional - database_cremona_ellcurve
59
+ FeatureTestResult('database_cremona_ellcurve', True)
60
+ """
61
+ def __init__(self, name='cremona', spkg='database_cremona_ellcurve', type='optional'):
62
+ r"""
63
+ TESTS::
64
+
65
+ sage: from sage.features.databases import DatabaseCremona
66
+ sage: isinstance(DatabaseCremona(), DatabaseCremona)
67
+ True
68
+ """
69
+ from sage.env import CREMONA_MINI_DATA_DIR, CREMONA_LARGE_DATA_DIR
70
+ CREMONA_DATA_DIRS = set([CREMONA_MINI_DATA_DIR, CREMONA_LARGE_DATA_DIR])
71
+ CREMONA_DATA_DIRS.discard(None)
72
+ search_path = CREMONA_DATA_DIRS or sage_data_path("cremona")
73
+
74
+ spkg = "database_cremona_ellcurve"
75
+ spkg_type = "optional"
76
+ if name == 'cremona_mini':
77
+ spkg = "elliptic_curves"
78
+ spkg_type = "standard"
79
+
80
+ StaticFile.__init__(self, f"database_{name}_ellcurve",
81
+ filename=f"{name}.db",
82
+ search_path=search_path,
83
+ spkg=spkg,
84
+ type=spkg_type,
85
+ url='https://github.com/JohnCremona/ecdata',
86
+ description="Cremona's database of elliptic curves")
87
+
88
+
89
+ class DatabaseEllcurves(StaticFile):
90
+ r"""
91
+ A :class:`~sage.features.Feature` which describes the presence of
92
+ William Stein's database of interesting curves.
93
+
94
+ EXAMPLES::
95
+
96
+ sage: from sage.features.databases import DatabaseEllcurves
97
+ sage: bool(DatabaseEllcurves().is_present()) # optional - database_ellcurves
98
+ True
99
+ """
100
+ def __init__(self):
101
+ r"""
102
+ TESTS::
103
+
104
+ sage: from sage.features.databases import DatabaseEllcurves
105
+ sage: isinstance(DatabaseEllcurves(), DatabaseEllcurves)
106
+ True
107
+ """
108
+ from sage.env import ELLCURVE_DATA_DIR
109
+ search_path = ELLCURVE_DATA_DIR or sage_data_path("ellcurves")
110
+
111
+ StaticFile.__init__(self, "database_ellcurves",
112
+ filename='rank0',
113
+ search_path=search_path,
114
+ spkg='elliptic_curves',
115
+ type='standard',
116
+ description="William Stein's database of interesting curve")
117
+
118
+
119
+ class DatabaseGraphs(StaticFile):
120
+ r"""
121
+ A :class:`~sage.features.Feature` which describes the presence of
122
+ the graphs database.
123
+
124
+ EXAMPLES::
125
+
126
+ sage: from sage.features.databases import DatabaseGraphs
127
+ sage: bool(DatabaseGraphs().is_present()) # optional - database_graphs
128
+ True
129
+ """
130
+ def __init__(self):
131
+ r"""
132
+ TESTS::
133
+
134
+ sage: from sage.features.databases import DatabaseGraphs
135
+ sage: isinstance(DatabaseGraphs(), DatabaseGraphs)
136
+ True
137
+ """
138
+ from sage.env import GRAPHS_DATA_DIR
139
+ search_path = GRAPHS_DATA_DIR or sage_data_path("graphs")
140
+
141
+ StaticFile.__init__(self, "database_graphs",
142
+ filename='graphs.db',
143
+ search_path=search_path,
144
+ spkg='graphs',
145
+ type='standard',
146
+ description="A database of graphs")
147
+
148
+
149
+ class DatabaseJones(StaticFile):
150
+ r"""
151
+ A :class:`~sage.features.Feature` which describes the presence of
152
+ :ref:`John Jones's tables of number fields <spkg_database_jones_numfield>`.
153
+
154
+ EXAMPLES::
155
+
156
+ sage: from sage.features.databases import DatabaseJones
157
+ sage: bool(DatabaseJones().is_present()) # optional - database_jones_numfield
158
+ True
159
+ """
160
+ def __init__(self):
161
+ r"""
162
+ TESTS::
163
+
164
+ sage: from sage.features.databases import DatabaseJones
165
+ sage: isinstance(DatabaseJones(), DatabaseJones)
166
+ True
167
+ """
168
+ StaticFile.__init__(self, "database_jones_numfield",
169
+ filename='jones.sobj',
170
+ search_path=sage_data_path("jones"),
171
+ spkg='database_jones_numfield',
172
+ description="John Jones's tables of number fields")
173
+
174
+
175
+ class DatabaseKnotInfo(PythonModule):
176
+ r"""
177
+ A :class:`~sage.features.Feature` which describes the presence of the
178
+ :ref:`package providing the KnotInfo and LinkInfo databases <spkg_database_knotinfo>`.
179
+
180
+ The homes of these databases are the
181
+ web-pages `KnotInfo <https://knotinfo.math.indiana.edu/>`__ and
182
+ `LinkInfo <https://linkinfo.sitehost.iu.edu>`__.
183
+
184
+ EXAMPLES::
185
+
186
+ sage: from sage.features.databases import DatabaseKnotInfo
187
+ sage: DatabaseKnotInfo().is_present() # optional - database_knotinfo
188
+ FeatureTestResult('database_knotinfo', True)
189
+ """
190
+ def __init__(self):
191
+ r"""
192
+ TESTS::
193
+
194
+ sage: from sage.features.databases import DatabaseKnotInfo
195
+ sage: isinstance(DatabaseKnotInfo(), DatabaseKnotInfo)
196
+ True
197
+ """
198
+ PythonModule.__init__(self, 'database_knotinfo', spkg='database_knotinfo')
199
+
200
+
201
+ class DatabaseMatroids(PythonModule):
202
+ r"""
203
+ A :class:`~sage.features.Feature` which describes the presence of
204
+ :ref:`Yoshitake Matsumoto's Database of Matroids <spkg_matroid_database>`.
205
+
206
+ EXAMPLES::
207
+
208
+ sage: from sage.features.databases import DatabaseMatroids
209
+ sage: DatabaseMatroids().is_present() # optional - matroid_database
210
+ FeatureTestResult('matroid_database', True)
211
+
212
+ REFERENCES:
213
+
214
+ [Mat2012]_
215
+ """
216
+ def __init__(self):
217
+ r"""
218
+ TESTS::
219
+
220
+ sage: from sage.features.databases import DatabaseMatroids
221
+ sage: isinstance(DatabaseMatroids(), DatabaseMatroids)
222
+ True
223
+ """
224
+ PythonModule.__init__(self, 'matroid_database', spkg='matroid_database')
225
+
226
+
227
+ class DatabaseCubicHecke(PythonModule):
228
+ r"""
229
+ A :class:`~sage.features.Feature` which describes the presence of the
230
+ :ref:`Cubic Hecke algebra database package <spkg_database_cubic_hecke>`.
231
+
232
+ The home of this database is the
233
+ web-page `Cubic Hecke algebra on 4 strands <http://www.lamfa.u-picardie.fr/marin/representationH4-en.html>`__
234
+ of Ivan Marin.
235
+
236
+ EXAMPLES::
237
+
238
+ sage: from sage.features.databases import DatabaseCubicHecke
239
+ sage: DatabaseCubicHecke().is_present() # optional - database_cubic_hecke
240
+ FeatureTestResult('database_cubic_hecke', True)
241
+ """
242
+ def __init__(self):
243
+ r"""
244
+ TESTS::
245
+
246
+ sage: from sage.features.databases import DatabaseCubicHecke
247
+ sage: isinstance(DatabaseCubicHecke(), DatabaseCubicHecke)
248
+ True
249
+ """
250
+ PythonModule.__init__(self, 'database_cubic_hecke', spkg='database_cubic_hecke')
251
+
252
+
253
+ class DatabaseReflexivePolytopes(StaticFile):
254
+ r"""
255
+ A :class:`~sage.features.Feature` which describes the presence of the
256
+ :ref:`PALP databases of reflexive three-dimensional <spkg_polytopes_db>`
257
+ and :ref:`four-dimensional lattice polytopes <spkg_polytopes_db_4d>`.
258
+
259
+ EXAMPLES::
260
+
261
+ sage: from sage.features.databases import DatabaseReflexivePolytopes
262
+ sage: bool(DatabaseReflexivePolytopes().is_present()) # optional - polytopes_db
263
+ True
264
+ sage: bool(DatabaseReflexivePolytopes('polytopes_db_4d').is_present()) # optional - polytopes_db_4d
265
+ True
266
+ """
267
+ def __init__(self, name='polytopes_db'):
268
+ """
269
+ TESTS::
270
+
271
+ sage: from sage.features.databases import DatabaseReflexivePolytopes
272
+ sage: isinstance(DatabaseReflexivePolytopes(), DatabaseReflexivePolytopes)
273
+ True
274
+ sage: DatabaseReflexivePolytopes().filename
275
+ 'Full3d'
276
+ sage: DatabaseReflexivePolytopes('polytopes_db_4d').filename
277
+ 'Hodge4d'
278
+ """
279
+ from sage.env import POLYTOPE_DATA_DIR
280
+ search_path = POLYTOPE_DATA_DIR or sage_data_path("reflexive_polytopes")
281
+
282
+ dirname = "Full3d"
283
+ if name == "polytopes_db_4d":
284
+ dirname = "Hodge4d"
285
+
286
+ StaticFile.__init__(self, name,
287
+ filename=dirname,
288
+ search_path=search_path)
289
+
290
+
291
+ def all_features():
292
+ return [PythonModule('conway_polynomials', spkg='conway_polynomials', type='standard'),
293
+ DatabaseCremona(),
294
+ DatabaseCremona('cremona_mini', type='standard'),
295
+ DatabaseEllcurves(),
296
+ DatabaseGraphs(),
297
+ DatabaseJones(),
298
+ DatabaseKnotInfo(),
299
+ DatabaseMatroids(),
300
+ DatabaseCubicHecke(),
301
+ DatabaseReflexivePolytopes(),
302
+ DatabaseReflexivePolytopes('polytopes_db_4d')]
@@ -0,0 +1,40 @@
1
+ # sage_setup: distribution = sagemath-environment
2
+ r"""
3
+ Feature for testing the presence of ``dvipng``
4
+ """
5
+ # ****************************************************************************
6
+ # Copyright (C) 2021 Sebastien Labbe <slabqc@gmail.com>
7
+ #
8
+ # This program is free software: you can redistribute it and/or modify
9
+ # it under the terms of the GNU General Public License as published by
10
+ # the Free Software Foundation, either version 2 of the License, or
11
+ # (at your option) any later version.
12
+ # https://www.gnu.org/licenses/
13
+ # ****************************************************************************
14
+
15
+ from . import Executable
16
+
17
+ class dvipng(Executable):
18
+ r"""
19
+ A :class:`~sage.features.Feature` describing the presence of ``dvipng``.
20
+
21
+ EXAMPLES::
22
+
23
+ sage: from sage.features.dvipng import dvipng
24
+ sage: dvipng().is_present() # optional - dvipng
25
+ FeatureTestResult('dvipng', True)
26
+ """
27
+ def __init__(self):
28
+ r"""
29
+ TESTS::
30
+
31
+ sage: from sage.features.dvipng import dvipng
32
+ sage: isinstance(dvipng(), dvipng)
33
+ True
34
+ """
35
+ Executable.__init__(self, 'dvipng', executable='dvipng',
36
+ url='https://savannah.nongnu.org/projects/dvipng/')
37
+
38
+
39
+ def all_features():
40
+ return [dvipng()]
sage/features/ecm.py ADDED
@@ -0,0 +1,42 @@
1
+ # sage_setup: distribution = sagemath-environment
2
+ r"""
3
+ Feature for testing the presence of ``ecm`` or ``gmp-ecm``
4
+ """
5
+ # ****************************************************************************
6
+ # Copyright (C) 2032 Dima Pasechnik <dima@pasechnik.info>
7
+ #
8
+ # This program is free software: you can redistribute it and/or modify
9
+ # it under the terms of the GNU General Public License as published by
10
+ # the Free Software Foundation, either version 2 of the License, or
11
+ # (at your option) any later version.
12
+ # https://www.gnu.org/licenses/
13
+ # ****************************************************************************
14
+
15
+ from . import Executable
16
+ from sage.env import SAGE_ECMBIN
17
+
18
+
19
+ class Ecm(Executable):
20
+ r"""
21
+ A :class:`~sage.features.Feature` describing the presence of :ref:`GMP-ECM <spkg_ecm>`.
22
+
23
+ EXAMPLES::
24
+
25
+ sage: from sage.features.ecm import Ecm
26
+ sage: Ecm().is_present()
27
+ FeatureTestResult('ecm', True)
28
+ """
29
+ def __init__(self):
30
+ r"""
31
+ TESTS::
32
+
33
+ sage: from sage.features.ecm import Ecm
34
+ sage: isinstance(Ecm(), Ecm)
35
+ True
36
+ """
37
+ Executable.__init__(self, name='ecm', executable=SAGE_ECMBIN,
38
+ spkg='ecm', type='standard')
39
+
40
+
41
+ def all_features():
42
+ return [Ecm()]
@@ -0,0 +1,119 @@
1
+ # sage_setup: distribution = sagemath-environment
2
+ r"""
3
+ Feature for testing the presence of ``ffmpeg``
4
+ """
5
+ # ****************************************************************************
6
+ # Copyright (C) 2018-2022 Sebastien Labbe <slabqc@gmail.com>
7
+ #
8
+ # This program is free software: you can redistribute it and/or modify
9
+ # it under the terms of the GNU General Public License as published by
10
+ # the Free Software Foundation, either version 2 of the License, or
11
+ # (at your option) any later version.
12
+ # https://www.gnu.org/licenses/
13
+ # ****************************************************************************
14
+
15
+ from . import Executable, FeatureTestResult
16
+
17
+ class FFmpeg(Executable):
18
+ r"""
19
+ A :class:`~sage.features.Feature` describing the presence of :ref:`ffmpeg <spkg_ffmpeg>`.
20
+
21
+ EXAMPLES::
22
+
23
+ sage: from sage.features.ffmpeg import FFmpeg
24
+ sage: FFmpeg().is_present() # optional - ffmpeg
25
+ FeatureTestResult('ffmpeg', True)
26
+ """
27
+ def __init__(self):
28
+ r"""
29
+ TESTS::
30
+
31
+ sage: from sage.features.ffmpeg import FFmpeg
32
+ sage: isinstance(FFmpeg(), FFmpeg)
33
+ True
34
+ """
35
+ Executable.__init__(self, 'ffmpeg', executable='ffmpeg',
36
+ spkg='ffmpeg',
37
+ url='https://www.ffmpeg.org/')
38
+
39
+ def is_functional(self):
40
+ r"""
41
+ Return whether command ``ffmpeg`` in the path is functional.
42
+
43
+ EXAMPLES::
44
+
45
+ sage: from sage.features.ffmpeg import FFmpeg
46
+ sage: FFmpeg().is_functional() # optional - ffmpeg
47
+ FeatureTestResult('ffmpeg', True)
48
+ """
49
+ # Create the content of 1-pixel png file
50
+ content = b'\x89PNG\r\n\x1a\n\x00\x00\x00\rIHDR\x00\x00\x00\x01\x00\x00\x00\x01\x08\x00\x00\x00\x00:~\x9bU\x00\x00\x00\nIDATx\x9cc`\x00\x00\x00\x02\x00\x01H\xaf\xa4q\x00\x00\x00\x00IEND\xaeB`\x82'
51
+
52
+ # NOTE:
53
+ #
54
+ # This is how the above content of a 1 pixel PNG was created::
55
+ #
56
+ # sage: import numpy as np
57
+ # sage: from PIL import Image
58
+ # sage: image = Image.fromarray(np.array([[100]], dtype=np.uint8))
59
+ # sage: image.save('file.png')
60
+ # sage: with open('file.png', 'rb') as f:
61
+ # ....: content = f.read()
62
+
63
+ # create a png file with the content
64
+ from sage.misc.temporary_file import tmp_filename
65
+ base_filename_png = tmp_filename(ext='.png')
66
+ with open(base_filename_png, 'wb') as f:
67
+ f.write(content)
68
+
69
+ # Set up filenames
70
+ import os
71
+ base, filename_png = os.path.split(base_filename_png)
72
+ filename, _png = os.path.splitext(filename_png)
73
+
74
+ # Setting a list of commands (taken from sage/plot/animate.py)
75
+ # The `-nostdin` is needed to avoid the command to hang, see
76
+ # https://stackoverflow.com/questions/16523746/ffmpeg-hangs-when-run-in-background
77
+ commands = []
78
+ for ext in ['.avi', '.flv', '.gif', '.mkv', '.mov', #'.mpg',
79
+ '.mp4', '.ogg', '.ogv', '.webm', '.wmv']:
80
+
81
+ cmd = ['ffmpeg', '-nostdin', '-y', '-f', 'image2', '-r', '5',
82
+ '-i', filename_png, '-pix_fmt', 'rgb24', '-loop', '0',
83
+ filename + ext]
84
+ commands.append(cmd)
85
+
86
+ for ext in ['.avi', '.flv', '.gif', '.mkv', '.mov', '.mpg',
87
+ '.mp4', '.ogg', '.ogv', '.webm', '.wmv']:
88
+
89
+ cmd = ['ffmpeg', '-nostdin', '-y', '-f', 'image2', '-i',
90
+ filename_png, filename + ext]
91
+ commands.append(cmd)
92
+
93
+ # Running the commands and reporting any issue encountered
94
+ from subprocess import run
95
+ for cmd in commands:
96
+ try:
97
+ result = run(cmd, cwd=base, capture_output=True, text=True)
98
+ except OSError as e:
99
+ return FeatureTestResult(self, False, reason='Running command "{}" '
100
+ 'raised an OSError "{}" '.format(' '.join(cmd), e))
101
+
102
+ # If an error occurred, return False
103
+ if result.returncode:
104
+ return FeatureTestResult(self, False, reason='Running command "{}" '
105
+ 'returned nonzero exit status "{}" with stderr '
106
+ '"{}" and stdout "{}".'.format(result.args,
107
+ result.returncode,
108
+ result.stderr.strip(),
109
+ result.stdout.strip()))
110
+
111
+ # If necessary, run more tests here
112
+ # ...
113
+
114
+ # The command seems functional
115
+ return FeatureTestResult(self, True)
116
+
117
+
118
+ def all_features():
119
+ return [FFmpeg()]
@@ -0,0 +1,55 @@
1
+ # sage_setup: distribution = sagemath-environment
2
+ r"""
3
+ Features for testing the presence of ``4ti2``
4
+ """
5
+
6
+ from . import Executable
7
+ from .join_feature import JoinFeature
8
+
9
+
10
+ class FourTi2Executable(Executable):
11
+ r"""
12
+ A :class:`~sage.features.Feature` for the :ref:`4ti2 <spkg_4ti2>` executables.
13
+ """
14
+ def __init__(self, name):
15
+ r"""
16
+ TESTS::
17
+
18
+ sage: from sage.features.four_ti_2 import FourTi2Executable
19
+ sage: isinstance(FourTi2Executable('hilbert'), FourTi2Executable)
20
+ True
21
+ """
22
+ from sage.env import SAGE_ENV
23
+ Executable.__init__(self,
24
+ name="4ti2-" + name,
25
+ executable=SAGE_ENV.get("FOURTITWO_" + name.upper(), None) or name,
26
+ spkg='4ti2')
27
+
28
+
29
+ class FourTi2(JoinFeature):
30
+ r"""
31
+ A :class:`~sage.features.Feature` describing the presence of all :ref:`4ti2 <spkg_4ti2>` executables.
32
+
33
+ EXAMPLES::
34
+
35
+ sage: from sage.features.four_ti_2 import FourTi2
36
+ sage: FourTi2().is_present() # optional - 4ti2
37
+ FeatureTestResult('4ti2', True)
38
+ """
39
+ def __init__(self):
40
+ r"""
41
+ TESTS::
42
+
43
+ sage: from sage.features.four_ti_2 import FourTi2
44
+ sage: isinstance(FourTi2(), FourTi2)
45
+ True
46
+ """
47
+ JoinFeature.__init__(self, '4ti2',
48
+ [FourTi2Executable(x)
49
+ # same list is tested in build/pkgs/4ti2/spkg-configure.m4
50
+ for x in ('hilbert', 'markov', 'graver', 'zsolve', 'qsolve',
51
+ 'rays', 'ppi', 'circuits', 'groebner')])
52
+
53
+
54
+ def all_features():
55
+ return [FourTi2()]
@@ -0,0 +1,66 @@
1
+ # sage_setup: distribution = sagemath-environment
2
+ r"""
3
+ Features for testing the presence of ``fricas``
4
+ """
5
+
6
+ # *****************************************************************************
7
+ # Copyright (C) 2023 Dima Pasechnik
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
+ import os
16
+ import subprocess
17
+ from . import Executable, FeatureTestResult
18
+
19
+ class FriCAS(Executable):
20
+ r"""
21
+ A :class:`~sage.features.Feature` which checks for the :ref:`fricas <fricas>` binary.
22
+
23
+ EXAMPLES::
24
+
25
+ sage: from sage.features.fricas import FriCAS
26
+ sage: FriCAS().is_present() # optional - fricas
27
+ FeatureTestResult('fricas', True)
28
+ """
29
+ def __init__(self):
30
+ r"""
31
+ TESTS::
32
+
33
+ sage: from sage.features.fricas import FriCAS
34
+ sage: isinstance(FriCAS(), FriCAS)
35
+ True
36
+ """
37
+ Executable.__init__(self, name='fricas', spkg='fricas',
38
+ executable='fricas',
39
+ url='https://fricas.github.io')
40
+
41
+ def is_functional(self):
42
+ r"""
43
+ Check whether ``fricas`` works on trivial input.
44
+
45
+ EXAMPLES::
46
+
47
+ sage: from sage.features.fricas import FriCAS
48
+ sage: FriCAS().is_functional() # optional - fricas
49
+ FeatureTestResult('fricas', True)
50
+ """
51
+ command = ['fricas -nosman -eval ")quit"']
52
+ try:
53
+ lines = subprocess.check_output(command, stderr=subprocess.STDOUT, shell=True)
54
+ except subprocess.CalledProcessError as e:
55
+ return FeatureTestResult(self, False,
56
+ reason="Call `{command}` failed with exit code {e.returncode}".format(command=" ".join(command), e=e))
57
+
58
+ expected = b"FriCAS"
59
+ if lines.find(expected) == -1:
60
+ return FeatureTestResult(self, False,
61
+ reason="Call `{command}` did not produce output which contains `{expected}`".format(command=" ".join(command), expected=expected))
62
+
63
+ return FeatureTestResult(self, True)
64
+
65
+ def all_features():
66
+ return [FriCAS()]