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

pygmt.show_versions: Warn about incompatible ghostscript versions #3244

Merged
merged 9 commits into from May 18, 2024

Conversation

seisman
Copy link
Member

@seisman seisman commented May 11, 2024

Description of proposed changes

  1. Add a private function _get_clib_info to return the dictionary of GMT library information
  2. Refactor _get_ghostscript_version using match-case statement
  3. Add a private function _check_ghostscript_version which return warnings if the installed ghostscript version is problematic
  4. Store the output in a list and print it, rather than calling print multiple times.

Address #3242

@seisman seisman force-pushed the refactor/show_versions branch 4 times, most recently from 3142190 to 4ed07fa Compare May 11, 2024 12:24
@@ -110,8 +113,18 @@ def show_versions(file=sys.stdout):
import subprocess

from packaging.requirements import Requirement
from packaging.version import Version

def _get_clib_info() -> dict:
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The pygmt.print_clib_info function was initially added in #176 but has been replaced by pygmt.show_versions in #466 (first appear in v0.1.2).

In this PR, a new private function _get_clib_info is added which returns a dictionary instead of printing a long string.

It's time to retire the print_clib_info function. Since it's rarely used, I think we can just remove it without a deprecation warning. Of course, we should do it in a separate PR so that at least we have a deprecation entry in the v0.13.0 changelog.

pygmt/__init__.py Outdated Show resolved Hide resolved
pygmt/__init__.py Outdated Show resolved Hide resolved
@seisman seisman added enhancement Improving an existing feature needs review This PR has higher priority and needs review. labels May 12, 2024
@seisman seisman added this to the 0.13.0 milestone May 12, 2024
@seisman seisman requested a review from a team May 17, 2024 02:49
pygmt/__init__.py Outdated Show resolved Hide resolved
seisman and others added 2 commits May 18, 2024 16:38
Co-authored-by: Yvonne Fröhlich <94163266+yvonnefroehlich@users.noreply.github.com>
@seisman seisman removed the needs review This PR has higher priority and needs review. label May 18, 2024
@seisman seisman merged commit e02e501 into main May 18, 2024
14 of 19 checks passed
@seisman seisman deleted the refactor/show_versions branch May 18, 2024 10:53
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement Improving an existing feature
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants