| # Copyright 2024 The Pigweed Authors |
| # |
| # Licensed under the Apache License, Version 2.0 (the "License"); you may not |
| # use this file except in compliance with the License. You may obtain a copy of |
| # the License at |
| # |
| # https://www.apache.org/licenses/LICENSE-2.0 |
| # |
| # Unless required by applicable law or agreed to in writing, software |
| # distributed under the License is distributed on an "AS IS" BASIS, WITHOUT |
| # WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the |
| # License for the specific language governing permissions and limitations under |
| # the License. |
| |
| load("@bazel_skylib//rules:copy_file.bzl", "copy_file") |
| load("@rules_python//python:pip.bzl", "compile_pip_requirements") |
| |
| exports_files( |
| # This is somewhat bizarre. This file does not exist, but this |
| # build file is overlaid into `@zephyr`. Until this is unwound, |
| # this directory is shared and is evaluated in both contexts. |
| glob( |
| ["requirements-base.txt"], |
| allow_empty=True, |
| ), |
| ) |
| |
| package(default_visibility = ["//visibility:public"]) |
| |
| # This mostly just works around an issue where if we directly |
| # reference the requirements.txt file in an external repo then |
| # absolute paths end up in the generated lockfile. |
| copy_file( |
| name = "requirements_base", |
| src = "@zephyr//scripts:requirements-base.txt", |
| out = "zephyr-requirements-base.txt", |
| ) |
| |
| # Update with: |
| # bazel run //scripts:requirements.update |
| compile_pip_requirements( |
| name = "requirements", |
| srcs = [ |
| "requirements.in", |
| "zephyr-requirements-base.txt", |
| ], |
| # TODO: Enable and generate hashes for all supported platforms. |
| generate_hashes=False, |
| requirements_txt = "requirements-lock.txt", |
| ) |