MCPcopy Create free account
hub / github.com/DragonisCV/RAM / get_git_hash

Function get_git_hash

setup.py:18–40  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

16
17
18def get_git_hash():
19
20 def _minimal_ext_cmd(cmd):
21 # construct minimal environment
22 env = {}
23 for k in ['SYSTEMROOT', 'PATH', 'HOME']:
24 v = os.environ.get(k)
25 if v is not None:
26 env[k] = v
27 # LANGUAGE is used on win32
28 env['LANGUAGE'] = 'C'
29 env['LANG'] = 'C'
30 env['LC_ALL'] = 'C'
31 out = subprocess.Popen(cmd, stdout=subprocess.PIPE, env=env).communicate()[0]
32 return out
33
34 try:
35 out = _minimal_ext_cmd(['git', 'rev-parse', 'HEAD'])
36 sha = out.strip().decode('ascii')
37 except OSError:
38 sha = 'unknown'
39
40 return sha
41
42
43def get_hash():

Callers 1

get_hashFunction · 0.85

Calls 1

_minimal_ext_cmdFunction · 0.85

Tested by

no test coverage detected