Added options to version specs and allow specifying a git ref to build instead of a version.
This commit is contained in:
@@ -2,7 +2,6 @@
|
||||
from git import Repo
|
||||
from git.exc import GitError
|
||||
import hashlib
|
||||
import re
|
||||
from SCons.Script import *
|
||||
|
||||
Import('env')
|
||||
@@ -56,7 +55,9 @@ def _git_recipe(env: Environment, globals: dict, repo_name, repo_url, cook_fn, v
|
||||
_tag_pattern = _make_callable(tag_pattern)
|
||||
versions_cb = versions and _make_callable(versions)
|
||||
|
||||
def _versions(env: Environment, update: bool = False):
|
||||
def _versions(env: Environment, update: bool = False, options: dict = {}):
|
||||
if 'ref' in options:
|
||||
return [(0, 0, 0)] # no versions if compiling from a branch
|
||||
pattern = _tag_pattern(env)
|
||||
if pattern:
|
||||
tags = env.GitTags(repo_name = _repo_name(env), remote_url = _repo_url(env), force_fetch=update)
|
||||
@@ -76,8 +77,10 @@ def _git_recipe(env: Environment, globals: dict, repo_name, repo_url, cook_fn, v
|
||||
def _dependencies(env: Environment, version) -> 'dict':
|
||||
return dependencies
|
||||
|
||||
def _cook(env: Environment, version) -> dict:
|
||||
if tag_fn:
|
||||
def _cook(env: Environment, version, options: dict = {}) -> dict:
|
||||
if 'ref' in options:
|
||||
git_ref = options['ref']
|
||||
elif tag_fn:
|
||||
git_ref = f'refs/tags/{tag_fn(version)}'
|
||||
else:
|
||||
assert ref_fn
|
||||
|
||||
Reference in New Issue
Block a user