munki / macadmin-scripts

Scripts of possible interest to macOS admins
Other
2.33k stars 523 forks source link

distutils removal coming in python 3.12 #105

Closed grahampugh closed 2 years ago

grahampugh commented 2 years ago

Just a heads up, in case not already known:

/Library/Management/erase-install/installinstallmacos.py:45: DeprecationWarning: The distutils package is deprecated and slated for removal in Python 3.12. Use setuptools or check PEP 632 for potential alternatives
  from distutils.version import LooseVersion

(this is from my fork, so the line number is different, but the output will be the same).

grahampugh commented 2 years ago

Oops, silly me. distutils is only in my fork! Sorry, nothing to see here.

gregneagle commented 2 years ago

That's what you get for sorting versions.

grahampugh commented 2 years ago

Looks like it's working with a minimal change:

try:
    from packaging.version import Version
except ImportError:
    from distutils.version import LooseVersion as Version

(I just have to add packaging to my relocatable-python).