Author: sebastien.lelong
Date: Mon Mar 16 11:53:41 2009
New Revision: 864
Modified:
trunk/tools/jallib.py
Log:
auto-generate samples: only takes test files starting with "test_"
Modified: trunk/tools/jallib.py
==============================================================================
--- trunk/tools/jallib.py (original)
+++ trunk/tools/jallib.py Mon Mar 16 11:53:41 2009
@@ -66,7 +66,7 @@
# TOOLS #
#########
-def get_jal_filenames(dir,subdir=None):
+def get_jal_filenames(dir,subdir=None,predicate=lambda x: True):
jalfiles = {}
if os.path.isfile(dir):
return {dir:dir}
@@ -75,10 +75,10 @@
continue
fulldf = os.path.join(dir,df)
halfdf = os.path.join(subdir and subdir or "",df)
- if os.path.isfile(fulldf) and fulldf.endswith(".jal"):
+ if os.path.isfile(fulldf) and fulldf.endswith(".jal") and
predicate(df):
jalfiles[df] = halfdf
elif os.path.isdir(fulldf):
-
jalfiles.update(get_jal_filenames(fulldf,subdir=os.path.join(subdir and
subdir or "",df)))
+
jalfiles.update(get_jal_filenames(fulldf,subdir=os.path.join(subdir and
subdir or "",df),predicate=predicate))
return jalfiles
def get_full_sample_path(sample_dir,pic="",sample=""):
@@ -952,7 +952,7 @@
testfiles = []
for d in [d for d in os.listdir(testdir) if d != "board" and not
d.startswith(".")]:
d = os.path.join(testdir,d)
- testfiles.extend([os.path.join(d,v) for v in
get_jal_filenames(d).values()])
+ testfiles.extend([os.path.join(d,v) for v in
get_jal_filenames(d,predicate=lambda x: x.startswith("test_")).values()])
return testfiles
def preferred_board(board):
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"jallib" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/jallib?hl=en
-~----------~----~----~----~------~----~------~--~---