From 7051f467bbb8a2b586a8c769551004767cebc9d5 Mon Sep 17 00:00:00 2001 From: Jarrod Johnson Date: Thu, 17 Aug 2023 14:49:44 -0400 Subject: [PATCH] Avoid a deprectationwarning in copytree handling While trying to address one deprecationwarning, we hit another. Check if the new function exists and use it, falling back to distutils if everything fails. --- imgutil/imgutil | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/imgutil/imgutil b/imgutil/imgutil index 5f64c988..887086d5 100644 --- a/imgutil/imgutil +++ b/imgutil/imgutil @@ -5,7 +5,7 @@ import ctypes.util import datetime import inspect from shutil import copytree as copytree -if 'dirs_exist_ok' in inspect.getargspec(copytree).args: +if hasattr(inspect, 'getfullargspec') and 'dirs_exist_ok' in inspect.getfullargspec(copytree).args: def copy_tree(src, dst): copytree(src, dst, dirs_exist_ok=True) else: