Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

sage.features: Add sage.libs.singular, features for standard Python packages #35237

Merged
merged 10 commits into from
Apr 1, 2023
13 changes: 13 additions & 0 deletions src/sage/features/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,19 @@
As can be seen above, features try to produce helpful error messages.
"""

# *****************************************************************************
# Copyright (C) 2016 Julian RΓΌth
# 2018 Jeroen Demeyer
# 2018 Timo Kaufmann
# 2019-2022 Matthias Koeppe
# 2021 Kwankyu Lee
#
# Distributed under the terms of the GNU General Public License (GPL)
# as published by the Free Software Foundation; either version 2 of
# the License, or (at your option) any later version.
# https://www.gnu.org/licenses/
# *****************************************************************************

from __future__ import annotations

import os
Expand Down
9 changes: 9 additions & 0 deletions src/sage/features/all.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,15 @@
Enumeration of all defined features
"""

# *****************************************************************************
# Copyright (C) 2021 Matthias Koeppe
#
# Distributed under the terms of the GNU General Public License (GPL)
# as published by the Free Software Foundation; either version 2 of
# the License, or (at your option) any later version.
# https://www.gnu.org/licenses/
# *****************************************************************************

def all_features():
r"""
Return an iterable of all features.
Expand Down
13 changes: 12 additions & 1 deletion src/sage/features/bliss.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,18 @@
# -*- coding: utf-8 -*-
r"""
Features for testing the presence of ``bliss``
"""

# *****************************************************************************
# Copyright (C) 2016 Julian RΓΌth
# 2018 Jeroen Demeyer
# 2021 Matthias Koeppe
#
# Distributed under the terms of the GNU General Public License (GPL)
# as published by the Free Software Foundation; either version 2 of
# the License, or (at your option) any later version.
# https://www.gnu.org/licenses/
# *****************************************************************************

from . import CythonFeature, PythonModule
from .join_feature import JoinFeature

Expand Down
10 changes: 10 additions & 0 deletions src/sage/features/cddlib.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,16 @@
r"""
Feature for testing the presence of ``cddlib``
"""

# *****************************************************************************
# Copyright (C) 2022 Matthias Koeppe
#
# Distributed under the terms of the GNU General Public License (GPL)
# as published by the Free Software Foundation; either version 2 of
# the License, or (at your option) any later version.
# https://www.gnu.org/licenses/
# *****************************************************************************

from . import Executable


Expand Down
12 changes: 12 additions & 0 deletions src/sage/features/csdp.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,18 @@
Feature for testing the presence of ``csdp``
"""

# *****************************************************************************
# Copyright (C) 2016 Julian RΓΌth
# 2018 Jeroen Demeyer
# 2019 David Coudert
# 2021 Matthias Koeppe
#
# Distributed under the terms of the GNU General Public License (GPL)
# as published by the Free Software Foundation; either version 2 of
# the License, or (at your option) any later version.
# https://www.gnu.org/licenses/
# *****************************************************************************

import os
import re
import subprocess
Expand Down
10 changes: 9 additions & 1 deletion src/sage/features/cython.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,16 @@
# -*- coding: utf-8 -*-
r"""
Features for testing the presence of ``cython``
"""

# *****************************************************************************
# Copyright (C) 2021 Matthias Koeppe
#
# Distributed under the terms of the GNU General Public License (GPL)
# as published by the Free Software Foundation; either version 2 of
# the License, or (at your option) any later version.
# https://www.gnu.org/licenses/
# *****************************************************************************

from . import CythonFeature


Expand Down
15 changes: 14 additions & 1 deletion src/sage/features/databases.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,21 @@
# -*- coding: utf-8 -*-
r"""
Features for testing the presence of various databases
"""

