mirror of
https://github.com/grahampugh/macadmin-scripts.git
synced 2025-12-17 17:56:33 +00:00
Allow for removal of distutils in a future python
This commit is contained in:
parent
52dff56ad5
commit
8b2f2c58b9
@ -42,14 +42,18 @@ except ImportError:
|
||||
from urlparse import urlsplit
|
||||
from xml.dom import minidom
|
||||
from xml.parsers.expat import ExpatError
|
||||
from distutils.version import LooseVersion
|
||||
|
||||
try:
|
||||
from packaging.version import Version
|
||||
except ImportError:
|
||||
from distutils.version import LooseVersion as Version
|
||||
|
||||
try:
|
||||
import xattr
|
||||
except ImportError:
|
||||
print(
|
||||
"This tool requires the Python xattr module. "
|
||||
"Perhaps run `pip install xattr` to install it."
|
||||
"This tool requires the Python xattr and packaging modules. "
|
||||
"Perhaps run `pip install xattr packaging` to install them."
|
||||
)
|
||||
sys.exit(-1)
|
||||
|
||||
@ -698,7 +702,7 @@ def os_installer_product_info(
|
||||
def get_latest_version(current_item, latest_item):
|
||||
"""Compares versions between two values and returns the latest (highest) value"""
|
||||
try:
|
||||
if LooseVersion(current_item) > LooseVersion(latest_item):
|
||||
if Version(current_item) > Version(latest_item):
|
||||
return current_item
|
||||
else:
|
||||
return latest_item
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user