Refactor `distutils.version.LooseVersion` and distutils.version.StrictVersion` to `packaging.version.Version`
Categories
(Firefox Build System :: Mach Core, task, P3)
Tracking
(firefox105 fixed)
Tracking | Status | |
---|---|---|
firefox105 | --- | fixed |
People
(Reporter: ahochheiden, Assigned: ahochheiden)
References
Details
Attachments
(3 files, 2 obsolete files)
As outlined in Bug 1743785, this is a "sub-bug" for the refactoring/removal of distutils
, specifically for LooseVersion
and StrictVersion
.
Assignee | ||
Comment 1•2 years ago
•
|
||
All "versions" should now be Version objects and they can no longer be
compared against hard-coded strings. As such, all hard-coded are also
constructed into Version objects so that they can be compared..
I also removed the Version class that inherited from LooseVersion in
configure/util.py. The resulting difference is that 'patch' is no
longer an available attribute, it is now called 'micro'. I did this for
the sake of consistency (Everything following the same naming convention
found in packaging.version.Version).
In packaging.version there is also a LegacyVersion which is less
strict, similar to LooseVersion. I chose not to use this at all since
it is already deprecated and is slated for removal. Comparing a
LegacyVersion against a Version always results in the
LegacyVersion object being less, which is not intuitive and can
cause unexpected behavior.
Assignee | ||
Comment 2•2 years ago
|
||
I was not able to come up with a way to get esr
versions to work with packaging.version.Version
. As per PEP440 esr
is not a valid version
component. Maybe there's an obvious workaround I'm not seeing, but for now I've left mozrelease/version.py
and release/update-verify-config-creator.py
unchanged.
Updated•2 years ago
|
Assignee | ||
Comment 3•2 years ago
|
||
This will be used to replace the LooseVersion
within distutils
.
StrictVersion
from distutils
will need something else, as swapping
usages of StrictVersion
with LooseVersion
does not result in the
desired behavior.
Assignee | ||
Comment 4•2 years ago
|
||
Depends on D151062
Assignee | ||
Comment 5•2 years ago
|
||
Depends on D151063
Assignee | ||
Comment 6•2 years ago
|
||
Some minor tweaking to the logic in MozillaVersionCompareMixin
was
necessary to get comparisons between LooseVersion
and Version
with
esr
suffixes working as desired.
Comment 8•2 years ago
|
||
bugherder |
Comment 10•2 years ago
|
||
Comment 11•2 years ago
|
||
bugherder |
Comment 12•2 years ago
|
||
bugherder |
Updated•1 year ago
|
Description
•