fysm-4-1space-accessstablestagetest-hooks
|
Last change
on this file since cdc36fe was
595915c,
checked in by Alex Dehnert <adehnert@…>, 16 years ago
|
|
Add a mkdir -p equivalent
|
-
Property mode set to
100644
|
|
File size:
547 bytes
|
| Line | |
|---|
| 1 | import traceback |
|---|
| 2 | import os, errno |
|---|
| 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 |
|---|
| 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.