| 1 |
#!/usr/bin/env python |
| 2 |
# -*- mode: python; py-indent-offset: 4; py-continuation-offset: 4 -*- |
| 3 |
# Change above to '/usr/bin/python -3' for python 3.x porting warnings |
| 4 |
""" |
| 5 |
This script will clean the current workspace IFF |
| 6 |
It is called post-build |
| 7 |
or |
| 8 |
The workspace has not been cleaned since the date in the sentinel file |
| 9 |
""" |
| 10 |
from __future__ import print_function |
| 11 |
import sys |
| 12 |
sys.dont_write_bytecode = True |
| 13 |
|
| 14 |
import pickle |
| 15 |
|
| 16 |
from clean_sentinel import set_reference_date |
| 17 |
|
| 18 |
|
| 19 |
class CleanReference(object): |
| 20 |
"""Sets the current time as the reference clean date""" |
| 21 |
|
| 22 |
def run(self): |
| 23 |
"""Run the actual routine in clean_sentinel""" |
| 24 |
try: |
| 25 |
set_reference_date() |
| 26 |
except BaseException as e: |
| 27 |
print(e.args, file=sys.stderr) |
| 28 |
sys.exit() |
| 29 |
except pickle.PicklingError: |
| 30 |
print('Pickle Failure', file=sys.stderr) |
| 31 |
sys.exit() |
| 32 |
|
| 33 |
if __name__ == '__main__': |
| 34 |
cleanRef = CleanReference() |
| 35 |
cleanRef.run() |