Skip to content
Snippets Groups Projects
Commit 1d1a25a0 authored by Daniel van der Schuur's avatar Daniel van der Schuur
Browse files

-Now using copy_tree from distutils module instead of copytree from shutil

 module. The difference is that now the target directory is recreated only
 if it does not exist (previously: always recreated which caused only the
 last copy_files entry in hdllib.cfg to have effect).
parent 2298857b
No related branches found
No related tags found
No related merge requests found
......@@ -53,6 +53,7 @@ import sys
import os
import os.path
import shutil
from distutils.dir_util import copy_tree
import argparse
class HdlConfig:
......@@ -313,16 +314,9 @@ class HdlConfig:
sourcePathName = cm.expand_file_path_name(fpn_io[0], lib_path)
destinationPath = cm.expand_file_path_name(fpn_io[1], build_dir_path)
if os.path.isfile(sourcePathName):
shutil.copy(sourcePathName, destinationPath) # copy file
shutil.copy(sourcePathName, destinationPath) # copy file
else:
if os.path.exists(destinationPath):
if build_dir_path in destinationPath:
# Only automatically remove the destinationPath if it is in the build_dir_path to avoid accidentally removing an important directory
shutil.rmtree(destinationPath)
else:
# If the destination directory is outside the build_dir_path then require that it does not already exist
sys.exit('Error : First manually remove destination directory %s' % destinationPath)
shutil.copytree(sourcePathName, destinationPath) # copy directory tree (will create new destinationPath directory)
copy_tree(sourcePathName, destinationPath) # copy directory tree (will create new destinationPath directory)
if __name__ == '__main__':
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment