aboutsummaryrefslogtreecommitdiffstats
path: root/configure.py
diff options
context:
space:
mode:
authorlloyd <[email protected]>2012-03-16 23:50:17 +0000
committerlloyd <[email protected]>2012-03-16 23:50:17 +0000
commit199bc49219175d29076692a3131ac5425d750461 (patch)
tree9c77ca51fd2ee55c8f5b1a119f9a2f57280f2522 /configure.py
parent8c2806ff858482a54110c7a105e63e5bb12b7771 (diff)
Don't require a <source> entry in info.txt, if not set use *.cpp
Diffstat (limited to 'configure.py')
-rwxr-xr-xconfigure.py24
1 files changed, 13 insertions, 11 deletions
diff --git a/configure.py b/configure.py
index d7325f52b..71d2a3d39 100755
--- a/configure.py
+++ b/configure.py
@@ -538,6 +538,7 @@ def force_to_dict(l):
Represents the information about a particular module
"""
class ModuleInfo(object):
+
def __init__(self, infofile):
lex_me_harder(infofile, self,
@@ -551,21 +552,22 @@ class ModuleInfo(object):
'need_isa': None,
'mp_bits': 0 })
- if self.source == [] and \
- self.header_internal == [] and \
- self.header_public == []:
-
- for (dirpath, dirnames, filenames) in os.walk(self.lives_in):
- if dirpath == self.lives_in:
+ def extract_files_matching(basedir, suffixes):
+ for (dirpath, dirnames, filenames) in os.walk(basedir):
+ if dirpath == basedir:
for filename in filenames:
if filename.startswith('.'):
continue
- if filename.endswith('.cpp') or \
- filename.endswith('.S'):
- self.source.append(filename)
- elif filename.endswith('.h'):
- self.header_public.append(filename)
+ for suffix in suffixes:
+ if filename.endswith(suffix):
+ yield filename
+
+ if self.source == []:
+ self.source = list(extract_files_matching(self.lives_in, ['.cpp', '.S']))
+
+ if self.header_internal == [] and self.header_public == []:
+ self.header_public = list(extract_files_matching(self.lives_in, ['.h']))
# Coerce to more useful types
def convert_lib_list(l):