sage.geometry: Use PalpExecutable(...).absolute_filename()
mkoeppe opened this issue · 15 comments
This is so that the Sage library becomes fully functional even when not being run from within sage-env (which sets PATH).
To test:
$ venv/bin/python3 -c 'from sage.all import *; print(lattice_polytope.cross_polytope(3).polar().facets()[0].ambient_point_indices())'
$ venv/bin/python3 -c 'from sage.all import *; from sage.geometry.polyhedron.palp_database import PALPreader; print(next(iter(PALPreader(2, output="list"))))'
Depends on #32893
Depends on #31296
CC: @dimpase
Component: geometry
Author: Matthias Koeppe
Branch/Commit: 4b58ad6
Reviewer: Dima Pasechnik
Issue created by migration from https://trac.sagemath.org/ticket/33467
Description changed:
---
+++
@@ -1 +1,9 @@
+This is so that the Sage library becomes fully functional even when not being run from within sage-env (which sets PATH).
+To test:
+
+```
+$ venv/bin/python3 -c 'from sage.all import *; print(lattice_polytope.cross_polytope(3).polar().facets()[0].ambient_point_indices())'
+$ venv/bin/python3 -c 'from sage.all import *; from sage.geometry.polyhedron.palp_database import PALPreader; print(next(iter(PALPreader(2, output="list"))))'
+```
+Last 10 new commits:
a93e9af | src/sage/features/__init__.py: Simplify Executable.absolute_path |
5b25c1d | sage.features: Refactor StaticFile, Executable through a new base class FileFeature |
6c35717 | sage.features.FileFeature: Replace method absolute_path by absolute_filename, with deprecation |
9266709 | Merge #31292 |
a4d0ed6 | sage.interfaces.four_ti_2: Use Executable.absolute_filename |
4252ea3 | sage.sandpiles.sandpile: Use Executable.absolute_filename() when interfacing 4ti2 |
17b9fde | sage.interfaces.latte: Use Executable.absolute_filename |
d15588a | Merge #31296 |
314ac7a | src/sage/geometry/lattice_polytope.py: Use PalpExecutable(executable).absolute_filename() |
27b5514 | src/sage/geometry/polyhedron/palp_database.py: Use PalpExecutable(executable).absolute_filename() |
Author: Matthias Koeppe
You need to adjust doctests for latte:
File "src/sage/interfaces/latte.py", line 95, in sage.interfaces.latte.count
Failed example:
n = count(cddin, cdd=True, verbose=True, raw_output=True) # optional - latte_int
Expected:
This is LattE integrale ...
...
Invocation: count '--redundancy-check=none' --cdd /dev/stdin
...
Total Unimodular Cones: ...
Maximum number of simplicial cones in memory at once: ...
<BLANKLINE>
**** The number of lattice points is: ****
Total time: ... sec
Got:
This is LattE integrale 1.7.6
Available from http://www.math.ucdavis.edu/~latte/
<BLANKLINE>
Invocation: /mnt/opt/Sage/sage-dev/local/bin/count '--redundancy-check=none' --cdd /dev/stdin
Warning: Not performing check for empty polytope, because it is unimplemented for the CDD-style input format.
size = 12 x 4
...
etc., as the path is no longer relative...
Fix the latter is easy:
--- a/src/sage/interfaces/latte.py
+++ b/src/sage/interfaces/latte.py
@@ -95,7 +95,7 @@ def count(arg, ehrhart_polynomial=False, multivariate_generating_function=False,
sage: n = count(cddin, cdd=True, verbose=True, raw_output=True) # optional - latte_int
This is LattE integrale ...
...
- Invocation: count '--redundancy-check=none' --cdd /dev/stdin
+ Invocation: ...count '--redundancy-check=none' --cdd /dev/stdin
...
Total Unimodular Cones: ...
Maximum number of simplicial cones in memory at once: ...
@@ -271,7 +271,7 @@ def integrate(arg, polynomial=None, algorithm='triangulate', raw_output=False, v
sage: ans = integrate(cddin, f, cdd=True, verbose=True, raw_output=True) # optional - latte_int
This is LattE integrale ...
...
- Invocation: integrate --valuation=integrate --triangulate --redundancy-check=none --cdd --monomials=... /dev/stdin
+ Invocation: ...integrate --valuation=integrate --triangulate --redundancy-check=none --cdd --monomials=... /dev/stdin
...
Testing triangulate algorithm::
@@ -313,7 +313,7 @@ def integrate(arg, polynomial=None, algorithm='triangulate', raw_output=False, v
sage: ans = integrate(cddin, cdd=True, raw_output=True, verbose=True) # optional - latte_int
This is LattE integrale ...
...
- Invocation: integrate --valuation=volume --triangulate --redundancy-check=none --cdd /dev/stdin
+ Invocation: ...integrate --valuation=volume --triangulate --redundancy-check=none --cdd /dev/stdin
...
Testing the runtime error::does this patch belong here?
Last 10 new commits:
89b24ff | src/sage/geometry/polyhedron/palp_database.py: Add # sage.doctest: optional - palp |
68babd5 | src/sage/geometry/lattice_polytope.py: Mark doctests # optional - palp |
a1bb676 | src/sage/geometry: Mark doctests # optional - palp |
477b84c | LatticePolytopeClass, NefPartition, PointCollection, ToricLattice_ambient: Add `_sage_input_` methods |
6acf7de | src/sage/geometry/lattice_polytope.py: In NefPartition doctests, construct examples without using palp |
9423f26 | src/sage/geometry/lattice_polytope.py, src/sage/schemes/toric/fano_variety.py: Use unicode disjoint union symbol |
5a220b1 | src/sage/geometry/lattice_polytope.py: Fix typo |
c78d80e | src/sage/features/databases.py (DatabaseReflexivePolytopes): New |
d6b0021 | src/sage/geometry/lattice_polytope.py: Use PalpExecutable(executable).absolute_filename() |
9b1b484 | src/sage/geometry/polyhedron/palp_database.py: Use PalpExecutable(executable).absolute_filename() |
Branch pushed to git repo; I updated commit sha1. This was a forced push. Last 10 new commits:
ccca4e7 | src/sage/geometry/polyhedron/palp_database.py: Add # sage.doctest: optional - palp |
4eaad20 | src/sage/geometry/lattice_polytope.py: Mark doctests # optional - palp |
c977dae | src/sage/geometry: Mark doctests # optional - palp |
75dfdf0 | LatticePolytopeClass, NefPartition, PointCollection, ToricLattice_ambient: Add `_sage_input_` methods |
4145202 | src/sage/geometry/lattice_polytope.py: In NefPartition doctests, construct examples without using palp |
45edf72 | src/sage/geometry/lattice_polytope.py, src/sage/schemes/toric/fano_variety.py: Use unicode disjoint union symbol |
bfabd53 | src/sage/geometry/lattice_polytope.py: Fix typo |
0ac4959 | src/sage/features/databases.py (DatabaseReflexivePolytopes): New |
bb24865 | src/sage/geometry/lattice_polytope.py: Use PalpExecutable(executable).absolute_filename() |
4b58ad6 | src/sage/geometry/polyhedron/palp_database.py: Use PalpExecutable(executable).absolute_filename() |
Reviewer: Dima Pasechnik
Thank you!
Changed branch from u/dimpase/sage_geometry__use_palpexecutable______absolute_filename__ to 4b58ad6