|
| 1 | +"""rules_req_compile""" |
| 2 | + |
| 3 | +module( |
| 4 | + name = "rules_req_compile", |
| 5 | + version = "1.0.0rc37", |
| 6 | +) |
| 7 | + |
| 8 | +bazel_dep(name = "platforms", version = "0.0.11") |
| 9 | +bazel_dep(name = "rules_python", version = "1.2.0") |
| 10 | +bazel_dep(name = "bazel_skylib", version = "1.7.1") |
| 11 | +bazel_dep(name = "rules_cc", version = "0.1.1") |
| 12 | + |
| 13 | +bazel_dep(name = "buildozer", version = "8.0.3", dev_dependency = True) |
| 14 | +bazel_dep(name = "buildifier_prebuilt", version = "8.0.3", dev_dependency = True) |
| 15 | + |
| 16 | +python = use_extension("@rules_python//python/extensions:python.bzl", "python", dev_dependency = True) |
| 17 | +python.toolchain( |
| 18 | + configure_coverage_tool = True, |
| 19 | + # Working around a rules_python issue with docker |
| 20 | + # https://github.com/bazelbuild/rules_python/pull/713 |
| 21 | + ignore_root_user_error = True, |
| 22 | + is_default = True, |
| 23 | + python_version = "3.11", |
| 24 | +) |
| 25 | +use_repo( |
| 26 | + python, |
| 27 | + "python_3_11_aarch64-apple-darwin", |
| 28 | + "python_3_11_aarch64-unknown-linux-gnu", |
| 29 | + "python_3_11_x86_64-apple-darwin", |
| 30 | + "python_3_11_x86_64-pc-windows-msvc", |
| 31 | + "python_3_11_x86_64-unknown-linux-gnu", |
| 32 | + python311 = "python_3_11", |
| 33 | +) |
| 34 | + |
| 35 | +requirements = use_extension("//:extensions.bzl", "requirements") |
| 36 | +requirements.parse( |
| 37 | + name = "req_compile_deps", |
| 38 | + requirements_locks = { |
| 39 | + "//3rdparty:requirements.linux_aarch64.txt": "@rules_req_compile//tools/constraints:linux_aarch_any", |
| 40 | + "//3rdparty:requirements.linux_x86_64.txt": "@rules_req_compile//tools/constraints:linux_x86_64", |
| 41 | + "//3rdparty:requirements.macos_aarch64.txt": "@rules_req_compile//tools/constraints:macos_aarch64", |
| 42 | + "//3rdparty:requirements.macos_x86_64.txt": "@rules_req_compile//tools/constraints:macos_x86_64", |
| 43 | + "//3rdparty:requirements.windows_x86_64.txt": "@rules_req_compile//tools/constraints:windows_x86_64", |
| 44 | + }, |
| 45 | +) |
| 46 | +use_repo(requirements, "req_compile_deps") |
| 47 | + |
| 48 | +sdist_deps = use_extension("//private:sdist.bzl", "sdist_deps") |
| 49 | +use_repo( |
| 50 | + sdist_deps, |
| 51 | + "req_compile_sdist_compiler__pip", |
| 52 | + "req_compile_sdist_compiler__setuptools", |
| 53 | + "req_compile_sdist_compiler__wheel", |
| 54 | +) |
| 55 | + |
| 56 | +dev_requirements = use_extension("//extensions:python.bzl", "requirements", dev_dependency = True) |
| 57 | +dev_requirements.parse( |
| 58 | + name = "req_compile_test_sdist", |
| 59 | + # Required to compile sdists |
| 60 | + interpreter_linux_aarch64 = "@python_3_11_x86_64-unknown-linux-gnu//:python", |
| 61 | + interpreter_linux_x86_64 = "@python_3_11_x86_64-unknown-linux-gnu//:python", |
| 62 | + interpreter_macos_aarch64 = "@python_3_11_aarch64-apple-darwin//:python", |
| 63 | + interpreter_macos_x86_64 = "@python_3_11_x86_64-apple-darwin//:python", |
| 64 | + interpreter_windows = "@python_3_11_x86_64-pc-windows-msvc//:python", |
| 65 | + requirements_lock = "//private/tests/sdist:requirements.txt", |
| 66 | +) |
| 67 | +use_repo(dev_requirements, "req_compile_test_sdist", "req_compile_test_sdist__pyspark") |
| 68 | +dev_requirements.parse( |
| 69 | + name = "req_compile_test_simple", |
| 70 | + requirements_lock = "//private/tests/simple:requirements.txt", |
| 71 | +) |
| 72 | +use_repo(dev_requirements, "req_compile_test_simple") |
| 73 | +dev_requirements.parse( |
| 74 | + name = "req_compile_test_platlib", |
| 75 | + requirements_locks = { |
| 76 | + "//private/tests/platlib:requirements.linux.txt": "@platforms//os:linux", |
| 77 | + "//private/tests/platlib:requirements.macos.txt": "@platforms//os:macos", |
| 78 | + "//private/tests/platlib:requirements.windows.txt": "@platforms//os:windows", |
| 79 | + }, |
| 80 | +) |
| 81 | +use_repo(dev_requirements, "req_compile_test_platlib") |
| 82 | +dev_requirements.parse( |
| 83 | + name = "req_compile_test_transitive_ins", |
| 84 | + requirements_lock = "//private/tests/transitive_ins:requirements.txt", |
| 85 | +) |
| 86 | +use_repo(dev_requirements, "req_compile_test_transitive_ins") |
| 87 | +dev_requirements.parse( |
| 88 | + name = "req_compile_test_pip_parse_compat_single_plat", |
| 89 | + requirements_lock = "//private/tests/pip_parse_compat:requirements.txt", |
| 90 | +) |
| 91 | +use_repo(dev_requirements, "req_compile_test_pip_parse_compat_single_plat") |
| 92 | +dev_requirements.parse( |
| 93 | + name = "req_compile_test_pip_parse_compat_multi_plat", |
| 94 | + requirements_locks = { |
| 95 | + "//private/tests/pip_parse_compat:requirements.linux.txt": "@platforms//os:linux", |
| 96 | + "//private/tests/pip_parse_compat:requirements.macos.txt": "@platforms//os:macos", |
| 97 | + "//private/tests/pip_parse_compat:requirements.windows.txt": "@platforms//os:windows", |
| 98 | + }, |
| 99 | +) |
| 100 | +use_repo(dev_requirements, "req_compile_test_pip_parse_compat_multi_plat") |
| 101 | +dev_requirements.parse( |
| 102 | + name = "req_compile_test_annotations", |
| 103 | + requirements_locks = { |
| 104 | + "//private/tests/annotations:requirements.linux.txt": "@platforms//os:linux", |
| 105 | + "//private/tests/annotations:requirements.macos.txt": "@platforms//os:macos", |
| 106 | + "//private/tests/annotations:requirements.windows.txt": "@platforms//os:windows", |
| 107 | + }, |
| 108 | +) |
| 109 | +use_repo( |
| 110 | + dev_requirements, |
| 111 | + "req_compile_test_annotations", |
| 112 | + "req_compile_test_annotations_linux__numpy", |
| 113 | + "req_compile_test_annotations_macos__numpy", |
| 114 | + "req_compile_test_annotations_windows__numpy", |
| 115 | +) |
| 116 | +dev_requirements.package_annotation( |
| 117 | + additive_build_file_content = """\ |
| 118 | +load("@rules_cc//cc:defs.bzl", "cc_library") |
| 119 | +load("@rules_req_compile//:defs.bzl", "py_package_annotation_target") |
| 120 | +
|
| 121 | +_INCLUDE_DIR = "site-packages/numpy/core/include" |
| 122 | +
|
| 123 | +cc_library( |
| 124 | + name = "headers", |
| 125 | + hdrs = glob(["{}/**/*.h".format(_INCLUDE_DIR)]), |
| 126 | + includes = [_INCLUDE_DIR], |
| 127 | +) |
| 128 | +
|
| 129 | +py_package_annotation_target( |
| 130 | + name = "pkg.headers", |
| 131 | + target = ":headers", |
| 132 | +) |
| 133 | +""", |
| 134 | + copy_executables = { |
| 135 | + "site-packages/numpy/testing/setup.py": "site-packages/numpy/testing/setup.copy.py", |
| 136 | + }, |
| 137 | + copy_files = { |
| 138 | + "site-packages/numpy-1.26.4.dist-info/entry_points.txt": "site-packages/numpy-1.26.4.dist-info/entry_points.copy.txt", |
| 139 | + }, |
| 140 | + copy_srcs = { |
| 141 | + "site-packages/numpy/conftest.py": "site-packages/numpy/conftest.copy.py", |
| 142 | + }, |
| 143 | + data = [":pkg.headers"], |
| 144 | + package = "numpy", |
| 145 | + patches = [ |
| 146 | + "//private/tests/annotations:numpy.patch", |
| 147 | + ], |
| 148 | + deps = [ |
| 149 | + # Show that label dependencies can be added. |
| 150 | + "@rules_python//python/runfiles", |
| 151 | + ], |
| 152 | +) |
| 153 | + |
| 154 | +# Sphinx is known to have a circular dependency. The annotations here solve for that. |
| 155 | +dev_requirements.package_annotation( |
| 156 | + package = "sphinxcontrib-htmlhelp", |
| 157 | + deps = ["-sphinx"], |
| 158 | +) |
| 159 | +dev_requirements.package_annotation( |
| 160 | + package = "sphinxcontrib-applehelp", |
| 161 | + deps = ["-sphinx"], |
| 162 | +) |
| 163 | +dev_requirements.package_annotation( |
| 164 | + package = "sphinxcontrib-devhelp", |
| 165 | + deps = ["-sphinx"], |
| 166 | +) |
| 167 | +dev_requirements.package_annotation( |
| 168 | + package = "sphinxcontrib-jsmath", |
| 169 | + deps = ["-sphinx"], |
| 170 | +) |
| 171 | +dev_requirements.package_annotation( |
| 172 | + package = "sphinxcontrib-qthelp", |
| 173 | + deps = ["-sphinx"], |
| 174 | +) |
| 175 | +dev_requirements.package_annotation( |
| 176 | + deps_excludes = ["sphinx"], |
| 177 | + package = "sphinxcontrib-serializinghtml", |
| 178 | +) |
| 179 | + |
| 180 | +find_links_test_repository = use_repo_rule("//private/tests/find_links:find_links_test_repo.bzl", "find_links_test_repository") |
| 181 | + |
| 182 | +find_links_test_repository( |
| 183 | + name = "req_compile_find_links_test", |
| 184 | + build_file = "//private/tests/find_links:BUILD.find_links.bazel", |
| 185 | + dev_dependency = True, |
| 186 | + pyspark_wheel_data = "@req_compile_test_sdist__pyspark//:whl.json", |
| 187 | + requirements_in = "//private/tests/find_links:requirements.in", |
| 188 | + requirements_txt = "//private/tests/find_links:requirements.txt", |
| 189 | + # Needs to match `--find-links` in `//private/tests/find_links:requirements.in` |
| 190 | + wheeldir = "wheeldir", |
| 191 | +) |
| 192 | + |
| 193 | +# Use a separate extension since the @req_compile_find_links_test is generated by an extension |
| 194 | +# that also depend upon //extensions:python.bzl |
| 195 | +find_links_requirements = use_extension("//private/tests/find_links:extension.bzl", "requirements", dev_dependency = True) |
| 196 | +find_links_requirements.parse( |
| 197 | + name = "req_compile_test_find_links", |
| 198 | + requirements_lock = "@req_compile_find_links_test//:requirements.txt", |
| 199 | +) |
| 200 | +use_repo(find_links_requirements, "req_compile_test_find_links") |
| 201 | + |
| 202 | +dev_requirements.parse( |
| 203 | + name = "req_compile_test_cross_platform", |
| 204 | + requirements_locks = { |
| 205 | + "//private/tests/cross_platform:requirements.linux.txt": "@platforms//os:linux", |
| 206 | + "//private/tests/cross_platform:requirements.macos.txt": "@platforms//os:macos", |
| 207 | + "//private/tests/cross_platform:requirements.windows.txt": "@platforms//os:windows", |
| 208 | + }, |
| 209 | +) |
| 210 | +use_repo(dev_requirements, "req_compile_test_cross_platform") |
| 211 | + |
| 212 | +bazel_dep(name = "rules_go", version = "0.50.1", dev_dependency = True) |
| 213 | + |
| 214 | +go_sdk = use_extension("@rules_go//go:extensions.bzl", "go_sdk", dev_dependency = True) |
| 215 | +go_sdk.download(version = "1.23.1") |
| 216 | + |
| 217 | +bazel_dep(name = "gazelle", version = "0.40.0", dev_dependency = True) |
| 218 | +bazel_dep(name = "stardoc", version = "0.8.0", dev_dependency = True) |
| 219 | +bazel_dep(name = "bazel_skylib_gazelle_plugin", version = "1.7.1", dev_dependency = True) |
| 220 | +bazel_dep(name = "protobuf", version = "29.2", dev_dependency = True) |
0 commit comments