mirror of
https://github.com/ArduPilot/ardupilot
synced 2025-01-03 06:28:27 -04:00
autotest: fix warning about deprecated distutils.dir_utils.copy_tree
This commit is contained in:
parent
9fae8b4376
commit
33218b4bc9
@ -10,6 +10,11 @@ from __future__ import print_function
|
||||
import atexit
|
||||
import fnmatch
|
||||
import copy
|
||||
try:
|
||||
import distutils.dir_util
|
||||
except ImportError:
|
||||
# we copy with this with try/except in copy_tree, below
|
||||
pass
|
||||
import glob
|
||||
import optparse
|
||||
import os
|
||||
@ -20,7 +25,6 @@ import subprocess
|
||||
import sys
|
||||
import time
|
||||
import traceback
|
||||
from distutils.dir_util import copy_tree
|
||||
|
||||
import rover
|
||||
import arducopter
|
||||
@ -661,6 +665,13 @@ class TestResults(object):
|
||||
f.write(badge)
|
||||
|
||||
|
||||
def copy_tree(f, t, dirs_exist_ok=False):
|
||||
try:
|
||||
distutils.dir_util.copy_tree(f, t)
|
||||
except Exception:
|
||||
shutil.copytree(f, t, dirs_exist_ok=dirs_exist_ok)
|
||||
|
||||
|
||||
def write_webresults(results_to_write):
|
||||
"""Write webpage results."""
|
||||
t = mavtemplate.MAVTemplate()
|
||||
@ -671,7 +682,7 @@ def write_webresults(results_to_write):
|
||||
f.close()
|
||||
for f in glob.glob(util.reltopdir('Tools/autotest/web/*.png')):
|
||||
shutil.copy(f, buildlogs_path(os.path.basename(f)))
|
||||
copy_tree(util.reltopdir("Tools/autotest/web/css"), buildlogs_path("css"))
|
||||
copy_tree(util.reltopdir("Tools/autotest/web/css"), buildlogs_path("css"), dirs_exist_ok=True)
|
||||
results_to_write.generate_badge()
|
||||
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user