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.plot.animate: Use FFmpeg.absolute_filename; sage.features: Remove deprecated methods #37312

Merged
merged 4 commits into from
Jun 22, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
30 changes: 2 additions & 28 deletions src/sage/features/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -605,7 +605,7 @@ class FileFeature(Feature):
To work with the file described by the feature, use the method :meth:`absolute_filename`.
A :class:`FeatureNotPresentError` is raised if the file cannot be found::

sage: Executable(name="does-not-exist", executable="does-not-exist-xxxxyxyyxyy").absolute_path()
sage: Executable(name="does-not-exist", executable="does-not-exist-xxxxyxyyxyy").absolute_filename()
Traceback (most recent call last):
...
sage.features.FeatureNotPresentError: does-not-exist is not available.
Expand Down Expand Up @@ -653,32 +653,6 @@ def absolute_filename(self) -> str:
# the distribution sagemath-environment.
raise NotImplementedError

def absolute_path(self):
r"""
Deprecated alias for :meth:`absolute_filename`.

Deprecated to make way for a method of this name returning a ``Path``.

EXAMPLES::

sage: from sage.features import Executable
sage: Executable(name="sh", executable="sh").absolute_path()
doctest:warning...
DeprecationWarning: method absolute_path has been replaced by absolute_filename
See https://github.com/sagemath/sage/issues/31292 for details.
'/...bin/sh'
"""
try:
from sage.misc.superseded import deprecation
except ImportError:
# The import can fail because sage.misc.superseded is provided by
# the distribution sagemath-objects, which is not an
# install-requires of the distribution sagemath-environment.
pass
else:
deprecation(31292, 'method absolute_path has been replaced by absolute_filename')
return self.absolute_filename()


class Executable(FileFeature):
r"""
Expand Down Expand Up @@ -763,7 +737,7 @@ def absolute_filename(self) -> str:

A :class:`FeatureNotPresentError` is raised if the file cannot be found::

sage: Executable(name="does-not-exist", executable="does-not-exist-xxxxyxyyxyy").absolute_path()
sage: Executable(name="does-not-exist", executable="does-not-exist-xxxxyxyyxyy").absolute_filename()
Traceback (most recent call last):
...
sage.features.FeatureNotPresentError: does-not-exist is not available.
Expand Down
30 changes: 0 additions & 30 deletions src/sage/features/join_feature.py
Original file line number Diff line number Diff line change
Expand Up @@ -97,36 +97,6 @@ def _is_present(self):
return test
return FeatureTestResult(self, True)

def is_functional(self):
r"""
Test whether the join feature is functional.

This method is deprecated. Use :meth:`Feature.is_present` instead.

EXAMPLES::

sage: from sage.features.latte import Latte
sage: Latte().is_functional() # optional - latte_int
doctest:warning...
DeprecationWarning: method JoinFeature.is_functional; use is_present instead
See https://github.com/sagemath/sage/issues/33114 for details.
FeatureTestResult('latte_int', True)
"""
try:
from sage.misc.superseded import deprecation
except ImportError:
# The import can fail because sage.misc.superseded is provided by
# the distribution sagemath-objects, which is not an
# install-requires of the distribution sagemath-environment.
pass
else:
deprecation(33114, 'method JoinFeature.is_functional; use is_present instead')
for f in self._features:
test = f.is_functional()
if not test:
return test
return FeatureTestResult(self, True)

def hide(self):
r"""
Hide this feature and all its joined features.
Expand Down
5 changes: 3 additions & 2 deletions src/sage/plot/animate.py
Original file line number Diff line number Diff line change
Expand Up @@ -1024,8 +1024,9 @@ def ffmpeg(self, savefile=None, show_path=False, output_format=None,
# afterwards. Hence 'early_options' and 'ffmpeg_options'
# The `-nostdin` is needed to avoid the command to hang, see
# https://stackoverflow.com/questions/16523746/ffmpeg-hangs-when-run-in-background
cmd = 'cd {}; ffmpeg -nostdin -y -f image2 {} -i {} {} {}'.format(
shlex.quote(pngdir), early_options, shlex.quote(pngs), ffmpeg_options, shlex.quote(savefile))
cmd = 'cd {}; {} -nostdin -y -f image2 {} -i {} {} {}'.format(
shlex.quote(pngdir), shlex.quote(FFmpeg().absolute_filename()),
early_options, shlex.quote(pngs), ffmpeg_options, shlex.quote(savefile))
from subprocess import check_call, CalledProcessError, PIPE
try:
if sage.misc.verbose.get_verbose() > 0:
Expand Down
Loading