Skip to content

Inline the usage of distutils to mitigate the issue caused by removal#513

Merged
AllyW merged 2 commits intoAzure:devfrom
ReaNAiveD:mitigate-distutils
Mar 20, 2025
Merged

Inline the usage of distutils to mitigate the issue caused by removal#513
AllyW merged 2 commits intoAzure:devfrom
ReaNAiveD:mitigate-distutils

Conversation

@ReaNAiveD
Copy link
Copy Markdown
Member

@ReaNAiveD ReaNAiveD commented Mar 20, 2025

distutils is removed from Python 3.12. Try inline the import of it to mitigate the issue it caused

image

  File "/mnt/vss/_work/1/s/env/lib/python3.12/site-packages/azdev/operations/pypi.py", line 11, in <module>
    from distutils.version import LooseVersion  # pylint:disable=import-error,no-name-in-module,deprecated-module
    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
ModuleNotFoundError: No module named 'distutils'

@ReaNAiveD ReaNAiveD requested review from AllyW and Copilot March 20, 2025 05:18
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

This PR addresses the removal of the global distutils.version import by inlining its usage where needed in the pypi operations and bumps the package version.

  • Inlines the import of LooseVersion from distutils.version within the _compare_module_against_pypi function to mitigate removal issues.
  • Updates the package version from 0.1.97 to 0.1.98.

Reviewed Changes

Copilot reviewed 2 out of 3 changed files in this pull request and generated no comments.

File Description
azdev/operations/pypi.py Inlines the distutils.version import inside a function call.
azdev/init.py Updates the module version to reflect the latest changes.
Files not reviewed (1)
  • HISTORY.rst: Language not supported

@ReaNAiveD ReaNAiveD self-assigned this Mar 20, 2025
@AllyW
Copy link
Copy Markdown
Contributor

AllyW commented Mar 20, 2025

distutils is required in azdev cli check-versions which now is not used neither in cli main repo nor in cli extension repo.

If azdev cli check-versions is required, we need to migrate its distutils usages. If azdev cli check-versions is no longer needed, please remember to remove it.

@AllyW
Copy link
Copy Markdown
Contributor

AllyW commented Mar 20, 2025

image

@AllyW AllyW merged commit def5b59 into Azure:dev Mar 20, 2025
25 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants