Skip to content
This repository has been archived by the owner on Jan 30, 2023. It is now read-only.

Commit

Permalink
Trac #29617: modify Kenzo interface to support system ECL.
Browse files Browse the repository at this point in the history
We repeat all of the recent changes made to the maxima interface
for kenzo, which also needs to support system installations of ECL.
  • Loading branch information
orlitzky committed Apr 8, 2021
1 parent 133aab7 commit 9b595c0
Show file tree
Hide file tree
Showing 6 changed files with 24 additions and 6 deletions.
3 changes: 3 additions & 0 deletions build/pkgs/ecl/spkg-configure.m4
Original file line number Diff line number Diff line change
Expand Up @@ -38,4 +38,7 @@ SAGE_SPKG_CONFIGURE([ecl], [
# Maxima cannot yet be provided by the system, so we always use
# the SAGE_LOCAL path for now.
AC_SUBST(SAGE_MAXIMA_FAS, ['${prefix}'/lib/ecl/maxima.fas])
# Likewise for the optional Kenzo SPKG
AC_SUBST(SAGE_KENZO_FAS, ['${prefix}'/lib/ecl/kenzo.fas])
])
8 changes: 5 additions & 3 deletions build/pkgs/kenzo/spkg-install.in
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,11 @@ cd src

ecl < compile.lisp

# Install Kenzo into ECL's library directory (installation procedure
# copied from Maxima's spkg-install.in file):
ECLLIB=`ecl -eval "(princ (SI:GET-LIBRARY-PATHNAME))" -eval "(quit)"`
# Install Kenzo into ECL's library directory.
# Ensure that the $ECLLIB directory exists in
# case we're using ECL from the system.
ECLLIB="${SAGE_LOCAL}/lib/ecl"
mkdir -p "${ECLLIB}"
echo
echo "Now installing Kenzo as '$ECLLIB/kenzo.fas'..."
cp -f kenzo--all-systems.fasb "$ECLLIB/kenzo.fas" \
Expand Down
3 changes: 3 additions & 0 deletions build/pkgs/sage_conf/src/sage_conf.py.in
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,9 @@ MAXIMA = "@prefix@/bin/maxima"
# Delete this line if your ECL can load maxima without further prodding.
MAXIMA_FAS = "@SAGE_MAXIMA_FAS@".replace('${prefix}', SAGE_LOCAL)

# Delete this line if your ECL can load Kenzo without further prodding.
KENZO_FAS = "@SAGE_KENZO_FAS@".replace('${prefix}', SAGE_LOCAL)

ARB_LIBRARY = "@SAGE_ARB_LIBRARY@"

NTL_INCDIR = "@NTL_INCDIR@"
Expand Down
1 change: 1 addition & 0 deletions src/sage/env.py
Original file line number Diff line number Diff line change
Expand Up @@ -207,6 +207,7 @@ def var(key: str, *fallbacks: Optional[str], force: bool = False) -> Optional[st
PPLPY_DOCS = var("PPLPY_DOCS", join(SAGE_SHARE, "doc", "pplpy"))
MAXIMA = var("MAXIMA", "maxima")
MAXIMA_FAS = var("MAXIMA_FAS")
KENZO_FAS = var("KENZO_FAS")
SAGE_NAUTY_BINS_PREFIX = var("SAGE_NAUTY_BINS_PREFIX", "")
ARB_LIBRARY = var("ARB_LIBRARY", "arb")
CBLAS_PC_MODULES = var("CBLAS_PC_MODULES", "cblas:openblas:blas")
Expand Down
7 changes: 6 additions & 1 deletion src/sage/features/kenzo.py
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,12 @@ def _is_present(self):
ecl_eval("(setf *standard-output* *dev-null*)")

try:
ecl_eval("(require :kenzo)")
from sage.env import KENZO_FAS
if KENZO_FAS is not None:
ecl_eval("(require :kenzo \"{}\")".format(KENZO_FAS))
else:
ecl_eval("(require :kenzo)")

except RuntimeError:
return FeatureTestResult(self, False, reason="Unable to make ECL require kenzo")
return FeatureTestResult(self, True)
Expand Down
8 changes: 6 additions & 2 deletions src/sage/interfaces/kenzo.py
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,6 @@
from sage.libs.ecl import EclObject, ecl_eval, EclListIterator
from sage.features.kenzo import Kenzo


# defining the auxiliary functions as wrappers over the kenzo ones
kenzo_names = ['add',
'array-dimensions',
Expand Down Expand Up @@ -107,7 +106,12 @@
# example __sphere__ is defined as EclObject("sphere"). Hyphens
# are replaced with underscores to get valid Python identifiers.
if Kenzo().is_present():
ecl_eval("(require :kenzo)")
from sage.env import KENZO_FAS
if KENZO_FAS is not None:
ecl_eval("(require :kenzo \"{}\")".format(KENZO_FAS))
else:
ecl_eval("(require :kenzo)")

ecl_eval("(in-package :cat)")
ecl_eval("(setf *HOMOLOGY-VERBOSE* nil)")
for s in kenzo_names:
Expand Down

0 comments on commit 9b595c0

Please sign in to comment.