From 4d3cf77ad50de8692e14103f0959d569e2d10b86 Mon Sep 17 00:00:00 2001 From: Andrey Senyaev Date: Fri, 10 Dec 2021 11:46:27 +0300 Subject: [PATCH] Replaced distutils to shutil when copying files in a tree --- modules/objc/generator/gen_objc.py | 8 +++++++- platforms/ios/build_framework.py | 7 ++++++- 2 files changed, 13 insertions(+), 2 deletions(-) diff --git a/modules/objc/generator/gen_objc.py b/modules/objc/generator/gen_objc.py index 2c41833f18..3e3ff8a2b0 100755 --- a/modules/objc/generator/gen_objc.py +++ b/modules/objc/generator/gen_objc.py @@ -9,7 +9,13 @@ import io from shutil import copyfile from pprint import pformat from string import Template -from distutils.dir_util import copy_tree + +if sys.version_info >= (3, 8): # Python 3.8+ + from shutil import copytree + def copy_tree(src, dst): + copytree(src, dst, dirs_exist_ok=True) +else: + from distutils.dir_util import copy_tree try: from io import StringIO # Python 3 diff --git a/platforms/ios/build_framework.py b/platforms/ios/build_framework.py index 0ce56321bf..a2b541b864 100755 --- a/platforms/ios/build_framework.py +++ b/platforms/ios/build_framework.py @@ -34,7 +34,12 @@ Adding --dynamic parameter will build {framework_name}.framework as App Store dy from __future__ import print_function, unicode_literals import glob, os, os.path, shutil, string, sys, argparse, traceback, multiprocessing, codecs, io from subprocess import check_call, check_output, CalledProcessError -from distutils.dir_util import copy_tree + +if sys.version_info >= (3, 8): # Python 3.8+ + def copy_tree(src, dst): + shutil.copytree(src, dst, dirs_exist_ok=True) +else: + from distutils.dir_util import copy_tree sys.path.insert(0, os.path.abspath(os.path.abspath(os.path.dirname(__file__))+'/../apple')) from cv_build_utils import execute, print_error, get_xcode_major, get_xcode_setting, get_xcode_version, get_cmake_version