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

packaging.version related changes: chatch the proper exception and switch the priority #3383

Merged
merged 3 commits into from
Oct 16, 2023
Merged
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
38 changes: 29 additions & 9 deletions sos/utilities.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,9 +23,9 @@
from collections import deque

try:
from pkg_resources import parse_version as version_parse
except SyntaxError:
from packaging.version import parse as version_parse
from packaging.version import parse as parse_version
except ImportError:
from pkg_resources import parse_version

# try loading magic>=0.4.20 which implements detect_from_filename method
magic_mod = False
Expand All @@ -46,6 +46,32 @@

TIMEOUT_DEFAULT = 300

__all__ = [
'TIMEOUT_DEFAULT',
'ImporterHelper',
'SoSTimeoutError',
'TempFileUtil',
'bold',
'file_is_binary',
'fileobj',
'find',
'get_human_readable',
'grep',
'import_module',
'is_executable',
'listdir',
'parse_version',
'path_exists',
'path_isdir',
'path_isfile',
'path_islink',
'path_join',
'recursive_dict_values_by_key',
'shell_out',
'sos_get_command_output',
'tail',
]


def tail(filename, number_of_bytes):
"""Returns the last number_of_bytes of filename"""
Expand Down Expand Up @@ -413,12 +439,6 @@ def recursive_dict_values_by_key(dobj, keys=[]):
return [d for d in _items if d not in _filt]


def parse_version(version):
"""Parse the version string
"""
return version_parse(version)


class FakeReader():
"""Used as a replacement AsyncReader for when we are writing directly to
disk, and allows us to keep more simplified flows for executing,
Expand Down