soc/integration/builder: only copy Makefiles when not using symlinks
authorFlorent Kermarrec <florent@enjoy-digital.fr>
Sat, 14 Nov 2015 02:36:46 +0000 (03:36 +0100)
committerFlorent Kermarrec <florent@enjoy-digital.fr>
Sat, 14 Nov 2015 02:36:46 +0000 (03:36 +0100)
litex/soc/integration/builder.py

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