build/generic_platform: avoid duplicate in GenericPlatform.sources
authorFlorent Kermarrec <florent@enjoy-digital.fr>
Fri, 22 Nov 2019 14:28:07 +0000 (15:28 +0100)
committerFlorent Kermarrec <florent@enjoy-digital.fr>
Fri, 22 Nov 2019 14:28:07 +0000 (15:28 +0100)
litex/build/generic_platform.py

index 772f77a1e89658defa20b281b9a6705d96b1ed57..65d70665882ef46b366ea34ba2bee128a2b4d5f6 100644 (file)
@@ -325,7 +325,9 @@ class GenericPlatform:
             language = tools.language_by_filename(filename)
         if library is None:
             library = "work"
-
+        for f, _, _ in self.sources:
+            if f == filename:
+                return
         self.sources.append((os.path.abspath(filename), language, library))
 
     def add_sources(self, path, *filenames, language=None, library=None):