diff --git a/src/sage/geometry/lattice_polytope.py b/src/sage/geometry/lattice_polytope.py index 9d2e434ceb2..00d95c86285 100644 --- a/src/sage/geometry/lattice_polytope.py +++ b/src/sage/geometry/lattice_polytope.py @@ -117,6 +117,7 @@ from sage.misc.lazy_import import lazy_import from sage.features import PythonModule +from sage.features.palp import PalpExecutable lazy_import('ppl', ['C_Polyhedron', 'Generator_System', 'Linear_Expression'], feature=PythonModule("ppl", spkg="pplpy")) lazy_import('ppl', 'point', as_='PPL_point', @@ -146,6 +147,7 @@ from collections.abc import Hashable from copyreg import constructor as copyreg_constructor import os +import shlex from subprocess import Popen, PIPE from warnings import warn from functools import reduce @@ -5105,6 +5107,11 @@ def _palp(command, polytopes, reduce_dimension=False): if _palp_dimension is not None: dot = command.find(".") command = command[:dot] + "-%dd" % _palp_dimension + command[dot:] + executable, args = command.split(" ", 1) + if executable.endswith('.x'): + executable = executable[:-2] + executable = PalpExecutable(executable).absolute_filename() + command = " ".join([shlex.quote(executable), args]) input_file_name = tmp_filename() input_file = open(input_file_name, "w") for p in polytopes: diff --git a/src/sage/geometry/polyhedron/palp_database.py b/src/sage/geometry/polyhedron/palp_database.py index 873e6d290cc..70864270966 100644 --- a/src/sage/geometry/polyhedron/palp_database.py +++ b/src/sage/geometry/polyhedron/palp_database.py @@ -35,6 +35,7 @@ from sage.structure.sage_object import SageObject from sage.rings.integer_ring import ZZ +from sage.features.palp import PalpExecutable from sage.interfaces.process import terminate @@ -134,7 +135,7 @@ def _palp_Popen(self): <...Popen...> """ - return Popen(["class.x", "-b2a", "-di", self._data_basename], + return Popen([PalpExecutable("class").absolute_filename(), "-b2a", "-di", self._data_basename], stdout=PIPE, encoding='utf-8', errors='surrogateescape') def _read_vertices(self, stdout, rows, cols): @@ -459,7 +460,7 @@ def _palp_Popen(self): <...Popen...> """ - return Popen(['class-4d.x', '-He', + return Popen([PalpExecutable('class-4d').absolute_filename(), '-He', 'H{}:{}L100000000'.format(self._h21, self._h11), '-di', self._data_basename], stdout=PIPE, encoding='utf-8', errors='surrogateescape')