-
Notifications
You must be signed in to change notification settings - Fork 790
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[bazel] Add bzlmod support for
rules_python
Signed-off-by: James Wainwright <[email protected]>
- Loading branch information
Showing
4 changed files
with
34 additions
and
7 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
# Copyright lowRISC contributors (OpenTitan project). | ||
# Licensed under the Apache License, Version 2.0, see LICENSE for details. | ||
# SPDX-License-Identifier: Apache-2.0 | ||
|
||
# Dependencies: | ||
bazel_dep(name = "rules_python", version = "0.39.0") | ||
|
||
# Python toolchain: | ||
python = use_extension("@rules_python//python/extensions:python.bzl", "python") | ||
python.toolchain( | ||
# Required because CI containers currently run as the `root` user. | ||
# We lose caching of `.pyc` files as a result. | ||
# See <https://github.com/bazelbuild/rules_python/pull/713>. | ||
ignore_root_user_error = True, | ||
is_default = True, | ||
python_version = "3.9", | ||
) | ||
use_repo(python, "pythons_hub") | ||
register_toolchains("@pythons_hub//:all") | ||
|
||
# We occasionally access the toolchain repositories directly to use interpreters. | ||
use_repo(python, python3 = "python_3_9", python3_host = "python_3_9_host") | ||
|
||
# Pip dependencies: | ||
pip = use_extension("@rules_python//python/extensions:pip.bzl", "pip") | ||
pip.parse( | ||
hub_name = "ot_python_deps", | ||
python_version = "3.9", | ||
requirements_lock = "//:python-requirements.txt", | ||
) | ||
use_repo(pip, "ot_python_deps") |