Skip to content

Replace usage of deprecated distutils.(file|dir)_util #10530

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

Merged
merged 1 commit into from
Apr 29, 2025

Conversation

bowiechen
Copy link
Contributor

Summary:
X-link: facebook/FAI-PEP#543

distutils has been deprecated since Python 3.10, and removed in Python 3.12.

Existing usage will now raise the following error under Python 3.12+:

ModuleNotFoundError: No module named 'distutils'

This diff replaces distutils usage according to PEP-632 migration advice.


I generated this diff by looking for all usages of distutils.*copy_(tree|file) and replaced them with shutil.copy(tree|file). These should be close to drop-in replacements!

Differential Revision: D73804939

@bowiechen bowiechen requested a review from mergennachin as a code owner April 28, 2025 21:30
Copy link

pytorch-bot bot commented Apr 28, 2025

🔗 Helpful Links

🧪 See artifacts and rendered test results at hud.pytorch.org/pr/pytorch/executorch/10530

Note: Links to docs will display an error until the docs builds have been completed.

⏳ No Failures, 6 Pending

As of commit 5a6ae1f with merge base 0ea7c11 (image):
💚 Looks good so far! There are no failures yet. 💚

This comment was automatically generated by Dr. CI and updates every 15 minutes.

@facebook-github-bot facebook-github-bot added the CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed. label Apr 28, 2025
@facebook-github-bot
Copy link
Contributor

This pull request was exported from Phabricator. Differential Revision: D73804939

@bowiechen
Copy link
Contributor Author

@pytorchbot label "topic: not user facing"

bowiechen added a commit to bowiechen/executorch that referenced this pull request Apr 28, 2025
Summary:

X-link: facebook/FAI-PEP#543

`distutils` has been deprecated since Python 3.10, and [removed in Python 3.12](https://docs.python.org/3/whatsnew/3.12.html#distutils).

Existing usage will now raise the following error under Python 3.12+:

```
ModuleNotFoundError: No module named 'distutils'
```

This diff replaces `distutils` usage according to [PEP-632 migration advice](https://peps.python.org/pep-0632/#migration-advice).

---

I generated this diff by looking for all usages of `distutils.*copy_(tree|file)` and replaced them with `shutil.copy(tree|file)`. These should be close to drop-in replacements!

Reviewed By: itamaro, mergennachin

Differential Revision: D73804939
@facebook-github-bot
Copy link
Contributor

This pull request was exported from Phabricator. Differential Revision: D73804939

bowiechen added a commit to bowiechen/FAI-PEP that referenced this pull request Apr 28, 2025
Summary:
X-link: pytorch/executorch#10530


`distutils` has been deprecated since Python 3.10, and [removed in Python 3.12](https://docs.python.org/3/whatsnew/3.12.html#distutils).

Existing usage will now raise the following error under Python 3.12+:

```
ModuleNotFoundError: No module named 'distutils'
```

This diff replaces `distutils` usage according to [PEP-632 migration advice](https://peps.python.org/pep-0632/#migration-advice).

---

I generated this diff by looking for all usages of `distutils.*copy_(tree|file)` and replaced them with `shutil.copy(tree|file)`. These should be close to drop-in replacements!

Reviewed By: itamaro, mergennachin

Differential Revision: D73804939
bowiechen added a commit to bowiechen/FAI-PEP that referenced this pull request Apr 28, 2025
Summary:
X-link: pytorch/executorch#10530


`distutils` has been deprecated since Python 3.10, and [removed in Python 3.12](https://docs.python.org/3/whatsnew/3.12.html#distutils).

Existing usage will now raise the following error under Python 3.12+:

```
ModuleNotFoundError: No module named 'distutils'
```

This diff replaces `distutils` usage according to [PEP-632 migration advice](https://peps.python.org/pep-0632/#migration-advice).

---

I generated this diff by looking for all usages of `distutils.*copy_(tree|file)` and replaced them with `shutil.copy(tree|file)`. These should be close to drop-in replacements!

Reviewed By: itamaro, mergennachin

Differential Revision: D73804939
bowiechen added a commit to bowiechen/FAI-PEP that referenced this pull request Apr 28, 2025
Summary:
X-link: pytorch/executorch#10530

Pull Request resolved: facebook#543

`distutils` has been deprecated since Python 3.10, and [removed in Python 3.12](https://docs.python.org/3/whatsnew/3.12.html#distutils).

Existing usage will now raise the following error under Python 3.12+:

```
ModuleNotFoundError: No module named 'distutils'
```

This diff replaces `distutils` usage according to [PEP-632 migration advice](https://peps.python.org/pep-0632/#migration-advice).

 ---

I generated this diff by looking for all usages of `distutils.*copy_(tree|file)` and replaced them with `shutil.copy(tree|file)`. These should be close to drop-in replacements!

Reviewed By: itamaro, mergennachin

Differential Revision: D73804939
bowiechen added a commit to bowiechen/FAI-PEP that referenced this pull request Apr 28, 2025
Summary:
X-link: pytorch/executorch#10530

Pull Request resolved: facebook#543

`distutils` has been deprecated since Python 3.10, and [removed in Python 3.12](https://docs.python.org/3/whatsnew/3.12.html#distutils).

Existing usage will now raise the following error under Python 3.12+:

```
ModuleNotFoundError: No module named 'distutils'
```

This diff replaces `distutils` usage according to [PEP-632 migration advice](https://peps.python.org/pep-0632/#migration-advice).

 ---

I generated this diff by looking for all usages of `distutils.*copy_(tree|file)` and replaced them with `shutil.copy(tree|file)`. These should be close to drop-in replacements!

Reviewed By: itamaro, mergennachin

Differential Revision: D73804939
bowiechen added a commit to bowiechen/executorch that referenced this pull request Apr 28, 2025
Summary:

X-link: facebook/FAI-PEP#543

`distutils` has been deprecated since Python 3.10, and [removed in Python 3.12](https://docs.python.org/3/whatsnew/3.12.html#distutils).

Existing usage will now raise the following error under Python 3.12+:

```
ModuleNotFoundError: No module named 'distutils'
```

This diff replaces `distutils` usage according to [PEP-632 migration advice](https://peps.python.org/pep-0632/#migration-advice).

---

I generated this diff by looking for all usages of `distutils.*copy_(tree|file)` and replaced them with `shutil.copy(tree|file)`. These should be close to drop-in replacements!

Reviewed By: itamaro, mergennachin

Differential Revision: D73804939
bowiechen added a commit to bowiechen/FAI-PEP that referenced this pull request Apr 28, 2025
Summary:
X-link: pytorch/executorch#10530


`distutils` has been deprecated since Python 3.10, and [removed in Python 3.12](https://docs.python.org/3/whatsnew/3.12.html#distutils).

Existing usage will now raise the following error under Python 3.12+:

```
ModuleNotFoundError: No module named 'distutils'
```

This diff replaces `distutils` usage according to [PEP-632 migration advice](https://peps.python.org/pep-0632/#migration-advice).

---

I generated this diff by looking for all usages of `distutils.*copy_(tree|file)` and replaced them with `shutil.copy(tree|file)`. These should be close to drop-in replacements!

Reviewed By: itamaro, mergennachin

Differential Revision: D73804939
bowiechen added a commit to bowiechen/FAI-PEP that referenced this pull request Apr 28, 2025
Summary:
X-link: pytorch/executorch#10530

Pull Request resolved: facebook#543

`distutils` has been deprecated since Python 3.10, and [removed in Python 3.12](https://docs.python.org/3/whatsnew/3.12.html#distutils).

Existing usage will now raise the following error under Python 3.12+:

```
ModuleNotFoundError: No module named 'distutils'
```

This diff replaces `distutils` usage according to [PEP-632 migration advice](https://peps.python.org/pep-0632/#migration-advice).

 ---

I generated this diff by looking for all usages of `distutils.*copy_(tree|file)` and replaced them with `shutil.copy(tree|file)`. These should be close to drop-in replacements!

Reviewed By: itamaro, mergennachin

Differential Revision: D73804939
@facebook-github-bot
Copy link
Contributor

This pull request was exported from Phabricator. Differential Revision: D73804939

bowiechen added a commit to bowiechen/executorch that referenced this pull request Apr 28, 2025
Summary:
Pull Request resolved: pytorch#10530

X-link: facebook/FAI-PEP#543

`distutils` has been deprecated since Python 3.10, and [removed in Python 3.12](https://docs.python.org/3/whatsnew/3.12.html#distutils).

Existing usage will now raise the following error under Python 3.12+:

```
ModuleNotFoundError: No module named 'distutils'
```

This diff replaces `distutils` usage according to [PEP-632 migration advice](https://peps.python.org/pep-0632/#migration-advice).

 ---

I generated this diff by looking for all usages of `distutils.*copy_(tree|file)` and replaced them with `shutil.copy(tree|file)`. These should be close to drop-in replacements!

Reviewed By: itamaro, mergennachin

Differential Revision: D73804939
@facebook-github-bot
Copy link
Contributor

This pull request was exported from Phabricator. Differential Revision: D73804939

bowiechen added a commit to bowiechen/executorch that referenced this pull request Apr 28, 2025
Summary:

X-link: facebook/FAI-PEP#543

`distutils` has been deprecated since Python 3.10, and [removed in Python 3.12](https://docs.python.org/3/whatsnew/3.12.html#distutils).

Existing usage will now raise the following error under Python 3.12+:

```
ModuleNotFoundError: No module named 'distutils'
```

This diff replaces `distutils` usage according to [PEP-632 migration advice](https://peps.python.org/pep-0632/#migration-advice).

---

I generated this diff by looking for all usages of `distutils.*copy_(tree|file)` and replaced them with `shutil.copy(tree|file)`. These should be close to drop-in replacements!

Reviewed By: itamaro, mergennachin

Differential Revision: D73804939
@facebook-github-bot
Copy link
Contributor

This pull request was exported from Phabricator. Differential Revision: D73804939

bowiechen added a commit to bowiechen/executorch that referenced this pull request Apr 29, 2025
Summary:

X-link: facebook/FAI-PEP#543

`distutils` has been deprecated since Python 3.10, and [removed in Python 3.12](https://docs.python.org/3/whatsnew/3.12.html#distutils).

Existing usage will now raise the following error under Python 3.12+:

```
ModuleNotFoundError: No module named 'distutils'
```

This diff replaces `distutils` usage according to [PEP-632 migration advice](https://peps.python.org/pep-0632/#migration-advice).

---

I generated this diff by looking for all usages of `distutils.*copy_(tree|file)` and replaced them with `shutil.copy(tree|file)`. These should be close to drop-in replacements!

Reviewed By: itamaro, mergennachin

Differential Revision: D73804939
@facebook-github-bot
Copy link
Contributor

This pull request was exported from Phabricator. Differential Revision: D73804939

bowiechen added a commit to bowiechen/executorch that referenced this pull request Apr 29, 2025
Summary:

X-link: facebook/FAI-PEP#543

`distutils` has been deprecated since Python 3.10, and [removed in Python 3.12](https://docs.python.org/3/whatsnew/3.12.html#distutils).

Existing usage will now raise the following error under Python 3.12+:

```
ModuleNotFoundError: No module named 'distutils'
```

This diff replaces `distutils` usage according to [PEP-632 migration advice](https://peps.python.org/pep-0632/#migration-advice).

---

I generated this diff by looking for all usages of `distutils.*copy_(tree|file)` and replaced them with `shutil.copy(tree|file)`. These should be close to drop-in replacements!

Reviewed By: itamaro, mergennachin

Differential Revision: D73804939
@facebook-github-bot
Copy link
Contributor

This pull request was exported from Phabricator. Differential Revision: D73804939

bowiechen added a commit to bowiechen/FAI-PEP that referenced this pull request Apr 29, 2025
Summary:
X-link: pytorch/executorch#10530


`distutils` has been deprecated since Python 3.10, and [removed in Python 3.12](https://docs.python.org/3/whatsnew/3.12.html#distutils).

Existing usage will now raise the following error under Python 3.12+:

```
ModuleNotFoundError: No module named 'distutils'
```

This diff replaces `distutils` usage according to [PEP-632 migration advice](https://peps.python.org/pep-0632/#migration-advice).

---

I generated this diff by looking for all usages of `distutils.*copy_(tree|file)` and replaced them with `shutil.copy(tree|file)`. These should be close to drop-in replacements!

Reviewed By: itamaro, mergennachin

Differential Revision: D73804939
bowiechen added a commit to bowiechen/FAI-PEP that referenced this pull request Apr 29, 2025
Summary:
X-link: pytorch/executorch#10530

Pull Request resolved: facebook#543

`distutils` has been deprecated since Python 3.10, and [removed in Python 3.12](https://docs.python.org/3/whatsnew/3.12.html#distutils).

Existing usage will now raise the following error under Python 3.12+:

```
ModuleNotFoundError: No module named 'distutils'
```

This diff replaces `distutils` usage according to [PEP-632 migration advice](https://peps.python.org/pep-0632/#migration-advice).

 ---

I generated this diff by looking for all usages of `distutils.*copy_(tree|file)` and replaced them with `shutil.copy(tree|file)`. These should be close to drop-in replacements!

Reviewed By: itamaro, mergennachin

Differential Revision: D73804939
Summary:

X-link: facebook/FAI-PEP#543

`distutils` has been deprecated since Python 3.10, and [removed in Python 3.12](https://docs.python.org/3/whatsnew/3.12.html#distutils).

Existing usage will now raise the following error under Python 3.12+:

```
ModuleNotFoundError: No module named 'distutils'
```

This diff replaces `distutils` usage according to [PEP-632 migration advice](https://peps.python.org/pep-0632/#migration-advice).

---

I generated this diff by looking for all usages of `distutils.*copy_(tree|file)` and replaced them with `shutil.copy(tree|file)`. These should be close to drop-in replacements!

Reviewed By: itamaro, mergennachin

Differential Revision: D73804939
@facebook-github-bot
Copy link
Contributor

This pull request was exported from Phabricator. Differential Revision: D73804939

bowiechen added a commit to bowiechen/FAI-PEP that referenced this pull request Apr 29, 2025
Summary:
X-link: pytorch/executorch#10530


`distutils` has been deprecated since Python 3.10, and [removed in Python 3.12](https://docs.python.org/3/whatsnew/3.12.html#distutils).

Existing usage will now raise the following error under Python 3.12+:

```
ModuleNotFoundError: No module named 'distutils'
```

This diff replaces `distutils` usage according to [PEP-632 migration advice](https://peps.python.org/pep-0632/#migration-advice).

---

I generated this diff by looking for all usages of `distutils.*copy_(tree|file)` and replaced them with `shutil.copy(tree|file)`. These should be close to drop-in replacements!

Reviewed By: itamaro, mergennachin

Differential Revision: D73804939
bowiechen added a commit to bowiechen/FAI-PEP that referenced this pull request Apr 29, 2025
Summary:
X-link: pytorch/executorch#10530

Pull Request resolved: facebook#543

`distutils` has been deprecated since Python 3.10, and [removed in Python 3.12](https://docs.python.org/3/whatsnew/3.12.html#distutils).

Existing usage will now raise the following error under Python 3.12+:

```
ModuleNotFoundError: No module named 'distutils'
```

This diff replaces `distutils` usage according to [PEP-632 migration advice](https://peps.python.org/pep-0632/#migration-advice).

 ---

I generated this diff by looking for all usages of `distutils.*copy_(tree|file)` and replaced them with `shutil.copy(tree|file)`. These should be close to drop-in replacements!

Reviewed By: itamaro, mergennachin

Differential Revision: D73804939
facebook-github-bot pushed a commit to facebook/FAI-PEP that referenced this pull request Apr 29, 2025
Summary:
X-link: pytorch/executorch#10530

Pull Request resolved: #543

`distutils` has been deprecated since Python 3.10, and [removed in Python 3.12](https://docs.python.org/3/whatsnew/3.12.html#distutils).

Existing usage will now raise the following error under Python 3.12+:

```
ModuleNotFoundError: No module named 'distutils'
```

This diff replaces `distutils` usage according to [PEP-632 migration advice](https://peps.python.org/pep-0632/#migration-advice).

 ---

I generated this diff by looking for all usages of `distutils.*copy_(tree|file)` and replaced them with `shutil.copy(tree|file)`. These should be close to drop-in replacements!

Reviewed By: itamaro, mergennachin

Differential Revision: D73804939

fbshipit-source-id: 239f886c87c73cb76330f5894757f4b3fe38a9db
@facebook-github-bot facebook-github-bot merged commit c5dd476 into pytorch:main Apr 29, 2025
82 of 85 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed. fb-exported topic: not user facing
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants