6
6
import subprocess
7
7
8
8
from . import Executable , FeatureTestResult
9
+ from .join_feature import JoinFeature
9
10
10
11
11
12
class Lrs (Executable ):
@@ -17,7 +18,7 @@ class Lrs(Executable):
17
18
18
19
sage: from sage.features.lrs import Lrs
19
20
sage: Lrs().is_present() # optional - lrslib
20
- FeatureTestResult('lrslib ', True)
21
+ FeatureTestResult('lrs ', True)
21
22
"""
22
23
def __init__ (self ):
23
24
r"""
@@ -27,7 +28,7 @@ def __init__(self):
27
28
sage: isinstance(Lrs(), Lrs)
28
29
True
29
30
"""
30
- Executable .__init__ (self , "lrslib " , executable = "lrs" , spkg = "lrslib" ,
31
+ Executable .__init__ (self , "lrs " , executable = "lrs" , spkg = "lrslib" ,
31
32
url = "http://cgm.cs.mcgill.ca/~avis/C/lrs.html" )
32
33
33
34
def is_functional (self ):
@@ -38,15 +39,14 @@ def is_functional(self):
38
39
39
40
sage: from sage.features.lrs import Lrs
40
41
sage: Lrs().is_functional() # optional - lrslib
41
- FeatureTestResult('lrslib ', True)
42
+ FeatureTestResult('lrs ', True)
42
43
"""
43
44
from sage .misc .temporary_file import tmp_filename
44
45
45
- # Check #1
46
46
tf_name = tmp_filename ()
47
47
with open (tf_name , 'w' ) as tf :
48
48
tf .write ("V-representation\n begin\n 1 1 rational\n 1 \n end\n volume" )
49
- command = ['lrs' , tf_name ]
49
+ command = [self . absolute_filename () , tf_name ]
50
50
try :
51
51
result = subprocess .run (command , capture_output = True , text = True )
52
52
except OSError as e :
@@ -65,13 +65,49 @@ def is_functional(self):
65
65
expected = " or " .join (expected_list ),
66
66
result = result ))
67
67
68
- # Check #2
68
+ return FeatureTestResult (self , True )
69
+
70
+
71
+ class LrsNash (Executable ):
72
+ r"""
73
+ A :class:`~sage.features.Feature` describing the presence of the ``lrsnash``
74
+ binary which comes as a part of ``lrslib``.
75
+
76
+ EXAMPLES::
77
+
78
+ sage: from sage.features.lrs import LrsNash
79
+ sage: LrsNash().is_present() # optional - lrslib
80
+ FeatureTestResult('lrsnash', True)
81
+ """
82
+ def __init__ (self ):
83
+ r"""
84
+ TESTS::
85
+
86
+ sage: from sage.features.lrs import LrsNash
87
+ sage: isinstance(LrsNash(), LrsNash)
88
+ True
89
+ """
90
+ Executable .__init__ (self , "lrsnash" , executable = "lrsnash" , spkg = "lrslib" ,
91
+ url = "http://cgm.cs.mcgill.ca/~avis/C/lrs.html" )
92
+
93
+ def is_functional (self ):
94
+ r"""
95
+ Test whether ``lrsnash`` works on a trivial input.
96
+
97
+ EXAMPLES::
98
+
99
+ sage: from sage.features.lrs import LrsNash
100
+ sage: LrsNash().is_functional() # optional - lrslib
101
+ FeatureTestResult('lrsnash', True)
102
+ """
103
+ from sage .misc .temporary_file import tmp_filename
104
+
69
105
# Checking whether `lrsnash` can handle the new input format
70
106
# This test is currently done in build/pkgs/lrslib/spkg-configure.m4
71
107
tf_name = tmp_filename ()
72
108
with open (tf_name , 'w' ) as tf :
73
109
tf .write ("1 1\n \n 0\n \n 0\n " )
74
- command = ['lrsnash' , tf_name ]
110
+ command = [self . absolute_filename () , tf_name ]
75
111
try :
76
112
result = subprocess .run (command , capture_output = True , text = True )
77
113
except OSError as e :
@@ -88,5 +124,28 @@ def is_functional(self):
88
124
return FeatureTestResult (self , True )
89
125
90
126
127
+ class Lrslib (JoinFeature ):
128
+ r"""
129
+ A :class:`~sage.features.Feature` describing the presence of the executables
130
+ which comes as a part of ``lrslib``.
131
+
132
+ EXAMPLES::
133
+
134
+ sage: from sage.features.lrs import Lrslib
135
+ sage: Lrslib().is_present() # optional - lrslib
136
+ FeatureTestResult('lrslib', True)
137
+ """
138
+ def __init__ (self ):
139
+ r"""
140
+ TESTS::
141
+
142
+ sage: from sage.features.lrs import Lrslib
143
+ sage: isinstance(Lrslib(), Lrslib)
144
+ True
145
+ """
146
+ JoinFeature .__init__ (self , "lrslib" ,
147
+ (Lrs (), LrsNash ()))
148
+
149
+
91
150
def all_features ():
92
- return [Lrs ()]
151
+ return [Lrslib ()]
0 commit comments