diff --git a/BUILD b/BUILD index b8f70c296e..a134452113 100644 --- a/BUILD +++ b/BUILD @@ -27,3 +27,32 @@ sh_test( ".bazelversion", ], ) + +load("@rules_python//python:defs.bzl", "py_runtime_pair") + +py_runtime( + name = "python2_runtime", + python_version = "PY2", + files = [], + interpreter = "@python//:bin/python", +) + +py_runtime( + name = "python3_runtime", + python_version = "PY3", + files = [], + interpreter = "@python3//:bin/python", +) + +py_runtime_pair( + name = "my_python_pairs", + py2_runtime = ":python2_runtime", + py3_runtime = ":python3_runtime", +) + +toolchain( + name = "py_pair_toolchain", + #target_compatible_with = <...>, + toolchain = ":my_python_pairs", + toolchain_type = "@rules_python//python:toolchain_type", +) diff --git a/WORKSPACE b/WORKSPACE index a42e49bf01..4db9eb19d6 100644 --- a/WORKSPACE +++ b/WORKSPACE @@ -30,6 +30,16 @@ nixpkgs_package( repositories = { "nixpkgs": "@nixpkgs//:default.nix" }, ) +nixpkgs_package( + name = "python", + repositories = { "nixpkgs": "@nixpkgs//:default.nix" }, +) + +nixpkgs_package( + name = "python3", + repositories = { "nixpkgs": "@nixpkgs//:default.nix" }, +) + nixpkgs_package( name = "flex", repositories = { "nixpkgs": "@nixpkgs//:default.nix" }, @@ -108,6 +118,8 @@ load("//:setup.bzl", "kythe_rule_repositories", "maybe") # NOTE(treetide): local modification, we hardwired the nix-based values here. register_toolchains("//tools/build_rules/lexyacc:lexyacc_local_toolchain") +register_toolchains("//:py_pair_toolchain") + kythe_rule_repositories() # NOTE(treetide): local