Skip to content

Commit

Permalink
some python2 dance in these troubled times
Browse files Browse the repository at this point in the history
Signed-off-by: Pierre Fenoll <[email protected]>
  • Loading branch information
fenollp committed Apr 21, 2020
1 parent ef0ff84 commit f4128ec
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions rule.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -243,14 +243,19 @@ def _sat_git_ref(ctx, o):
fail("No {ref_kind} matching {constraint} in {remote}".format(**o))
return ref, commit

def _python_executable(ctx):
# TODO: drop once the fog clears up...
if ctx.execute(["python3", "--version"]).return_code == 0:
return "python3"
return "python"

def _github_releases(ctx, o):
# TODO: migrate to Starlark to drop Python dependency
script = ctx.path("../bazel_upgradable/github_release_refs.py")
token = ""
if "GITHUB_TOKEN" in ctx.os.environ:
token = ctx.os.environ["GITHUB_TOKEN"]
result = ctx.execute([
"python",
_python_executable(ctx),
script,
"https://api.github.com/repos/{owner}/{repo}/releases".format(**o),
token,
Expand Down

0 comments on commit f4128ec

Please sign in to comment.