forked from sagemath/sage
-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
18 changed files
with
257 additions
and
94 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 @@ | ||
4ti2 |
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 @@ | ||
lib4ti2-devel |
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 @@ | ||
4ti2 |
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 @@ | ||
4ti2 |
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 @@ | ||
math/4ti2 |
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 @@ | ||
sci-mathematics/4ti2 |
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,32 @@ | ||
SAGE_SPKG_CONFIGURE([4ti2], [ | ||
SAGE_SPKG_DEPCHECK([gmp mpir glpk zlib], [ | ||
dnl Debian installs these programs with an executable prefix "4ti2-", | ||
dnl OpenSUSE uses the prefix "4ti2_". | ||
dnl Singular checks for unprefixed and prefixed with "4ti2-". | ||
dnl Polymake does not check for prefixed binaries. | ||
m4_foreach([prog], [hilbert,markov,graver,zsolve,qsolve,rays,ppi,circuits,groebner], [ | ||
AC_CHECK_PROGS([FOURTITWO_]m4_toupper(prog), prog [4ti2-]prog [4ti2_]prog) | ||
AS_VAR_IF([FOURTITWO_]m4_toupper(prog), [""], [sage_spkg_install_4ti2=yes]) | ||
AC_SUBST([FOURTITWO_]m4_toupper(prog)) | ||
]) | ||
dnl Adapted from https://github.com/latte-int/latte/blob/master/m4/4ti2-check.m4 | ||
AC_MSG_CHECKING(for library 4ti2gmp) | ||
BACKUP_CXXFLAGS=${CXXFLAGS} | ||
BACKUP_LIBS=${LIBS} | ||
FORTYTWO_CXXFLAGS="-D__STDC_LIMIT_MACROS -D_4ti2_GMP_" | ||
FORTYTWO_LIBS="-l4ti2gmp -lzsolve" | ||
CXXFLAGS="${BACKUP_CXXFLAGS} ${FORTYTWO_CXXFLAGS} ${GMP_CFLAGS}" | ||
LIBS="${BACKUP_LIBS} ${FORTYTWO_LIBS} ${GMP_LIBS}" | ||
AC_LINK_IFELSE([AC_LANG_PROGRAM([[ | ||
#include "4ti2/4ti2.h" | ||
]], [[ _4ti2_rays_create_state(_4ti2_PREC_INT_ARB); | ||
]])],[ | ||
AC_MSG_RESULT([yes]) | ||
],[ | ||
AC_MSG_RESULT([no]) | ||
sage_spkg_install_4ti2=yes | ||
]) | ||
CXXFLAGS=${BACKUP_CXXFLAGS} | ||
LIBS=${BACKUP_LIBS} | ||
]) | ||
]) |
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
from . import Executable | ||
from .join_feature import JoinFeature | ||
|
||
|
||
class FourTi2Executable(Executable): | ||
r""" | ||
Feature for the 4ti2 executables. | ||
""" | ||
def __init__(self, name): | ||
from sage.env import SAGE_ENV | ||
Executable.__init__(self, | ||
name="4ti2-" + name, | ||
executable=SAGE_ENV.get("FOURTITWO_" + name.upper(), None) or name, | ||
spkg="4ti2") | ||
|
||
|
||
class FourTi2(JoinFeature): | ||
r""" | ||
A :class:`sage.features.Feature` describing the presence of the ``4ti2`` executables. | ||
EXAMPLES:: | ||
sage: from sage.features.four_ti_2 import FourTi2 | ||
sage: FourTi2().is_present() # optional - 4ti2 | ||
FeatureTestResult('4ti2', True) | ||
""" | ||
def __init__(self): | ||
JoinFeature.__init__(self, '4ti2', | ||
[FourTi2Executable(x) | ||
# same list is tested in build/pkgs/4ti2/spkg-configure.m4 | ||
for x in ('hilbert', 'markov', 'graver', 'zsolve', 'qsolve', | ||
'rays', 'ppi', 'circuits', 'groebner')]) |
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,82 @@ | ||
r""" | ||
Join features | ||
""" | ||
|
||
from . import Feature, FeatureTestResult | ||
|
||
|
||
class JoinFeature(Feature): | ||
r""" | ||
Join of several :class:`sage.features.Feature` instances. | ||
EXAMPLES:: | ||
sage: from sage.features import Executable | ||
sage: from sage.features.join_feature import JoinFeature | ||
sage: F = JoinFeature("shell-boolean", | ||
....: (Executable('shell-true', 'true'), | ||
....: Executable('shell-false', 'false'))) | ||
sage: F.is_present() | ||
FeatureTestResult('shell-boolean', True) | ||
sage: F = JoinFeature("asdfghjkl", | ||
....: (Executable('shell-true', 'true'), | ||
....: Executable('xxyyyy', 'xxyyyy-does-not-exist'))) | ||
sage: F.is_present() | ||
FeatureTestResult('xxyyyy', False) | ||
""" | ||
def __init__(self, name, features, spkg=None, url=None): | ||
""" | ||
TESTS: | ||
The empty join feature is present:: | ||
sage: from sage.features.join_feature import JoinFeature | ||
sage: JoinFeature("empty", ()).is_present() | ||
FeatureTestResult('empty', True) | ||
""" | ||
if spkg is None: | ||
spkgs = set(f.spkg for f in features if f.spkg) | ||
if len(spkgs) > 1: | ||
raise ValueError('given features have more than one spkg; provide spkg argument') | ||
elif len(spkgs) == 1: | ||
spkg = next(iter(spkgs)) | ||
if url is None: | ||
urls = set(f.url for f in features if f.url) | ||
if len(urls) > 1: | ||
raise ValueError('given features have more than one url; provide url argument') | ||
elif len(urls) == 1: | ||
url = next(iter(urls)) | ||
super().__init__(name, spkg=spkg, url=url) | ||
self._features = features | ||
|
||
def _is_present(self): | ||
r""" | ||
Test for the presence of the join feature. | ||
EXAMPLES:: | ||
sage: from sage.features.latte import Latte | ||
sage: Latte()._is_present() # optional - latte_int | ||
FeatureTestResult('LattE', True) | ||
""" | ||
for f in self._features: | ||
test = f._is_present() | ||
if not test: | ||
return test | ||
return FeatureTestResult(self, True) | ||
|
||
def is_functional(self): | ||
r""" | ||
Test whether the join feature is functional. | ||
EXAMPLES:: | ||
sage: from sage.features.latte import Latte | ||
sage: Latte().is_functional() # optional - latte_int | ||
FeatureTestResult('LattE', True) | ||
""" | ||
for f in self._features: | ||
test = f.is_functional() | ||
if not test: | ||
return test | ||
return FeatureTestResult(self, True) |
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
Oops, something went wrong.