Skip to content

Commit de1e508

Browse files
committed
Replace usage of deprecated distutils.(file|dir)_util (#10530)
Summary: Pull Request resolved: #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
1 parent 6ca0800 commit de1e508

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

docs/source/conf.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818
# add these directories to sys.path here. If the directory is relative to the
1919
# documentation root, use os.path.abspath to make it absolute, like shown here.
2020
#
21-
import distutils.file_util
21+
import shutil
2222
import glob
2323
import os
2424
import sys
@@ -135,7 +135,7 @@
135135
# Copy .md files from source dir to gallery dir
136136
for f in glob.glob(os.path.join(source_dir, "*.md")):
137137

138-
distutils.file_util.copy_file(f, gallery_dir, update=True)
138+
shutil.copyfile(f, gallery_dir)
139139

140140
source_suffix = [".rst", ".md"]
141141

0 commit comments

Comments
 (0)