codemagic-ci-cd / cli-tools

Various utilities to managing Android and iOS app builds, code signing, and deployment.
https://codemagic.io/start/
GNU General Public License v3.0
235 stars 39 forks source link

Remove `distutils.version.LooseVersion` usages #370

Closed priitlatt closed 8 months ago

priitlatt commented 8 months ago

Description

PEP-632 deprecated distutils module in Python 3.10, and starting from 3.12 it is not included in standard library any more.

CLI tools used LooseVersion from distutils.version for version number comparisons in number of places and now related imports are broken on Python 3.12 unless distutils is manually installed on the system.

To overcome that issue, use PEP-440 compliant version handling layer from packaging library by PyPA:

from packaging.version import Version

which, for our use-cases, is a drop-in replacement for LooseVersion.

The changes induce backwards-incompatibility in two places for Python API:

Dependencies

No new dependencies are required as packaging was added already in #306.