-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
9 changed files
with
241 additions
and
1 deletion.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -12,3 +12,4 @@ dist | |
/bazel-* | ||
user.bazelrc | ||
/.github/ci.bazelrc | ||
/private/examples/multiplatform_py_test/bazel-* |
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 |
---|---|---|
@@ -1 +1,32 @@ | ||
# Use MODULE.bazel instead. | ||
workspace(name = "rules_req_compile") | ||
|
||
load("//:repositories.bzl", "req_compile_dependencies") | ||
|
||
req_compile_dependencies() | ||
|
||
load("//:repositories_transitive.bzl", "req_compile_transitive_dependencies") | ||
|
||
req_compile_transitive_dependencies() | ||
|
||
load("@rules_python//python:repositories.bzl", "python_register_toolchains") | ||
|
||
python_register_toolchains( | ||
name = "python311", | ||
python_version = "3.11", | ||
) | ||
|
||
load("@bazel_skylib//:workspace.bzl", "bazel_skylib_workspace") | ||
|
||
bazel_skylib_workspace() | ||
|
||
load("//private/tests:test_repositories_1.bzl", "test_dependencies_1") | ||
|
||
test_dependencies_1() | ||
|
||
load("//private/tests:test_repositories_2.bzl", "test_dependencies_2") | ||
|
||
test_dependencies_2() | ||
|
||
load("//private/tests:test_repositories_3.bzl", "test_dependencies_3") | ||
|
||
test_dependencies_3() |
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,78 @@ | ||
"""Test dependencies for the annotations integration test""" | ||
|
||
load("@bazel_tools//tools/build_defs/repo:utils.bzl", "maybe") | ||
load( | ||
"//:defs.bzl", | ||
"py_requirements_repository", | ||
package_annotation = "py_package_annotation", | ||
) | ||
|
||
_NUMPY_LIBRARY_TARGET = """\ | ||
load("@rules_cc//cc:defs.bzl", "cc_library") | ||
load("@rules_req_compile//:defs.bzl", "py_package_annotation_target") | ||
_INCLUDE_DIR = "site-packages/numpy/core/include" | ||
cc_library( | ||
name = "headers", | ||
hdrs = glob(["{}/**/*.h".format(_INCLUDE_DIR)]), | ||
includes = [_INCLUDE_DIR], | ||
) | ||
py_package_annotation_target( | ||
name = "pkg.headers", | ||
target = ":headers", | ||
) | ||
""" | ||
|
||
def req_compile_test_annotations_deps(): | ||
maybe( | ||
py_requirements_repository, | ||
name = "req_compile_test_annotations", | ||
requirements_locks = { | ||
Label("//private/tests/annotations:requirements.linux.txt"): "@platforms//os:linux", | ||
Label("//private/tests/annotations:requirements.macos.txt"): "@platforms//os:macos", | ||
Label("//private/tests/annotations:requirements.windows.txt"): "@platforms//os:windows", | ||
}, | ||
annotations = { | ||
"numpy": package_annotation( | ||
additive_build_file_content = _NUMPY_LIBRARY_TARGET, | ||
data = [":pkg.headers"], | ||
copy_srcs = { | ||
"site-packages/numpy/conftest.py": "site-packages/numpy/conftest.copy.py", | ||
}, | ||
copy_files = { | ||
"site-packages/numpy-1.26.4.dist-info/entry_points.txt": "site-packages/numpy-1.26.4.dist-info/entry_points.copy.txt", | ||
}, | ||
copy_executables = { | ||
"site-packages/numpy/testing/setup.py": "site-packages/numpy/testing/setup.copy.py", | ||
}, | ||
patches = [ | ||
Label("//private/tests/annotations:numpy.patch"), | ||
], | ||
deps = [ | ||
# Show that label dependencies can be added. | ||
Label("@rules_python//python/runfiles"), | ||
], | ||
), | ||
# Sphinx is known to have a circular dependency. The annotations here solve for that. | ||
"sphinxcontrib-applehelp": package_annotation( | ||
deps = ["-sphinx"], | ||
), | ||
"sphinxcontrib-devhelp": package_annotation( | ||
deps = ["-sphinx"], | ||
), | ||
"sphinxcontrib-htmlhelp": package_annotation( | ||
deps = ["-sphinx"], | ||
), | ||
"sphinxcontrib-jsmath": package_annotation( | ||
deps_excludes = ["sphinx"], | ||
), | ||
"sphinxcontrib-qthelp": package_annotation( | ||
deps_excludes = ["sphinx"], | ||
), | ||
"sphinxcontrib-serializinghtml": package_annotation( | ||
deps_excludes = ["sphinx"], | ||
), | ||
}, | ||
) |
21 changes: 21 additions & 0 deletions
21
private/tests/pip_parse_compat/pip_parse_compat_test_deps.bzl
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,21 @@ | ||
"""Test dependencies for `pip_parse` compatibility tests""" | ||
|
||
load("@bazel_tools//tools/build_defs/repo:utils.bzl", "maybe") | ||
load("//:defs.bzl", "py_requirements_repository") | ||
|
||
def pip_parse_compat_test_deps(): | ||
maybe( | ||
py_requirements_repository, | ||
name = "req_compile_test_pip_parse_compat_single_plat", | ||
requirements_lock = Label("//private/tests/pip_parse_compat:requirements.txt"), | ||
) | ||
|
||
maybe( | ||
py_requirements_repository, | ||
name = "req_compile_test_pip_parse_compat_multi_plat", | ||
requirements_locks = { | ||
Label("//private/tests/pip_parse_compat:requirements.linux.txt"): "@platforms//os:linux", | ||
Label("//private/tests/pip_parse_compat:requirements.macos.txt"): "@platforms//os:macos", | ||
Label("//private/tests/pip_parse_compat:requirements.windows.txt"): "@platforms//os:windows", | ||
}, | ||
) |
14 changes: 14 additions & 0 deletions
14
private/tests/pip_parse_compat/pip_parse_compat_test_deps_install.bzl
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,14 @@ | ||
"""Test dependencies for `pip_parse` compatibility tests""" | ||
|
||
load( | ||
"@req_compile_test_pip_parse_compat_multi_plat//:requirements.bzl", | ||
pip_parse_compat_multi_plat_repositories = "install_deps", | ||
) | ||
load( | ||
"@req_compile_test_pip_parse_compat_single_plat//:requirements.bzl", | ||
pip_parse_compat_single_plat_repositories = "install_deps", | ||
) | ||
|
||
def pip_parse_compat_test_deps_install(): | ||
pip_parse_compat_multi_plat_repositories() | ||
pip_parse_compat_single_plat_repositories() |
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,56 @@ | ||
"""req-compile Bazel integration test dependencies""" | ||
|
||
load("@bazel_tools//tools/build_defs/repo:utils.bzl", "maybe") | ||
load("@python311//:defs.bzl", "interpreter") | ||
load("//:defs.bzl", "py_requirements_repository") | ||
load("//private/tests/annotations:annotations_test_deps.bzl", "req_compile_test_annotations_deps") | ||
load("//private/tests/find_links:find_links_test_repo.bzl", "find_links_test_repository") | ||
load("//private/tests/pip_parse_compat:pip_parse_compat_test_deps.bzl", "pip_parse_compat_test_deps") | ||
|
||
def test_dependencies_1(): | ||
"""req-compile Bazel integration test dependencies""" | ||
|
||
maybe( | ||
py_requirements_repository, | ||
name = "req_compile_test_sdist", | ||
# Required to compile sdists | ||
interpreter = interpreter, | ||
requirements_lock = Label("//private/tests/sdist:requirements.txt"), | ||
) | ||
|
||
maybe( | ||
py_requirements_repository, | ||
name = "req_compile_test_simple", | ||
requirements_lock = Label("//private/tests/simple:requirements.txt"), | ||
) | ||
|
||
maybe( | ||
py_requirements_repository, | ||
name = "req_compile_test_platlib", | ||
requirements_locks = { | ||
Label("//private/tests/platlib:requirements.linux.txt"): "@platforms//os:linux", | ||
Label("//private/tests/platlib:requirements.macos.txt"): "@platforms//os:macos", | ||
Label("//private/tests/platlib:requirements.windows.txt"): "@platforms//os:windows", | ||
}, | ||
) | ||
|
||
maybe( | ||
py_requirements_repository, | ||
name = "req_compile_test_transitive_ins", | ||
requirements_lock = Label("//private/tests/transitive_ins:requirements.txt"), | ||
) | ||
|
||
maybe( | ||
find_links_test_repository, | ||
name = "req_compile_find_links_test", | ||
pyspark_wheel_data = Label("@req_compile_test_sdist__pyspark__sdist//:whl.json"), | ||
build_file = Label("//private/tests/find_links:BUILD.find_links.bazel"), | ||
# Needs to match `--find-links` in `//private/tests/find_links:requirements.in` | ||
wheeldir = "wheeldir", | ||
requirements_in = Label("//private/tests/find_links:requirements.in"), | ||
requirements_txt = Label("//private/tests/find_links:requirements.txt"), | ||
) | ||
|
||
pip_parse_compat_test_deps() | ||
|
||
req_compile_test_annotations_deps() |
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,29 @@ | ||
"""req-compile Bazel integration test transitive dependencies""" | ||
|
||
load("@bazel_tools//tools/build_defs/repo:utils.bzl", "maybe") | ||
load("@req_compile_test_annotations//:defs.bzl", annotations_repositories = "repositories") | ||
load("@req_compile_test_platlib//:defs.bzl", platlib_repositories = "repositories") | ||
load("@req_compile_test_sdist//:defs.bzl", sdist_repositories = "repositories") | ||
load("@req_compile_test_simple//:defs.bzl", simple_repositories = "repositories") | ||
load("@req_compile_test_transitive_ins//:defs.bzl", transitive_ins_repositories = "repositories") | ||
load("//:defs.bzl", "py_requirements_repository") | ||
load( | ||
"//private/tests/pip_parse_compat:pip_parse_compat_test_deps_install.bzl", | ||
"pip_parse_compat_test_deps_install", | ||
) | ||
|
||
def test_dependencies_2(): | ||
"""req-compile Bazel integration test transitive dependencies""" | ||
|
||
annotations_repositories() | ||
pip_parse_compat_test_deps_install() | ||
platlib_repositories() | ||
sdist_repositories() | ||
simple_repositories() | ||
transitive_ins_repositories() | ||
|
||
maybe( | ||
py_requirements_repository, | ||
name = "req_compile_test_find_links", | ||
requirements_lock = Label("@req_compile_find_links_test//:requirements.txt"), | ||
) |
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,7 @@ | ||
"""req-compile Bazel integration test transitive dependencies""" | ||
|
||
load("@req_compile_test_find_links//:defs.bzl", find_links_repositories = "repositories") | ||
|
||
def test_dependencies_3(): | ||
"""req-compile Bazel integration test transitive dependencies""" | ||
find_links_repositories() |