| 57 | |
| 58 | |
| 59 | def write_version_py(): |
| 60 | content = """# GENERATED VERSION FILE |
| 61 | # TIME: {} |
| 62 | __version__ = '{}' |
| 63 | __gitsha__ = '{}' |
| 64 | version_info = ({}) |
| 65 | """ |
| 66 | sha = get_hash() |
| 67 | with open('VERSION', 'r') as f: |
| 68 | SHORT_VERSION = f.read().strip() |
| 69 | VERSION_INFO = ', '.join([x if x.isdigit() else f'"{x}"' for x in SHORT_VERSION.split('.')]) |
| 70 | |
| 71 | version_file_str = content.format(time.asctime(), SHORT_VERSION, sha, VERSION_INFO) |
| 72 | with open(version_file, 'w') as f: |
| 73 | f.write(version_file_str) |
| 74 | |
| 75 | |
| 76 | def get_version(): |