Skip to content

Commit a82882b

Browse files
committed
unittests: Fix warning about distutils deprecation
unittests/rewritetests.py:19: DeprecationWarning: The distutils package is deprecated and slated for removal in Python 3.12. Use setuptools or check PEP 632 for potential alternatives from distutils.dir_util import copy_tree
1 parent 0a52792 commit a82882b

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

unittests/rewritetests.py

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,9 +15,10 @@
1515
import subprocess
1616
import json
1717
import os
18+
import shutil
1819
import unittest
19-
from distutils.dir_util import copy_tree
2020

21+
from mesonbuild.mesonlib import windows_proof_rmtree
2122
from .baseplatformtests import BasePlatformTests
2223

2324
class RewriterTests(BasePlatformTests):
@@ -26,7 +27,9 @@ def setUp(self):
2627
self.maxDiff = None
2728

2829
def prime(self, dirname):
29-
copy_tree(os.path.join(self.rewrite_test_dir, dirname), self.builddir)
30+
if os.path.exists(self.builddir):
31+
windows_proof_rmtree(self.builddir)
32+
shutil.copytree(os.path.join(self.rewrite_test_dir, dirname), self.builddir)
3033

3134
def rewrite_raw(self, directory, args):
3235
if isinstance(args, str):

0 commit comments

Comments
 (0)