1# Copyright 2024 The Pigweed Authors 2# 3# Licensed under the Apache License, Version 2.0 (the "License"); you may not 4# use this file except in compliance with the License. You may obtain a copy of 5# the License at 6# 7# https://www.apache.org/licenses/LICENSE-2.0 8# 9# Unless required by applicable law or agreed to in writing, software 10# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT 11# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the 12# License for the specific language governing permissions and limitations under 13# the License. 14 15load("@rules_python//python:defs.bzl", "py_library") 16load("//pw_build:python.bzl", "pw_py_test") 17 18package(default_visibility = ["//visibility:public"]) 19 20licenses(["notice"]) 21 22exports_files([ 23 "pw_env_setup/cipd_setup/.cipd_version", 24 "pw_env_setup/cipd_setup/.cipd_version.digests", 25 "pw_env_setup/virtualenv_setup/constraint.list", 26 "pw_env_setup/virtualenv_setup/constraint_hashes_darwin.list", 27 "pw_env_setup/virtualenv_setup/constraint_hashes_linux.list", 28 "pw_env_setup/virtualenv_setup/constraint_hashes_windows.list", 29 "pw_env_setup/virtualenv_setup/pigweed_upstream_requirements.txt", 30 "pw_env_setup/virtualenv_setup/python_base_requirements.txt", 31 "pw_env_setup/virtualenv_setup/upstream_requirements_darwin_lock.txt", 32 "pw_env_setup/virtualenv_setup/upstream_requirements_linux_lock.txt", 33 "pw_env_setup/virtualenv_setup/upstream_requirements_windows_lock.txt", 34] + glob(["pw_env_setup/**/*.json"])) 35 36# Downstream projects should set this label flag to point to their pigweed.json 37# file. 38label_flag( 39 name = "pigweed_json", 40 # We don't provide a default pigweed.json. Every project needs their own! 41 build_setting_default = "//pw_build:unspecified_backend", 42) 43 44py_library( 45 name = "pw_env_setup", 46 srcs = [ 47 "pw_env_setup/__init__.py", 48 "pw_env_setup/apply_visitor.py", 49 "pw_env_setup/batch_visitor.py", 50 "pw_env_setup/cipd_setup/__init__.py", 51 "pw_env_setup/cipd_setup/update.py", 52 "pw_env_setup/cipd_setup/wrapper.py", 53 "pw_env_setup/config_file.py", 54 "pw_env_setup/environment.py", 55 "pw_env_setup/github_visitor.py", 56 "pw_env_setup/gni_visitor.py", 57 "pw_env_setup/json_visitor.py", 58 "pw_env_setup/python_packages.py", 59 "pw_env_setup/shell_visitor.py", 60 "pw_env_setup/virtualenv_setup/__init__.py", 61 "pw_env_setup/virtualenv_setup/__main__.py", 62 "pw_env_setup/virtualenv_setup/install.py", 63 ], 64 data = [ 65 "pw_env_setup/cipd_setup/.cipd_version", 66 "pw_env_setup/cipd_setup/.cipd_version.digests", 67 "pw_env_setup/cipd_setup/arm.json", 68 "pw_env_setup/cipd_setup/bazel.json", 69 "pw_env_setup/cipd_setup/bazelisk.json", 70 "pw_env_setup/cipd_setup/buildifier.json", 71 "pw_env_setup/cipd_setup/clang.json", 72 "pw_env_setup/cipd_setup/clang_next.json", 73 "pw_env_setup/cipd_setup/cmake.json", 74 "pw_env_setup/cipd_setup/compatibility.json", 75 "pw_env_setup/cipd_setup/coverage.json", 76 "pw_env_setup/cipd_setup/default.json", 77 "pw_env_setup/cipd_setup/doxygen.json", 78 "pw_env_setup/cipd_setup/go.json", 79 "pw_env_setup/cipd_setup/host_tools.json", 80 "pw_env_setup/cipd_setup/kythe.json", 81 "pw_env_setup/cipd_setup/luci.json", 82 "pw_env_setup/cipd_setup/msrv_python.json", 83 "pw_env_setup/cipd_setup/openjdk.json", 84 "pw_env_setup/cipd_setup/pigweed.json", 85 "pw_env_setup/cipd_setup/python.json", 86 "pw_env_setup/cipd_setup/python310.json", 87 "pw_env_setup/cipd_setup/python311.json", 88 "pw_env_setup/cipd_setup/rbe.json", 89 "pw_env_setup/cipd_setup/riscv.json", 90 "pw_env_setup/cipd_setup/ruff.json", 91 "pw_env_setup/cipd_setup/testing.json", 92 "pw_env_setup/cipd_setup/upstream.json", 93 "pw_env_setup/cipd_setup/web.json", 94 "pw_env_setup/virtualenv_setup/constraint.list", 95 "pw_env_setup/virtualenv_setup/constraint_hashes_linux.list", 96 "pw_env_setup/virtualenv_setup/python_base_requirements.txt", 97 ":pigweed_json", 98 ], 99 imports = ["."], 100 deps = [ 101 "@python_packages//six", 102 "@rules_python//python/runfiles", 103 ], 104) 105 106pw_py_test( 107 name = "config_file_test", 108 srcs = ["config_file_test.py"], 109 deps = [ 110 ":pw_env_setup", 111 ], 112) 113 114pw_py_test( 115 name = "json_visitor_test", 116 srcs = ["json_visitor_test.py"], 117 deps = [ 118 ":pw_env_setup", 119 "@python_packages//six", 120 ], 121) 122 123pw_py_test( 124 name = "cipd_setup_update_test", 125 srcs = ["cipd_setup_update_test.py"], 126 deps = [ 127 ":pw_env_setup", 128 "@python_packages//parameterized", 129 ], 130) 131 132pw_py_test( 133 name = "environment_test", 134 srcs = ["environment_test.py"], 135 deps = [ 136 ":pw_env_setup", 137 ], 138) 139 140pw_py_test( 141 name = "python_packages_test", 142 srcs = ["python_packages_test.py"], 143 deps = [ 144 ":pw_env_setup", 145 "@python_packages//toml", 146 ], 147) 148