# *****************************************************************************
# Copyright (C) 2016 Julian RΓΌth
# 2018-2019 Jeroen Demeyer
# 2018 Timo Kaufmann
# 2020-2022 Matthias Koeppe
# 2020-2022 Sebastian Oehms
# 2021 Kwankyu Lee
#
# Distributed under the terms of the GNU General Public License (GPL)
# as published by the Free Software Foundation; either version 2 of
# the License, or (at your option) any later version.
# https://www.gnu.org/licenses/
# *****************************************************************************


from . import StaticFile, PythonModule
from sage.env import (
Expand Down
1 change: 0 additions & 1 deletion src/sage/features/dvipng.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
# -*- coding: utf-8 -*-
r"""
Feature for testing the presence of ``dvipng``
"""
Expand Down
3 changes: 1 addition & 2 deletions src/sage/features/ffmpeg.py
Original file line number Diff line number Diff line change
@@ -1,9 +1,8 @@
# -*- coding: utf-8 -*-
r"""
Feature for testing the presence of ``ffmpeg``
"""
# ****************************************************************************
# Copyright (C) 2018 Sebastien Labbe <[email protected]>
# Copyright (C) 2018-2022 Sebastien Labbe <[email protected]>
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
Expand Down
44 changes: 42 additions & 2 deletions src/sage/features/gap.py
Original file line number Diff line number Diff line change
@@ -1,9 +1,18 @@
# -*- coding: utf-8 -*-
r"""
Features for testing the presence of GAP packages
"""
# *****************************************************************************
# Copyright (C) 2016 Julian RΓΌth
# 2018 Jeroen Demeyer
#
# Distributed under the terms of the GNU General Public License (GPL)
# as published by the Free Software Foundation; either version 2 of
# the License, or (at your option) any later version.
# https://www.gnu.org/licenses/
# *****************************************************************************

from . import Feature, FeatureTestResult
from . import Feature, FeatureTestResult, PythonModule
from .join_feature import JoinFeature


class GapPackage(Feature):
Expand Down Expand Up @@ -48,3 +57,34 @@ def _is_present(self):
else:
return FeatureTestResult(self, False,
reason="`{command}` evaluated to `{presence}` in GAP.".format(command=command, presence=presence))


class sage__libs__gap(JoinFeature):
r"""
A :class:`sage.features.Feature` describing the presence of :mod:`sage.libs.gap`
(the library interface to GAP) and :mod:`sage.interfaces.gap` (the pexpect
interface to GAP). By design, we do not distinguish between these two, in order
to facilitate the conversion of code from the pexpect interface to the library
interface.
EXAMPLES::
sage: from sage.features.gap import sage__libs__gap
sage: sage__libs__gap().is_present() # optional - sage.libs.gap
FeatureTestResult('sage.libs.gap', True)
"""
def __init__(self):
r"""
TESTS::
sage: from sage.features.gap import sage__libs__gap
sage: isinstance(sage__libs__gap(), sage__libs__gap)
True
"""
JoinFeature.__init__(self, 'sage.libs.gap',
[PythonModule('sage.libs.gap.libgap'),
PythonModule('sage.interfaces.gap')])


def all_features():
return [sage__libs__gap()]
9 changes: 9 additions & 0 deletions src/sage/features/gfan.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,15 @@
Features for testing the presence of ``gfan``
"""

# *****************************************************************************
# Copyright (C) 2022 Matthias Koeppe
#
# Distributed under the terms of the GNU General Public License (GPL)
# as published by the Free Software Foundation; either version 2 of
# the License, or (at your option) any later version.
# https://www.gnu.org/licenses/
# *****************************************************************************

from . import Executable


Expand Down
14 changes: 13 additions & 1 deletion src/sage/features/graph_generators.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,20 @@
# -*- coding: utf-8 -*-
r"""
Features for testing the presence of various graph generator programs
"""

# *****************************************************************************
# Copyright (C) 2016 Julian RΓΌth
# 2018 Jeroen Demeyer
# 2019 FrΓ©dΓ©ric Chapoton
# 2021 Matthias Koeppe
# 2021 Kwankyu Lee
#
# Distributed under the terms of the GNU General Public License (GPL)
# as published by the Free Software Foundation; either version 2 of
# the License, or (at your option) any later version.
# https://www.gnu.org/licenses/
# *****************************************************************************

import os
import subprocess

Expand Down
4 changes: 3 additions & 1 deletion src/sage/features/graphviz.py
Original file line number Diff line number Diff line change
@@ -1,16 +1,18 @@
# -*- coding: utf-8 -*-
r"""
Features for testing the presence of ``graphviz``
"""

# ****************************************************************************
# Copyright (C) 2018 Sebastien Labbe <[email protected]>
# 2021 Matthias Koeppe
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 2 of the License, or
# (at your option) any later version.
# https://www.gnu.org/licenses/
# ****************************************************************************

from . import Executable
from .join_feature import JoinFeature

Expand Down
11 changes: 11 additions & 0 deletions src/sage/features/igraph.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,17 @@
r"""
Check for igraph
"""

# ****************************************************************************
# Copyright (C) 2021 Matthias Koeppe
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 2 of the License, or
# (at your option) any later version.
# https://www.gnu.org/licenses/
# ****************************************************************************

from . import PythonModule
from .join_feature import JoinFeature

Expand Down
4 changes: 2 additions & 2 deletions src/sage/features/imagemagick.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
# -*- coding: utf-8 -*-
r"""
Feature for testing the presence of ``imagemagick``
Expand All @@ -7,8 +6,9 @@
``identify``, ``composite``, ``montage``, ``compare``, etc. could be also
checked in this module.
"""

# ****************************************************************************
# Copyright (C) 2018 Sebastien Labbe <[email protected]>
# Copyright (C) 2018-2022 Sebastien Labbe <[email protected]>
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
Expand Down
11 changes: 11 additions & 0 deletions src/sage/features/interfaces.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,17 @@
r"""
Features for testing whether interpreter interfaces are functional
"""

# ****************************************************************************
# Copyright (C) 2021 Matthias Koeppe
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 2 of the License, or
# (at your option) any later version.
# https://www.gnu.org/licenses/
# ****************************************************************************

import importlib

from . import Feature, FeatureTestResult, PythonModule
Expand Down
10 changes: 10 additions & 0 deletions src/sage/features/internet.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,16 @@
Feature for testing if the Internet is available
"""

# ****************************************************************************
# Copyright (C) 2021 Matthias Koeppe
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 2 of the License, or
# (at your option) any later version.
# https://www.gnu.org/licenses/
# ****************************************************************************

from . import Feature, FeatureTestResult


Expand Down
11 changes: 11 additions & 0 deletions src/sage/features/join_feature.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,17 @@
Join features
"""

# ****************************************************************************
# Copyright (C) 2021-2022 Matthias Koeppe
# 2021-2022 Kwankyu Lee
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 2 of the License, or
# (at your option) any later version.
# https://www.gnu.org/licenses/
# ****************************************************************************

from . import Feature, FeatureTestResult


Expand Down
14 changes: 13 additions & 1 deletion src/sage/features/kenzo.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,20 @@
# -*- coding: utf-8 -*-
r"""
Feature for testing the presence of ``kenzo``
"""

# ****************************************************************************
# Copyright (C) 2020 Travis Scrimshaw
# 2021 Matthias Koeppe
# 2021 Michael Orlitzky
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 2 of the License, or
# (at your option) any later version.
# https://www.gnu.org/licenses/
# ****************************************************************************


from . import Feature, FeatureTestResult

class Kenzo(Feature):
Expand Down
5 changes: 4 additions & 1 deletion src/sage/features/latex.py
Original file line number Diff line number Diff line change
@@ -1,9 +1,12 @@
# -*- coding: utf-8 -*-
r"""
Features for testing the presence of ``latex`` and equivalent programs
"""

# ****************************************************************************
# Copyright (C) 2021 Sebastien Labbe <[email protected]>
# 2021 Matthias Koeppe
# 2022 Kwankyu Lee
# 2022 Sebastian Oehms
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
Expand Down
Loading