Remove distutils (#57040)

Summary:
[distutils](https://docs.python.org/3/library/distutils.html) is on its way out and will be deprecated-on-import for Python 3.10+ and removed in Python 3.12 (see [PEP 632](https://www.python.org/dev/peps/pep-0632/)). There's no reason for us to keep it around since all the functionality we want from it can be found in `setuptools` / `sysconfig`. `setuptools` includes a copy of most of `distutils` (which is fine to use according to the PEP), that it uses under the hood, so this PR also uses that in some places.

Fixes #56527
Pull Request resolved: https://github.com/pytorch/pytorch/pull/57040

Pulled By: driazati

Reviewed By: nikithamalgifb

Differential Revision: D28051356

fbshipit-source-id: 1ca312219032540e755593e50da0c9e23c62d720
This commit is contained in:
davidriazati@fb.com
2021-04-29 12:09:02 -07:00
committed by Facebook GitHub Bot
parent 21be40b390
commit 4b96fc060b
15 changed files with 94 additions and 82 deletions

View File

@ -15,12 +15,12 @@
from distutils import sysconfig
import sysconfig
import sys
flags = [
'-DPYTHON_EXECUTABLE:FILEPATH={}'.format(sys.executable),
'-DPYTHON_INCLUDE_DIR={}'.format(sysconfig.get_python_inc()),
'-DPYTHON_INCLUDE_DIR={}'.format(sysconfig.get_path('include')),
]
print(' '.join(flags), end='')