-
-
Notifications
You must be signed in to change notification settings - Fork 491
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Trac #33465: sage.graphs: Use Executable.absolute_filename()
This is so that the Sage library becomes fully functional even when not being run from within sage-env (which sets PATH). We add `sage.features.nauty` to provide features for nauty executables. To test: {{{ $ venv/bin/python3 -c 'from sage.all import graphs; print(len(list(graphs.fullerenes(60))))' }}} URL: https://trac.sagemath.org/33465 Reported by: mkoeppe Ticket author(s): Matthias Koeppe Reviewer(s): David Coudert
- Loading branch information
Showing
4 changed files
with
90 additions
and
12 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,59 @@ | ||
r""" | ||
Features for testing the presence of nauty executables | ||
""" | ||
|
||
from sage.env import SAGE_NAUTY_BINS_PREFIX | ||
|
||
from . import Executable | ||
from .join_feature import JoinFeature | ||
|
||
|
||
class NautyExecutable(Executable): | ||
r""" | ||
A :class:`~sage.features.Feature` which checks for nauty executables. | ||
EXAMPLES:: | ||
sage: from sage.features.nauty import NautyExecutable | ||
sage: NautyExecutable('converseg').is_present() # optional - nauty | ||
FeatureTestResult('nauty_converseg', True) | ||
""" | ||
def __init__(self, name): | ||
r""" | ||
TESTS:: | ||
sage: from sage.features.nauty import NautyExecutable | ||
sage: isinstance(NautyExecutable('geng'), NautyExecutable) | ||
True | ||
""" | ||
Executable.__init__(self, name=f"nauty_{name}", | ||
executable=f"{SAGE_NAUTY_BINS_PREFIX}{name}", | ||
spkg="nauty") | ||
|
||
|
||
class Nauty(JoinFeature): | ||
r""" | ||
A :class:`~sage.features.Feature` describing the presence of the executables | ||
which comes as a part of ``nauty``. | ||
EXAMPLES:: | ||
sage: from sage.features.nauty import Nauty | ||
sage: Nauty().is_present() # optional - nauty | ||
FeatureTestResult('nauty', True) | ||
""" | ||
def __init__(self): | ||
r""" | ||
TESTS:: | ||
sage: from sage.features.nauty import Nauty | ||
sage: isinstance(Nauty(), Nauty) | ||
True | ||
""" | ||
JoinFeature.__init__(self, "nauty", | ||
[NautyExecutable(name) | ||
for name in ('directg', 'gentourng', 'geng', 'genbg', 'converseg')]) | ||
|
||
|
||
def all_features(): | ||
return [Nauty()] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters