soc/integration/builder: only copy Makefiles when not using symlinks

This commit is contained in:
Florent Kermarrec 2015-11-14 03:36:46 +01:00
parent a2aa5726bf
commit 041483dbe1
1 changed files with 5 additions and 7 deletions

View File

@ -99,19 +99,17 @@ class Builder:
def _prepare_software(self): def _prepare_software(self):
for name, src_dir in self.software_packages: for name, src_dir in self.software_packages:
dst_dir = os.path.join(self.output_dir, "software", name) dst_dir = os.path.join(self.output_dir, "software", name)
if self.use_symlinks: os.makedirs(dst_dir, exist_ok=True)
os.makedirs(dst_dir, exist_ok=True) src = os.path.join(src_dir, "Makefile")
src = os.path.join(src_dir, "Makefile") dst = os.path.join(dst_dir, "Makefile")
dst = os.path.join(dst_dir, "Makefile") if self.use_symlinks:
try: try:
os.remove(dst) os.remove(dst)
except FileNotFoundError: except FileNotFoundError:
pass pass
os.symlink(src, dst) os.symlink(src, dst)
else: else:
if os.path.exists(dst_dir): shutil.copy(src, dst)
shutil.rmtree(dst_dir)
shutil.copytree(src_dir, dst_dir)
def _generate_software(self): def _generate_software(self):
for name, src_dir in self.software_packages: for name, src_dir in self.software_packages: