Skip to content

Commit

Permalink
Make download.py use the github release if --exact or HEAD point to a…
Browse files Browse the repository at this point in the history
… tag
  • Loading branch information
glandium committed Jun 25, 2024
1 parent 8a165c6 commit db03c8a
Showing 1 changed file with 16 additions and 2 deletions.
18 changes: 16 additions & 2 deletions download.py
Original file line number Diff line number Diff line change
Expand Up @@ -285,14 +285,28 @@ def main(args):

tag = None
local_sha1 = None
if build_commit:
if build_commit and not args.exact and not args.branch:
try:
local_sha1 = build_commit()
except Exception:
pass

exact = args.exact or (not args.branch and local_sha1)
branch = args.branch or local_sha1 or 'release'
branch = args.branch or 'release'

if build_commit and exact and not args.variant:
tags = [
ref[len('refs/tags/'):]
for sha1, _, ref in (
l.split(None, 2)
for l in subprocess.check_output(
['git', 'for-each-ref', 'refs/tags/']).splitlines()
)
if sha1.decode('ascii') == exact
]
tags = sorted(tags, key=lambda x: split_version(x), reverse=True)
if tags:
tag = tags[0].decode('ascii')

if exact:
sha1 = exact
Expand Down

0 comments on commit db03c8a

Please sign in to comment.