From 3a60a2c17cd901e4fed954050badc868bd8d223e Mon Sep 17 00:00:00 2001 From: Craig Tracey Date: Tue, 14 Apr 2015 23:48:02 -0400 Subject: [PATCH] Use distutils copy_tree instead of shutil.copytree This is just more hassle than it is worth. Pull in an additonal dependency in distutils and use copy_tree instead as it does precisely what we want. --- giftwrap/builders/package_builder.py | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/giftwrap/builders/package_builder.py b/giftwrap/builders/package_builder.py index fd6d115..c8fa8e9 100644 --- a/giftwrap/builders/package_builder.py +++ b/giftwrap/builders/package_builder.py @@ -14,6 +14,7 @@ # WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the # License for the specific language governing permissions and limitations +import distutils.dir_util import logging import os import shutil @@ -108,10 +109,7 @@ class PackageBuilder(Builder): else: LOG.debug("Copying config from '%s' to '%s'", src_config, dest_config) - if not os.path.exists(dest_config): - shutil.copytree(src_config, dest_config) - else: - shutil.copy2(src_config, dest_config) + distutils.dir_util.copy_tree(src_config, dest_config) if spec.settings.gerrit_dependencies: self._install_gerrit_dependencies(repo, project, install_path)