Skip to content

Commit

Permalink
mibuild/generic_platform: add recursive parameter to add_source_dir
Browse files Browse the repository at this point in the history
enjoy-digital authored and sbourdeauducq committed Aug 2, 2014
1 parent 8baa957 commit a0d0742
Showing 1 changed file with 14 additions and 6 deletions.
20 changes: 14 additions & 6 deletions mibuild/generic_platform.py
Original file line number Diff line number Diff line change
@@ -222,12 +222,20 @@ def add_sources(self, path, *filenames, language=None):
for f in filenames:
self.add_source(os.path.join(path, f), language)

def add_source_dir(self, path):
for root, dirs, files in os.walk(path):
for filename in files:
language = tools.language_by_filename(filename)
if language is not None:
self.add_source(os.path.join(root, filename), language)
def add_source_dir(self, path, recursive=True):
dir_files = []
if recursive:
for root, dirs, files in os.walk(path):
for filename in files:
dir_files.append(os.path.join(root, filename))
else:
for item in os.listdir(path):
if os.path.isfile(os.path.join(path, item)):
dir_files.append(os.path.join(path, item))
for filename in dir_files:
language = tools.language_by_filename(filename)
if language is not None:
self.add_source(filename, language)

def add_verilog_include_path(self, path):
self.verilog_include_paths.append(os.path.abspath(path))

0 comments on commit a0d0742

Please sign in to comment.