Skip to content

Conversation

@tobiasjaster
Copy link

Due to PEP 632 distutils is deprecated in Python3.10 and Python3.11 and is removed with Python3.12

Summary of changes

Added import switches between older python version (<3.10) and newer python version for downward compatibility

distutils.spawn.find_executable will be replaced by shutil.which
distutils.version.LooseVersion will be replaced by packaging.version.Version

affected files:
tools/toolchains/mbed_toolchain.py
tools/toolchains/arm.py
tools/toolchains/gcc.py
tools/toolchains/iar.py

Impact of changes

For python versions < 3.9 nothing should change, for the newer versions the "Version" of the packaging module could possibly throw errors that were previously accepted.

Migration actions required

Documentation

None


Pull request type

[X] Patch update (Bug fix / Target update / Docs update / Test update / Refactor)
[] Feature update (New feature / Functionality change / New API)
[] Major update (Breaking change E.g. Return code change / API behaviour change)

Test results

[] No Tests required for this change (E.g docs only update)
[X] Covered by existing mbed-os tests (Greentea or Unittest)
[] Tests / results supplied as part of this PR

Reviewers


0xc0170
0xc0170 previously approved these changes May 27, 2024
@0xc0170
Copy link
Contributor

0xc0170 commented May 27, 2024

There's build error:

[2024-05-27T12:58:01.058Z] + python -u ../mbed-os/tools/test/examples/examples.py -c ./examples.json clone

[2024-05-27T12:58:01.058Z] Traceback (most recent call last):

[2024-05-27T12:58:01.058Z]   File "../mbed-os/tools/test/examples/examples.py", line 37, in <module>

[2024-05-27T12:58:01.058Z]     from tools.build_api import get_mbed_official_release

[2024-05-27T12:58:01.058Z]   File "/builds/workspace/mbed-os-ci_PR-15517/mbed-os/tools/build_api.py", line 49, in <module>

[2024-05-27T12:58:01.058Z]     from .toolchains import TOOLCHAIN_CLASSES, TOOLCHAIN_PATHS

[2024-05-27T12:58:01.058Z]   File "/builds/workspace/mbed-os-ci_PR-15517/mbed-os/tools/toolchains/__init__.py", line 20, in <module>

[2024-05-27T12:58:01.058Z]     from . import mbed_toolchain, arm, gcc, iar

[2024-05-27T12:58:01.058Z]   File "/builds/workspace/mbed-os-ci_PR-15517/mbed-os/tools/toolchains/gcc.py", line 34

[2024-05-27T12:58:01.058Z]     from distutils.version import LooseVersion as Version 

[2024-05-27T12:58:01.058Z]                                                          ^

[2024-05-27T12:58:01.058Z] IndentationError: unindent does not match any outer indentation level

Please review

@0xc0170 0xc0170 added the release-type: patch Indentifies a PR as containing just a patch label May 27, 2024
@mergify mergify bot dismissed 0xc0170’s stale review May 27, 2024 19:40

Pull request has been modified.

@tobiasjaster tobiasjaster requested a review from 0xc0170 May 27, 2024 19:53
@tobiasjaster
Copy link
Author

tobiasjaster commented May 28, 2024

Shit, I Just recognize, the mbed Tools are Frozen since 6.2, so I cant modify them. That means, this PR never can be merged, right?

@0xc0170
Copy link
Contributor

0xc0170 commented Jun 8, 2024

Shit, I Just recognize, the mbed Tools are Frozen since 6.2, so I cant modify them. That means, this PR never can be merged, right?

Tools are not maintained anymore unfortunately. If this is not something critical, I would leave it as it is.

@tobiasjaster
Copy link
Author

tobiasjaster commented Jun 8, 2024

I thought so too, but on the other hand the question should be asked whether Python 3.7 is still a suitable version for testing and building. After all, there have been no more security updates for Python 3.7 since July 2023. Not switching to a newer Python version might be critical enough.

Due to PEP 632 distutils is deprecated in Python3.10 and Python3.11 and is removed with Python3.12
@tobiasjaster
Copy link
Author

tobiasjaster commented Jun 12, 2024

For upgrading tests with matrix of all python versions (https://github.com/tobiasjaster/mbed-os/actions/runs/9439299286) first PR on mbed-os-tools (ARMmbed/mbed-os-tools#290) needs to be merged!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

needs: work release-type: patch Indentifies a PR as containing just a patch

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants