From cbc358ff0bdcc8f1b8cdd152b0dc6f3c535e9f87 Mon Sep 17 00:00:00 2001 From: Damien Elmes Date: Mon, 18 Oct 2021 15:50:16 +1000 Subject: [PATCH] add aliases to run vendored python and node from command line You can then do './scripts/python -m venv /path/to/venv' to create a virtual env based on the bundled Python, which can be handy if you don't happen to have the appropriate version of Python installed separately. --- python/BUILD.bazel | 9 +++++++++ scripts/python | 3 +++ ts/BUILD.bazel | 5 +++++ 3 files changed, 17 insertions(+) create mode 100755 scripts/python diff --git a/python/BUILD.bazel b/python/BUILD.bazel index f4e59faf3..93c0a9757 100644 --- a/python/BUILD.bazel +++ b/python/BUILD.bazel @@ -2,6 +2,15 @@ load("@rules_python//python:defs.bzl", "py_binary") load("@py_deps//:requirements.bzl", "requirement") load(":binary.bzl", "pip_binary") +# e.g. bazel run python +alias( + name = "python", + actual = "@python//:python", +) + +# e.g. bazel run python:pip +pip_binary(name = "pip") + pip_binary(name = "black") pip_binary(name = "isort") diff --git a/scripts/python b/scripts/python new file mode 100755 index 000000000..4fc4de93c --- /dev/null +++ b/scripts/python @@ -0,0 +1,3 @@ +#!/bin/bash + +bazel run python -- $* diff --git a/ts/BUILD.bazel b/ts/BUILD.bazel index e9c5afe2d..f4dc180d0 100644 --- a/ts/BUILD.bazel +++ b/ts/BUILD.bazel @@ -29,3 +29,8 @@ alias( name = "yarn", actual = "@nodejs//:yarn", ) + +alias( + name = "node", + actual = "@nodejs//:node", +)