Skip to content

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
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.

@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 force-pushed the refactor/show_versions branch from bfeea0c to 1e4b338 Compare May 12, 2024 07:00
@seisman seisman requested a review from a team May 17, 2024 02:49
@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
@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.

3 participants