| 60 | # Return the git revision as a string |
| 61 | def git_version(cwd): |
| 62 | def _minimal_ext_cmd(cmd): |
| 63 | # construct minimal environment |
| 64 | env = {} |
| 65 | for k in ['SYSTEMROOT', 'PATH']: |
| 66 | v = os.environ.get(k) |
| 67 | if v is not None: |
| 68 | env[k] = v |
| 69 | # LANGUAGE is used on win32 |
| 70 | env['LANGUAGE'] = 'C' |
| 71 | env['LANG'] = 'C' |
| 72 | env['LC_ALL'] = 'C' |
| 73 | out = subprocess.Popen(cmd, stdout=subprocess.PIPE, |
| 74 | env=env, cwd=cwd).communicate()[0] |
| 75 | return out |
| 76 | |
| 77 | try: |
| 78 | git_dir = os.path.abspath(os.path.dirname(os.path.dirname(__file__))) |