- shutil.rmtree(directory + "/bertos", True)
- shutil.copytree(sources_dir + "/bertos", directory + "/bertos")
- shutil.copy(sources_dir + "/Makefile", directory + "/Makefile")
+ ## Destination source dir
+ srcdir = directory + "/bertos"
+ shutil.rmtree(srcdir, True)
+ shutil.copytree(sources_dir + "/bertos", srcdir)
+ ## Destination makefile
+ makefile = directory + "/Makefile"
+ if os.path.exists(makefile):
+ os.remove(makefile)
+ shutil.copy(sources_dir + "/Makefile", makefile)
+ ## Destination project dir
+ prjdir = directory + "/" + os.path.basename(directory)
+ shutil.rmtree(prjdir, True)
+ os.mkdir(prjdir)