Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Eliminate use of distutils.version.StrictVersion, use LooseVersion instead #4476

Merged
merged 6 commits into from Mar 13, 2024

Conversation

bartoldeman
Copy link
Contributor

@bartoldeman bartoldeman commented Mar 6, 2024

distutils was removed in Python 3.12. The only reason EasyBuild uses StrictVersion is that it orders beta/rc versions before the released version, unlike LooseVersion. E.g. 5.0.0-beta < 5.0.0 (but > for LooseVersion).

So a new method
is_prerelease(self, other, markers)
was added to LooseVersion to handle that particular case.

Addresses part of #3963

distutils was removed in Python 3.12. The only reason EasyBuild uses
StrictVersion is that it orders beta/rc versions before the released
version, unlike LooseVersion. E.g. 5.0.0-beta < 5.0.0 (but > for
LooseVersion).

So a new method
`is_earlier_or_prerelease(self, other, markers)`
was added to LooseVersion to handle that particular case.

Addresses part of easybuilders#3963
@bartoldeman bartoldeman added this to the 5.0 milestone Mar 6, 2024
In the end this is clearer because we also need to test against a
maximum version (but it is allowed to be a prerelease of that
maximum version, as per StrictVersion semantics!)
@bartoldeman
Copy link
Contributor Author

Note that recent Lmod (certainly >=8) doesn't seem to have had any rc versions. The only tmod applicable I can find is 4.0.0-beta. Perhaps we can safely ignore that too, in which case the alternative could be to simply use LooseVersion everywhere...

@bartoldeman bartoldeman added the EasyBuild-5.0 EasyBuild 5.0 label Mar 7, 2024
easybuild/tools/modules.py Outdated Show resolved Hide resolved
easybuild/tools/modules.py Outdated Show resolved Hide resolved
easybuild/tools/modules.py Outdated Show resolved Hide resolved
test/framework/modules.py Outdated Show resolved Hide resolved
test/framework/modules.py Outdated Show resolved Hide resolved
test/framework/modules.py Outdated Show resolved Hide resolved
test/framework/modules.py Outdated Show resolved Hide resolved
test/framework/modules.py Outdated Show resolved Hide resolved
Flip order of `is_prerelease` and version check for clarity.

Co-authored-by: Kenneth Hoste <kenneth.hoste@ugent.be>
Copy link
Member

@boegel boegel left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm

@boegel boegel merged commit 6203780 into easybuilders:5.0.x Mar 13, 2024
32 checks passed
@boegel boegel changed the title Eliminate use of distutils.version.StrictVersion Eliminate use of distutils.version.StrictVersion, use LooseVersion instead Mar 13, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
Status: Done
Development

Successfully merging this pull request may close these issues.

None yet

2 participants