()
| 151 | return bot |
| 152 | |
| 153 | def get_commit_hash(): |
| 154 | try: |
| 155 | hash = subprocess.check_output(['git', 'rev-parse', 'HEAD'], |
| 156 | stderr=subprocess.STDOUT) |
| 157 | if all(c in string.hexdigits for c in hash[:-1]): |
| 158 | with open('version', 'w') as f: |
| 159 | f.write(hash) |
| 160 | except: |
| 161 | pass |
| 162 | |
| 163 | if not os.path.exists('version'): |
| 164 | return 'unknown' |
| 165 | |
| 166 | with open('version') as f: |
| 167 | return f.read()[:8] |
| 168 | |
| 169 | try: |
| 170 | if six.PY2: |