MCPcopy Create free account
hub / github.com/defold/defold / git_sha1_from_version_file

Function git_sha1_from_version_file

editor/scripts/bundle.py:214–229  ·  view source on GitHub ↗

Gets the version number and checks if that tag exists

(options)

Source from the content-addressed store, hash-verified

212 return '%s%s%s' % (version, channel, suffix)
213
214def git_sha1_from_version_file(options):
215 """ Gets the version number and checks if that tag exists """
216 with open('../VERSION', 'r', encoding='utf-8') as version_file:
217 version = version_file.read().strip()
218
219 tag_name = _get_tag_name(version, options.channel)
220
221 process = subprocess.Popen(['git', 'rev-list', '-n', '1', tag_name], stdout = subprocess.PIPE, stderr = subprocess.DEVNULL)
222 out, err = process.communicate()
223 if process.returncode != 0:
224 log("Unable to find git sha from tag=%s" % tag_name)
225 return None
226
227 if isinstance(out, (bytes, bytearray)):
228 out = str(out, encoding='utf-8')
229 return out.strip()
230
231def git_sha1(ref = 'HEAD'):
232 try:

Callers 1

bundle.pyFile · 0.85

Calls 3

_get_tag_nameFunction · 0.85
logFunction · 0.70
readMethod · 0.45

Tested by

no test coverage detected