Skip to content

Commit 60fcb6c

Browse files
committed
Prep now deletes C60_multimodel*.pwa files before running examples since the precise models generated can be platform dependent.
1 parent 469a8a6 commit 60fcb6c

1 file changed

Lines changed: 21 additions & 0 deletions

File tree

devutils/prep.py

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,24 @@ def scrubeol(directory, filerestr):
5353
updated.close()
5454

5555
print "Updated %s to unix-style endlines." %f
56+
57+
58+
def rm(directory, filerestr):
59+
"""Delete files in directory matched by regex string.
60+
61+
Parameters
62+
----------
63+
directory - A directory to scrub
64+
filerestr - A regex string defining which files to match."""
65+
os.chdir(__basedir__)
66+
os.chdir(directory)
67+
files = [re.match(filerestr, f) for f in os.listdir(".")]
68+
files = [f.group(0) for f in files if f]
69+
70+
for f in files:
71+
os.remove(f)
72+
73+
print "Deleted %s." %f
5674

5775

5876

@@ -61,6 +79,9 @@ def scrubeol(directory, filerestr):
6179
# Temporarily add examples to path
6280
lib_path = os.path.abspath(os.path.join('..','doc','examples'))
6381
sys.path.append(lib_path)
82+
83+
# Delete existing files that don't necessarily have a fixed name.
84+
rm("../doc/examples/output", r"C60_multimodel.*\.pwa")
6485

6586
### Testing examples
6687
examples = Test()

0 commit comments

Comments
 (0)