Skip to content

Commit

Permalink
src/sage/features/: Move features depending on optional packages to s…
Browse files Browse the repository at this point in the history
…eparate files
  • Loading branch information
Matthias Koeppe committed Oct 7, 2021
1 parent 654d09c commit f63a7d0
Show file tree
Hide file tree
Showing 5 changed files with 44 additions and 43 deletions.
14 changes: 9 additions & 5 deletions src/sage/features/bliss.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
Checks for bliss
"""
from . import CythonFeature, PythonModule
from .join_feature import JoinFeature


TEST_CODE = """
Expand Down Expand Up @@ -45,10 +46,10 @@ def __init__(self):
url="http://www.tcs.hut.fi/Software/bliss/")


class Bliss(PythonModule):
class Bliss(JoinFeature):
r"""
A :class:`Feature` which describes whether the :mod:`sage.graphs.bliss`
module has been enabled for this build of Sage and is functional.
module is available in this installation of Sage.
EXAMPLES::
Expand All @@ -61,7 +62,10 @@ def __init__(self):
sage: from sage.features.bliss import Bliss
sage: Bliss()
Feature('sage.graphs.bliss')
Feature('bliss')
"""
PythonModule.__init__(self, "sage.graphs.bliss", spkg="bliss",
url="http://www.tcs.hut.fi/Software/bliss/")
# Currently part of sagemath_standard, conditionally built.
# Will be changed to spkg='sagemath_bliss' later
JoinFeature.__init__(self, "bliss",
[PythonModule("sage.graphs.bliss", spkg="bliss",
url="http://www.tcs.hut.fi/Software/bliss/")])
11 changes: 11 additions & 0 deletions src/sage/features/mcqd.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
from . import PythonModule
from .join_feature import JoinFeature


class Mcqd(JoinFeature):

def __init__(self):
# Currently part of sagemath_standard, conditionally built.
# Will be changed to spkg='sagemath_mcqd' later
JoinFeature.__init__(self, 'mcqd',
[PythonModule('sage.graphs.mcqd', spkg='mcqd')])
11 changes: 11 additions & 0 deletions src/sage/features/meataxe.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
from . import PythonModule
from .join_feature import JoinFeature


class Meataxe(JoinFeature):

def __init__(self):
# Currently part of sagemath_standard, conditionally built.
# Will be changed to spkg='sagemath_meataxe' later
JoinFeature.__init__(self, 'meataxe',
[PythonModule('sage.matrix.matrix_gfpn_dense', spkg='meataxe')])
40 changes: 2 additions & 38 deletions src/sage/features/sagemath.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,38 +22,6 @@ def __init__(self):
[PythonModule('sage.graphs.graph')])


class sage__graphs__bliss(PythonModule):

def __init__(self):
# Currently part of sagemath_standard, conditionally built.
# Will be changed to spkg='sagemath_bliss' later
PythonModule.__init__(self, 'sage.graphs.bliss', spkg='bliss')


class sage__graphs__graph_decompositions__tdlib(PythonModule):

def __init__(self):
# Currently part of sagemath_standard, conditionally built.
# Will be changed to spkg='sagemath_tdlib' later
PythonModule.__init__(self, 'sage.graphs.graph_decompositions.tdlib', spkg='tdlib')


class sage__graphs__mcqd(PythonModule):

def __init__(self):
# Currently part of sagemath_standard, conditionally built.
# Will be changed to spkg='sagemath_mcqd' later
PythonModule.__init__(self, 'sage.graphs.mcqd', spkg='mcqd')


class sage__matrix__matrix_gfpn_dense(PythonModule):

def __init__(self):
# Currently part of sagemath_standard, conditionally built.
# Will be changed to spkg='sagemath_meataxe' later
PythonModule.__init__(self, 'sage.matrix.matrix_gfpn_dense', spkg='meataxe')


class sage__plot(JoinFeature):

def __init__(self):
Expand Down Expand Up @@ -84,7 +52,7 @@ def __init__(self):

def sage_features():
"""
Return tags for conditionalizing doctests.
Return features corresponding to parts of the Sage library.
These tags are named after Python packages/modules (e.g., :mod:`~sage.symbolic`),
not distribution packages (``sagemath-symbolics``).
Expand All @@ -102,16 +70,12 @@ def sage_features():
sage: from sage.features.sagemath import sage_features
sage: list(sage_features()) # random
[Feature('sage.graphs'),
Feature('sage.graphs.bliss'),
Feature('sage.plot'),
Feature('sage.rings.number_field'),
Feature('sage.rings.real_double')]
"""
for feature in [sage__combinat(),
sage__graphs(),
sage__graphs__bliss(),
sage__graphs__graph_decompositions__tdlib(),
sage__graphs__mcqd(),
sage__matrix__matrix_gfpn_dense(),
sage__plot(),
sage__rings__number_field(),
sage__rings__real_double(),
Expand Down
11 changes: 11 additions & 0 deletions src/sage/features/tdlib.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
from . import PythonModule
from .join_feature import JoinFeature


class Tdlib(JoinFeature):

def __init__(self):
# Currently part of sagemath_standard, conditionally built.
# Will be changed to spkg='sagemath_tdlib' later
JoinFeature.__init__(self, 'tdlib',
[PythonModule('sage.graphs.graph_decompositions.tdlib', spkg='tdlib')])

0 comments on commit f63a7d0

Please sign in to comment.