-
Notifications
You must be signed in to change notification settings - Fork 54
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Move to rules_python and remove local_config_python.
Fixes #71.
- Loading branch information
Showing
8 changed files
with
54 additions
and
615 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 was deleted.
Oops, something went wrong.
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,27 @@ | ||
"""Module extension for "configuring" pybind11.""" | ||
|
||
load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive") | ||
|
||
def _parse_my_own_version_from_module_dot_bazel(module_ctx): | ||
lines = module_ctx.read(Label("//:MODULE.bazel")).split("\n") | ||
for line in lines: | ||
parts = line.split("\"") | ||
if parts[0] == " version = ": | ||
return parts[1] | ||
fail("Failed to parse my own version from `MODULE.bazel`! " + | ||
"This should never happen!") | ||
|
||
def _pybind11_configure_extension_impl(module_ctx): | ||
version = _parse_my_own_version_from_module_dot_bazel(module_ctx) | ||
|
||
# The pybind11_bazel version should typically just be the pybind11 version, | ||
# but can end with ".bzl.<N>" if the Bazel plumbing was updated separately. | ||
version = version.split(".bzl.")[0] | ||
http_archive( | ||
name = "pybind11", | ||
build_file = "//:pybind11.BUILD", | ||
strip_prefix = "pybind11-%s" % version, | ||
urls = ["https://github.com/pybind/pybind11/archive/v%s.zip" % version], | ||
) | ||
|
||
pybind11_configure_extension = module_extension(implementation = _pybind11_configure_extension_impl) |
Oops, something went wrong.