easybuild-framework
easybuild-framework copied to clipboard
Consider migrating from `LooseVersion` to `packaging.version.Version`
trafficstars
The official replacement for distutils.LooseVersion (the code for which we ingested into EasyBuild) is packaging.version.LooseVersion. Unfortunately, it's currently a third-party package. Of course, we could always do the same as what we did with LooseVersion, and duplicate the necessary code in EasyBuild...
From a quick look, there are some differences in behaviour:
- unable to compare a Version object against a string (so need to use e.g.
Version(X) >= Version(Y)instead ofLooseVersion(x) >= Y) - stripping "superfluous" zeros in version numbers (e.g.
Version('8.02') == Version('8.2')) - better parsing and handling of pre-/post releases etc (e.g.
Version('2.0.beta1') < Version('2.0')) - more intuitive handling of a leading 'v' in versions (e.g.
Version('2.0') > Version('v1.0')) - flat rejecting some "invalid" versions (e.g.
Version('w1.0')orVersion('1.')) (probably not an exhaustive list)
Largely, I would say the behaviour is more intuitive, but would certainly require a careful look through easyblocks if we did transition to it.