From 9096edb73bfa435e242635b5d5eb01b62aadd21a Mon Sep 17 00:00:00 2001 From: Matthias Koeppe Date: Sat, 2 Oct 2021 16:20:51 -0700 Subject: [PATCH 01/13] sage.features.sagemath: New --- src/sage/features/sagemath.py | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) create mode 100644 src/sage/features/sagemath.py diff --git a/src/sage/features/sagemath.py b/src/sage/features/sagemath.py new file mode 100644 index 00000000000..32c6246b7fd --- /dev/null +++ b/src/sage/features/sagemath.py @@ -0,0 +1,28 @@ +r""" +Check for SageMath Python modules +""" +from . import PythonModule + + +class sage__combinat(PythonModule): + + def __init__(self): + PythonModule.__init__('sage.combinat.combinations') + + +class sage__graphs(PythonModule): + + def __init__(self): + PythonModule.__init__('sage.graphs.graph') + + +class sage__rings__real_double(PythonModule): + + def __init__(self): + PythonModule.__init__('sage.rings.real_double') + + +class sage__symbolic(PythonModule): + + def __init__(self): + PythonModule.__init__('sage.symbolic.expression', spkg="sagemath_symbolics") From 2938e1387d002460ff7fdcc60e250799e47b6b4f Mon Sep 17 00:00:00 2001 From: Matthias Koeppe Date: Sat, 2 Oct 2021 17:05:06 -0700 Subject: [PATCH 02/13] src/sage/doctest/parsing.py: Allow . in optional tags --- src/sage/doctest/parsing.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/sage/doctest/parsing.py b/src/sage/doctest/parsing.py index 0be358f35be..7bceddde322 100644 --- a/src/sage/doctest/parsing.py +++ b/src/sage/doctest/parsing.py @@ -34,7 +34,7 @@ from .external import available_software float_regex = re.compile(r'\s*([+-]?\s*((\d*\.?\d+)|(\d+\.?))([eE][+-]?\d+)?)') -optional_regex = re.compile(r'(arb216|arb218|py2|py3|long time|not implemented|not tested|known bug)|([^ a-z]\s*optional\s*[:-]*((\s|\w)*))') +optional_regex = re.compile(r'(arb216|arb218|py2|py3|long time|not implemented|not tested|known bug)|([^ a-z]\s*optional\s*[:-]*((\s|\w|[.])*))') # Version 4.65 of glpk prints the warning "Long-step dual simplex will # be used" frequently. When Sage uses a system installation of glpk # which has not been patched, we need to ignore that message. @@ -316,6 +316,8 @@ def parse_optional_tags(string): {''} sage: sorted(list(parse_optional_tags("sage: #optional -- foo bar, baz"))) ['bar', 'foo'] + sage: parse_optional_tags("sage: #optional -- foo.bar, baz") + {'foo.bar'} sage: sorted(list(parse_optional_tags(" sage: factor(10^(10^10) + 1) # LoNg TiME, NoT TeSTED; OptioNAL -- P4cka9e"))) ['long time', 'not tested', 'p4cka9e'] sage: parse_optional_tags(" sage: raise RuntimeError # known bug") From 747b458420bffc389fdc1e3a1acec4148e818ba4 Mon Sep 17 00:00:00 2001 From: Matthias Koeppe Date: Sat, 2 Oct 2021 17:05:46 -0700 Subject: [PATCH 03/13] sage.doctest.control, sage.features.sagemath: Provide/use optional tags --- src/sage/doctest/control.py | 3 +++ src/sage/features/sagemath.py | 28 ++++++++++++++++++++++++++++ 2 files changed, 31 insertions(+) diff --git a/src/sage/doctest/control.py b/src/sage/doctest/control.py index afb0d6cbcf1..c7d68478ff7 100644 --- a/src/sage/doctest/control.py +++ b/src/sage/doctest/control.py @@ -53,6 +53,9 @@ except ImportError: pass +from sage.features.sagemath import sage_optional_tags +auto_optional_tags |= sage_optional_tags() + class DocTestDefaults(SageObject): """ This class is used for doctesting the Sage doctest module. diff --git a/src/sage/features/sagemath.py b/src/sage/features/sagemath.py index 32c6246b7fd..c6d253a9c51 100644 --- a/src/sage/features/sagemath.py +++ b/src/sage/features/sagemath.py @@ -7,6 +7,9 @@ class sage__combinat(PythonModule): def __init__(self): + # sage.combinat will be a namespace package. + # Testing whether sage.combinat itself can be imported is meaningless. + # Hence, we test a Python module within the package. PythonModule.__init__('sage.combinat.combinations') @@ -26,3 +29,28 @@ class sage__symbolic(PythonModule): def __init__(self): PythonModule.__init__('sage.symbolic.expression', spkg="sagemath_symbolics") + + +def sage_optional_tags(): + """ + Return tags for conditionalizing doctests. + + These tags are named after Python packages/modules (e.g., :mod:`~sage.symbolic`), + not distribution packages (``sagemath-symbolics``). + + This is motivated by a separation of concerns: The author of a module that depends + on some functionality provided by a Python module usually already knows the + name of the Python module, so we do not want to force the author to also + know about the distribution package that provides the Python module. + + Instead, we associate distribution packages to Python modules in + :mod:`sage.features.sagemath` via the ``spkg`` parameter of :class:`PythonModule``. + """ + if sage__combinat().is_functional(): + yield 'sage.combinat' + if sage__graphs().is_functional(): + yield 'sage.graphs' + if sage__rings__real_double().is_functional(): + yield 'sage.rings.real_double' + if sage__symbolic().is_functional(): + yield 'sage.symbolic' From e3a541e039081242121e247b51c3fc42c963cd43 Mon Sep 17 00:00:00 2001 From: Matthias Koeppe Date: Sat, 2 Oct 2021 17:13:22 -0700 Subject: [PATCH 04/13] Fixup --- src/sage/doctest/control.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/sage/doctest/control.py b/src/sage/doctest/control.py index c7d68478ff7..42ed54ddb49 100644 --- a/src/sage/doctest/control.py +++ b/src/sage/doctest/control.py @@ -54,7 +54,7 @@ pass from sage.features.sagemath import sage_optional_tags -auto_optional_tags |= sage_optional_tags() +auto_optional_tags.update(sage_optional_tags()) class DocTestDefaults(SageObject): """ From 5e04a85c4dbe3663bab664b7356d255b5ddc1cf6 Mon Sep 17 00:00:00 2001 From: Matthias Koeppe Date: Sat, 2 Oct 2021 17:16:55 -0700 Subject: [PATCH 05/13] src/sage/features/sagemath.py: Fixup --- src/sage/features/sagemath.py | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/src/sage/features/sagemath.py b/src/sage/features/sagemath.py index c6d253a9c51..57bb082c8c5 100644 --- a/src/sage/features/sagemath.py +++ b/src/sage/features/sagemath.py @@ -10,25 +10,25 @@ def __init__(self): # sage.combinat will be a namespace package. # Testing whether sage.combinat itself can be imported is meaningless. # Hence, we test a Python module within the package. - PythonModule.__init__('sage.combinat.combinations') + PythonModule.__init__(self, 'sage.combinat.combinations') class sage__graphs(PythonModule): def __init__(self): - PythonModule.__init__('sage.graphs.graph') + PythonModule.__init__(self, 'sage.graphs.graph') class sage__rings__real_double(PythonModule): def __init__(self): - PythonModule.__init__('sage.rings.real_double') + PythonModule.__init__(self, 'sage.rings.real_double') class sage__symbolic(PythonModule): def __init__(self): - PythonModule.__init__('sage.symbolic.expression', spkg="sagemath_symbolics") + PythonModule.__init__(self, 'sage.symbolic.expression', spkg="sagemath_symbolics") def sage_optional_tags(): @@ -46,11 +46,11 @@ def sage_optional_tags(): Instead, we associate distribution packages to Python modules in :mod:`sage.features.sagemath` via the ``spkg`` parameter of :class:`PythonModule``. """ - if sage__combinat().is_functional(): + if sage__combinat().is_present(): yield 'sage.combinat' - if sage__graphs().is_functional(): + if sage__graphs().is_present(): yield 'sage.graphs' - if sage__rings__real_double().is_functional(): + if sage__rings__real_double().is_present(): yield 'sage.rings.real_double' - if sage__symbolic().is_functional(): + if sage__symbolic().is_present(): yield 'sage.symbolic' From 66cf3e12e49e6d5b86bd6023edc2d9d92ee2b00e Mon Sep 17 00:00:00 2001 From: Matthias Koeppe Date: Sat, 2 Oct 2021 17:58:35 -0700 Subject: [PATCH 06/13] src/sage/doctest/control.py: Fixup handling of sage_optional_tags --- src/sage/doctest/control.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/sage/doctest/control.py b/src/sage/doctest/control.py index 42ed54ddb49..05767a50876 100644 --- a/src/sage/doctest/control.py +++ b/src/sage/doctest/control.py @@ -40,7 +40,7 @@ from .external import external_software, available_software nodoctest_regex = re.compile(r'\s*(#+|%+|r"+|"+|\.\.)\s*nodoctest') -optionaltag_regex = re.compile(r'^\w+$') +optionaltag_regex = re.compile(r'^(\w|[.])+$') # Optional tags which are always automatically added @@ -53,9 +53,6 @@ except ImportError: pass -from sage.features.sagemath import sage_optional_tags -auto_optional_tags.update(sage_optional_tags()) - class DocTestDefaults(SageObject): """ This class is used for doctesting the Sage doctest module. @@ -374,6 +371,9 @@ def __init__(self, options, args): from sage.features import package_systems options.optional.update(system.name for system in package_systems()) + from sage.features.sagemath import sage_optional_tags + options.optional.update(sage_optional_tags()) + # Check that all tags are valid for o in options.optional: if not optionaltag_regex.search(o): From 1ec0c485ccaed52ce83ba66c479fadfa3ef9b167 Mon Sep 17 00:00:00 2001 From: Matthias Koeppe Date: Sat, 2 Oct 2021 18:37:51 -0700 Subject: [PATCH 07/13] src/sage/features/sagemath.py: Add sage.rings.number_field --- src/sage/features/sagemath.py | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/src/sage/features/sagemath.py b/src/sage/features/sagemath.py index 57bb082c8c5..1172b6a3ff6 100644 --- a/src/sage/features/sagemath.py +++ b/src/sage/features/sagemath.py @@ -19,6 +19,12 @@ def __init__(self): PythonModule.__init__(self, 'sage.graphs.graph') +class sage__rings__number_field(PythonModule): + + def __init__(self): + PythonModule.__init__(self, 'sage.rings.number_field_element') + + class sage__rings__real_double(PythonModule): def __init__(self): @@ -50,6 +56,8 @@ def sage_optional_tags(): yield 'sage.combinat' if sage__graphs().is_present(): yield 'sage.graphs' + if sage__rings__number_field().is_present(): + yield 'sage.rings.number_field' if sage__rings__real_double().is_present(): yield 'sage.rings.real_double' if sage__symbolic().is_present(): From 006374980e227e2e15b9324d3a3b47b2290d7570 Mon Sep 17 00:00:00 2001 From: Matthias Koeppe Date: Sun, 3 Oct 2021 14:55:25 -0700 Subject: [PATCH 08/13] src/sage/features/sagemath.py: Add features for modules that were optional extensions --- src/sage/features/sagemath.py | 40 +++++++++++++++++++++++++++++++++++ 1 file changed, 40 insertions(+) diff --git a/src/sage/features/sagemath.py b/src/sage/features/sagemath.py index 1172b6a3ff6..f18e5e79e88 100644 --- a/src/sage/features/sagemath.py +++ b/src/sage/features/sagemath.py @@ -19,6 +19,38 @@ def __init__(self): PythonModule.__init__(self, '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__rings__number_field(PythonModule): def __init__(self): @@ -56,6 +88,14 @@ def sage_optional_tags(): yield 'sage.combinat' if sage__graphs().is_present(): yield 'sage.graphs' + if sage__graphs__bliss().is_present(): + yield 'sage.graphs.bliss' + if sage__graphs__graph_decompositions__tdlib().is_present(): + yield 'sage.graphs.graph_decompositions.tdlib' + if sage__graphs__mcqd().is_present(): + yield 'sage.graphs.mcqd' + if sage__matrix__matrix_gfpn_dense().is_present(): + yield 'sage.matrix.matrix_gfpn_dense' if sage__rings__number_field().is_present(): yield 'sage.rings.number_field' if sage__rings__real_double().is_present(): From 14fd1e54a13b1df7f81858019b31fb92cdf36007 Mon Sep 17 00:00:00 2001 From: Matthias Koeppe Date: Mon, 4 Oct 2021 15:37:57 -0700 Subject: [PATCH 09/13] src/doc/en/developer/coding_basics.rst: Update discussion of feature tags --- src/doc/en/developer/coding_basics.rst | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/doc/en/developer/coding_basics.rst b/src/doc/en/developer/coding_basics.rst index f6413de91e8..31d87ef7d84 100644 --- a/src/doc/en/developer/coding_basics.rst +++ b/src/doc/en/developer/coding_basics.rst @@ -1101,9 +1101,10 @@ framework. Here is a comprehensive list: .. NOTE:: - Any words after ``# optional`` are interpreted as a list of - package names, separated by spaces. + package (spkg) names or other feature tags, separated by spaces. - - Any punctuation (periods, commas, hyphens, semicolons, ...) after the + - Any punctuation other than underscores (``_``) and periods (``.``), + that is, commas, hyphens, semicolons, ..., after the first word ends the list of packages. Hyphens or colons between the word ``optional`` and the first package name are allowed. Therefore, you should not write ``optional: needs package CHomP`` but simply From 27c53ac6450f789246b1df895bc26950a0cceb65 Mon Sep 17 00:00:00 2001 From: Matthias Koeppe Date: Wed, 6 Oct 2021 12:55:43 -0700 Subject: [PATCH 10/13] src/sage/features/sagemath.py: Add 'sage.plot' --- src/sage/features/sagemath.py | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/src/sage/features/sagemath.py b/src/sage/features/sagemath.py index f18e5e79e88..95676aa2cc1 100644 --- a/src/sage/features/sagemath.py +++ b/src/sage/features/sagemath.py @@ -51,6 +51,12 @@ def __init__(self): PythonModule.__init__(self, 'sage.matrix.matrix_gfpn_dense', spkg='meataxe') +class sage__plot(PythonModule): + + def __init__(self): + PythonModule.__init__(self, 'sage.plot.plot') + + class sage__rings__number_field(PythonModule): def __init__(self): @@ -96,6 +102,8 @@ def sage_optional_tags(): yield 'sage.graphs.mcqd' if sage__matrix__matrix_gfpn_dense().is_present(): yield 'sage.matrix.matrix_gfpn_dense' + if sage__plot().is_present(): + yield 'sage.plot' if sage__rings__number_field().is_present(): yield 'sage.rings.number_field' if sage__rings__real_double().is_present(): From 10e8d6395e1c829b6a28750d3035de95862230b8 Mon Sep 17 00:00:00 2001 From: Matthias Koeppe Date: Wed, 6 Oct 2021 21:36:56 -0700 Subject: [PATCH 11/13] sage.features.sagemath: Use JoinFeature when tag is different from the actually tested module --- src/sage/features/sagemath.py | 75 ++++++++++++++++++++--------------- 1 file changed, 43 insertions(+), 32 deletions(-) diff --git a/src/sage/features/sagemath.py b/src/sage/features/sagemath.py index 95676aa2cc1..f0ecfdddca7 100644 --- a/src/sage/features/sagemath.py +++ b/src/sage/features/sagemath.py @@ -2,21 +2,24 @@ Check for SageMath Python modules """ from . import PythonModule +from .join_feature import JoinFeature -class sage__combinat(PythonModule): +class sage__combinat(JoinFeature): def __init__(self): # sage.combinat will be a namespace package. # Testing whether sage.combinat itself can be imported is meaningless. # Hence, we test a Python module within the package. - PythonModule.__init__(self, 'sage.combinat.combinations') + JoinFeature.__init__(self, 'sage.combinat', + [PythonModule('sage.combinat.combinations')]) -class sage__graphs(PythonModule): +class sage__graphs(JoinFeature): def __init__(self): - PythonModule.__init__(self, 'sage.graphs.graph') + JoinFeature.__init__(self, 'sage.graphs', + [PythonModule('sage.graphs.graph')]) class sage__graphs__bliss(PythonModule): @@ -51,16 +54,18 @@ def __init__(self): PythonModule.__init__(self, 'sage.matrix.matrix_gfpn_dense', spkg='meataxe') -class sage__plot(PythonModule): +class sage__plot(JoinFeature): def __init__(self): - PythonModule.__init__(self, 'sage.plot.plot') + JoinFeature.__init__(self, 'sage.plot', + [PythonModule('sage.plot.plot')]) -class sage__rings__number_field(PythonModule): +class sage__rings__number_field(JoinFeature): def __init__(self): - PythonModule.__init__(self, 'sage.rings.number_field_element') + JoinFeature.__init__(self, 'sage.rings.number_field', + [PythonModule('sage.rings.number_field.number_field_element')]) class sage__rings__real_double(PythonModule): @@ -69,10 +74,12 @@ def __init__(self): PythonModule.__init__(self, 'sage.rings.real_double') -class sage__symbolic(PythonModule): +class sage__symbolic(JoinFeature): def __init__(self): - PythonModule.__init__(self, 'sage.symbolic.expression', spkg="sagemath_symbolics") + JoinFeature.__init__(self, 'sage.symbolic', + [PythonModule('sage.symbolic.expression')], + spkg="sagemath_symbolics") def sage_optional_tags(): @@ -82,31 +89,35 @@ def sage_optional_tags(): These tags are named after Python packages/modules (e.g., :mod:`~sage.symbolic`), not distribution packages (``sagemath-symbolics``). - This is motivated by a separation of concerns: The author of a module that depends + This design is motivated by a separation of concerns: The author of a module that depends on some functionality provided by a Python module usually already knows the name of the Python module, so we do not want to force the author to also know about the distribution package that provides the Python module. Instead, we associate distribution packages to Python modules in - :mod:`sage.features.sagemath` via the ``spkg`` parameter of :class:`PythonModule``. + :mod:`sage.features.sagemath` via the ``spkg`` parameter of :class:`Feature`. + + EXAMPLES:: + + sage: from sage.features.sagemath import sage_optional_tags + sage: list(sage_optional_tags()) # random + ['sage.graphs', + 'sage.graphs.bliss', + 'sage.matrix.matrix_gfpn_dense', + 'sage.plot', + 'sage.rings.number_field', + 'sage.rings.real_double', + 'sage.symbolic'] """ - if sage__combinat().is_present(): - yield 'sage.combinat' - if sage__graphs().is_present(): - yield 'sage.graphs' - if sage__graphs__bliss().is_present(): - yield 'sage.graphs.bliss' - if sage__graphs__graph_decompositions__tdlib().is_present(): - yield 'sage.graphs.graph_decompositions.tdlib' - if sage__graphs__mcqd().is_present(): - yield 'sage.graphs.mcqd' - if sage__matrix__matrix_gfpn_dense().is_present(): - yield 'sage.matrix.matrix_gfpn_dense' - if sage__plot().is_present(): - yield 'sage.plot' - if sage__rings__number_field().is_present(): - yield 'sage.rings.number_field' - if sage__rings__real_double().is_present(): - yield 'sage.rings.real_double' - if sage__symbolic().is_present(): - yield 'sage.symbolic' + 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(), + sage__symbolic()]: + if feature.is_present(): + yield feature.name From 654d09ca4c22f4888d8e511789e57a7627043492 Mon Sep 17 00:00:00 2001 From: Matthias Koeppe Date: Wed, 6 Oct 2021 22:31:57 -0700 Subject: [PATCH 12/13] sage.features.sagemath: Change sage_optional_tags to sage_features --- src/sage/doctest/control.py | 4 ++-- src/sage/features/sagemath.py | 19 ++++++++----------- 2 files changed, 10 insertions(+), 13 deletions(-) diff --git a/src/sage/doctest/control.py b/src/sage/doctest/control.py index 05767a50876..3f11a5bf982 100644 --- a/src/sage/doctest/control.py +++ b/src/sage/doctest/control.py @@ -371,8 +371,8 @@ def __init__(self, options, args): from sage.features import package_systems options.optional.update(system.name for system in package_systems()) - from sage.features.sagemath import sage_optional_tags - options.optional.update(sage_optional_tags()) + from sage.features.sagemath import sage_features + options.optional.update(feature.name for feature in sage_features()) # Check that all tags are valid for o in options.optional: diff --git a/src/sage/features/sagemath.py b/src/sage/features/sagemath.py index f0ecfdddca7..91fec0ac498 100644 --- a/src/sage/features/sagemath.py +++ b/src/sage/features/sagemath.py @@ -82,7 +82,7 @@ def __init__(self): spkg="sagemath_symbolics") -def sage_optional_tags(): +def sage_features(): """ Return tags for conditionalizing doctests. @@ -99,15 +99,12 @@ def sage_optional_tags(): EXAMPLES:: - sage: from sage.features.sagemath import sage_optional_tags - sage: list(sage_optional_tags()) # random - ['sage.graphs', - 'sage.graphs.bliss', - 'sage.matrix.matrix_gfpn_dense', - 'sage.plot', - 'sage.rings.number_field', - 'sage.rings.real_double', - 'sage.symbolic'] + 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.real_double')] """ for feature in [sage__combinat(), sage__graphs(), @@ -120,4 +117,4 @@ def sage_optional_tags(): sage__rings__real_double(), sage__symbolic()]: if feature.is_present(): - yield feature.name + yield feature From f63a7d0171ba5f753d1755e0aff3fd00e373590c Mon Sep 17 00:00:00 2001 From: Matthias Koeppe Date: Thu, 7 Oct 2021 00:19:30 -0700 Subject: [PATCH 13/13] src/sage/features/: Move features depending on optional packages to separate files --- src/sage/features/bliss.py | 14 +++++++----- src/sage/features/mcqd.py | 11 ++++++++++ src/sage/features/meataxe.py | 11 ++++++++++ src/sage/features/sagemath.py | 40 ++--------------------------------- src/sage/features/tdlib.py | 11 ++++++++++ 5 files changed, 44 insertions(+), 43 deletions(-) create mode 100644 src/sage/features/mcqd.py create mode 100644 src/sage/features/meataxe.py create mode 100644 src/sage/features/tdlib.py diff --git a/src/sage/features/bliss.py b/src/sage/features/bliss.py index bda43f4a5f8..d870ade5973 100644 --- a/src/sage/features/bliss.py +++ b/src/sage/features/bliss.py @@ -3,6 +3,7 @@ Checks for bliss """ from . import CythonFeature, PythonModule +from .join_feature import JoinFeature TEST_CODE = """ @@ -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:: @@ -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/")]) diff --git a/src/sage/features/mcqd.py b/src/sage/features/mcqd.py new file mode 100644 index 00000000000..6539af1d6d5 --- /dev/null +++ b/src/sage/features/mcqd.py @@ -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')]) diff --git a/src/sage/features/meataxe.py b/src/sage/features/meataxe.py new file mode 100644 index 00000000000..a8b65d166dc --- /dev/null +++ b/src/sage/features/meataxe.py @@ -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')]) diff --git a/src/sage/features/sagemath.py b/src/sage/features/sagemath.py index 91fec0ac498..2af7def3668 100644 --- a/src/sage/features/sagemath.py +++ b/src/sage/features/sagemath.py @@ -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): @@ -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``). @@ -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(), diff --git a/src/sage/features/tdlib.py b/src/sage/features/tdlib.py new file mode 100644 index 00000000000..e01e1bdfdf6 --- /dev/null +++ b/src/sage/features/tdlib.py @@ -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')])