fysm-4-1space-accessstablestagetest-hooks
Last change
on this file was
595915c,
checked in by Alex Dehnert <adehnert@…>, 15 years ago
|
Add a mkdir -p equivalent
|
-
Property mode set to
100644
|
File size:
547 bytes
|
Rev | Line | |
---|
[1f94b84] | 1 | import traceback |
---|
[595915c] | 2 | import os, errno |
---|
[1f94b84] | 3 | |
---|
| 4 | def log_and_ignore_failures(logfile): |
---|
| 5 | def decorator(f): |
---|
| 6 | def new_f(*args, **kwargs): |
---|
| 7 | try: |
---|
| 8 | return f(*args, **kwargs) |
---|
| 9 | except Exception: |
---|
| 10 | fd = open(logfile, 'a') |
---|
| 11 | traceback.print_exc(file=fd, ) |
---|
| 12 | fd.close() |
---|
| 13 | return new_f |
---|
| 14 | return decorator |
---|
[595915c] | 15 | |
---|
| 16 | def mkdir_p(path): |
---|
| 17 | try: |
---|
| 18 | os.makedirs(path) |
---|
| 19 | except OSError as exc: # Python >2.5 |
---|
| 20 | if exc.errno == errno.EEXIST: |
---|
| 21 | pass |
---|
| 22 | else: raise |
---|
Note: See
TracBrowser
for help on using the repository browser.