mirror of
https://github.com/grahampugh/macadmin-scripts.git
synced 2025-12-17 17:56:33 +00:00
switch to pkg_resources
This commit is contained in:
parent
69ee37ae4e
commit
ed6654e778
@ -43,17 +43,14 @@ except ImportError:
|
|||||||
from xml.dom import minidom
|
from xml.dom import minidom
|
||||||
from xml.parsers.expat import ExpatError
|
from xml.parsers.expat import ExpatError
|
||||||
|
|
||||||
try:
|
from pkg_resources import parse_version as Version
|
||||||
from packaging.version import Version
|
|
||||||
except ImportError:
|
|
||||||
from distutils.version import LooseVersion as Version
|
|
||||||
|
|
||||||
try:
|
try:
|
||||||
import xattr
|
import xattr
|
||||||
except ImportError:
|
except ImportError:
|
||||||
print(
|
print(
|
||||||
"This tool requires the Python xattr and packaging modules. "
|
"This tool requires the Python xattr module. "
|
||||||
"Perhaps run `pip install xattr packaging` to install them."
|
"Perhaps run `pip install xattr` to install it."
|
||||||
)
|
)
|
||||||
sys.exit(-1)
|
sys.exit(-1)
|
||||||
|
|
||||||
@ -1136,10 +1133,10 @@ def main():
|
|||||||
valid_build_found is False
|
valid_build_found is False
|
||||||
and not args.build
|
and not args.build
|
||||||
and not args.current
|
and not args.current
|
||||||
and not args.validate
|
and args.validate
|
||||||
and not args.list
|
and not args.list
|
||||||
):
|
):
|
||||||
print("No valid build found for this hardware")
|
print("No valid build found for this computer")
|
||||||
exit(0)
|
exit(0)
|
||||||
|
|
||||||
# clear content directory in workdir if requested
|
# clear content directory in workdir if requested
|
||||||
@ -1162,23 +1159,21 @@ def main():
|
|||||||
except NameError:
|
except NameError:
|
||||||
print(
|
print(
|
||||||
"\n"
|
"\n"
|
||||||
"Build %s is not available. "
|
"A valid installer for build %s is not available for this computer. "
|
||||||
"Run again without --build argument "
|
"Run again without --build argument "
|
||||||
"to select a valid build to download "
|
"to select a valid build to download "
|
||||||
"or run without --validate option to download anyway.\n" % args.build
|
"or run without --validate option to download anyway.\n" % args.build
|
||||||
)
|
)
|
||||||
exit(0)
|
exit(0)
|
||||||
else:
|
else:
|
||||||
print(
|
print("\n" "Build %s valid. Downloading #%s...\n" % (args.build, answer))
|
||||||
"\n" "Build %s available. Downloading #%s...\n" % (args.build, answer)
|
|
||||||
)
|
|
||||||
elif args.current:
|
elif args.current:
|
||||||
try:
|
try:
|
||||||
answer
|
answer
|
||||||
except NameError:
|
except NameError:
|
||||||
print(
|
print(
|
||||||
"\n"
|
"\n"
|
||||||
"Build %s is not available. "
|
"A valid installer for build %s is not available for this computer. "
|
||||||
"Run again without --current argument "
|
"Run again without --current argument "
|
||||||
"to select a valid build to download.\n" % build_info[0]
|
"to select a valid build to download.\n" % build_info[0]
|
||||||
)
|
)
|
||||||
@ -1226,7 +1221,7 @@ def main():
|
|||||||
except NameError:
|
except NameError:
|
||||||
print(
|
print(
|
||||||
"\n"
|
"\n"
|
||||||
"Version %s is not available. "
|
"A valid installer for version %s is not available for this computer. "
|
||||||
"Run again without --version argument "
|
"Run again without --version argument "
|
||||||
"to select a valid build to download.\n" % args.version
|
"to select a valid build to download.\n" % args.version
|
||||||
)
|
)
|
||||||
@ -1242,7 +1237,7 @@ def main():
|
|||||||
except NameError:
|
except NameError:
|
||||||
print(
|
print(
|
||||||
"\n"
|
"\n"
|
||||||
"OS %s is not available. "
|
"A valid installer for OS %s is not available for this computer. "
|
||||||
"Run again without --os argument "
|
"Run again without --os argument "
|
||||||
"to select a valid build to download.\n" % args.os
|
"to select a valid build to download.\n" % args.os
|
||||||
)
|
)
|
||||||
@ -1258,7 +1253,7 @@ def main():
|
|||||||
except NameError:
|
except NameError:
|
||||||
print(
|
print(
|
||||||
"\n"
|
"\n"
|
||||||
"No valid version available. "
|
"No valid version available for this computer. "
|
||||||
"Run again without --auto argument "
|
"Run again without --auto argument "
|
||||||
"to select a valid build to download.\n"
|
"to select a valid build to download.\n"
|
||||||
)
|
)
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user