Skip to content

Commit

Permalink
sagemathgh-37312: sage.plot.animate: Use FFmpeg.absolute_filename; …
Browse files Browse the repository at this point in the history
…`sage.features`: Remove deprecated methods

    
<!-- ^^^^^
Please provide a concise, informative and self-explanatory title.
Don't put issue numbers in there, do this in the PR body below.
For example, instead of "Fixes sagemath#1234" use "Introduce new method to
calculate 1+1"
-->
<!-- Describe your changes here in detail -->

<!-- Why is this change required? What problem does it solve? -->
<!-- If this PR resolves an open issue, please link to it here. For
example "Fixes sagemath#12345". -->
- Fixes sagemath#35255

Removes methods deprecated in:
- sagemath#31292 (2022)
- sagemath#33114 (2022)
<!-- If your change requires a documentation PR, please link it
appropriately. -->

### 📝 Checklist

<!-- Put an `x` in all the boxes that apply. -->
<!-- If your change requires a documentation PR, please link it
appropriately -->
<!-- If you're unsure about any of these, don't hesitate to ask. We're
here to help! -->
<!-- Feel free to remove irrelevant items. -->

- [x] The title is concise, informative, and self-explanatory.
- [ ] The description explains in detail what this PR is about.
- [x] I have linked a relevant issue or discussion.
- [ ] I have created tests covering the changes.
- [ ] I have updated the documentation accordingly.

### ⌛ Dependencies

<!-- List all open PRs that this PR logically depends on
- sagemath#12345: short description why this is a dependency
- sagemath#34567: ...
-->

<!-- If you're unsure about any of these, don't hesitate to ask. We're
here to help! -->
    
URL: sagemath#37312
Reported by: Matthias Köppe
Reviewer(s): Kwankyu Lee
  • Loading branch information
Release Manager committed Jun 16, 2024
2 parents e69245c + 6b7cf25 commit 8110dc5
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 60 deletions.
30 changes: 2 additions & 28 deletions src/sage/features/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -606,7 +606,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 @@ -654,32 +654,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 @@ -764,7 +738,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 @@ -98,36 +98,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 @@ -1023,8 +1023,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

0 comments on commit 8110dc5

Please sign in to comment.