NaturalHistoryMuseum / pylibdmtx

Read Data Matrix barcodes from Python 2 and 3.
MIT License
147 stars 56 forks source link

Avoid using deprecated `distutils` #90

Open DavidCain opened 1 year ago

DavidCain commented 1 year ago

This silences deprecations when running on Python 3.10 or newer:

The distutils package is deprecated and slated for removal in Python 3.12. Use setuptools or check PEP 632 for potential alternatives

The LooseVersion helper itself is very simple -- it splits on any . characters, tries to coerce to integers, and then otherwise just compares ordering. We could easily reproduce LooseVersion or choose to use another dependency like packaging, but there's an easy option available as well: just rely on the fact that libdmtx only releases numeric releases, and that we only need to check for older releases.

smartYSC commented 7 months ago

This needs to be handled now, because Python 3.12 removed distutils.

FYI: setuptools vendored it, so you could probably get away with using setuptools.version. But I would not pull in a runtime dependency for that.