From ba5b95ff0b237ce1d76bf772c6e373f93d39b7a6 Mon Sep 17 00:00:00 2001 From: Nyakku Shigure Date: Tue, 17 Oct 2023 10:42:12 +0800 Subject: [PATCH] [SOT][3.12] remove distutils import to avoid import error (#58117) --- python/paddle/jit/sot/opcode_translator/skip_files.py | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/python/paddle/jit/sot/opcode_translator/skip_files.py b/python/paddle/jit/sot/opcode_translator/skip_files.py index 7753309debce94..5d5d04e56eca91 100644 --- a/python/paddle/jit/sot/opcode_translator/skip_files.py +++ b/python/paddle/jit/sot/opcode_translator/skip_files.py @@ -19,7 +19,6 @@ import copy import copyreg import dataclasses -import distutils import enum import functools import importlib @@ -94,7 +93,6 @@ codecs, uuid, setuptools, - distutils, warnings, } @@ -105,6 +103,11 @@ NEED_SKIP_THIRD_PARTIY_MODULES.add(sre_compile) NEED_SKIP_THIRD_PARTIY_MODULES.add(sre_parse) +if sys.version_info < (3, 12): + import distutils + + NEED_SKIP_THIRD_PARTIY_MODULES.add(distutils) + def _strip_init_py(s): return re.sub(r"__init__.py$", "", s)