2
2
3
3
load ("@bazel_tools//tools/build_defs/repo:http.bzl" , "http_archive" )
4
4
5
- def _parse_my_own_version_from_module_dot_bazel ( module_ctx ):
6
- lines = module_ctx . read ( Label ( "//:MODULE.bazel" )). split ( " \n " )
7
- for line in lines :
8
- parts = line . split ( " \" " )
9
- if parts [ 0 ] == " version = " :
10
- return parts [ 1 ]
11
- fail ( "Failed to parse my own version from `MODULE.bazel`! " +
12
- "This should never happen!" )
5
+ _INTEGRITIES = {
6
+ # Generate with "sha256-$(curl -fsSL "$url" | sha256sum | cut -d' ' -f1 | xxd -r -p | base64)"
7
+ "2.11.1" : "sha256-1HWXjaDNwtQ7c/MJEHhnWdWTqdjuBbG2hG0esWxtLgw=" ,
8
+ "2.12.0" : "sha256-v48kKr0avNN11RanBnSQ+3Gr15UZooLSK25NGSghhac=" ,
9
+ "2.13.1" : "sha256-UWMeiJYKiFb5xJcCf1XJ8vkRXK+wjAAFQ5g4oFuhe/w=" ,
10
+ "2.13.5" : "sha256-seIJxCs6ntdNo+CyWk9M1HjYnV77tI8EsnffQn+vYlI=" ,
11
+ "2.13.6" : "sha256-4Iy4f0dz2pf6e18DXeh2OrxlbYfVdz5i9toFh9Hw7CA=" ,
12
+ }
13
13
14
14
def _internal_configure_extension_impl (module_ctx ):
15
- version = _parse_my_own_version_from_module_dot_bazel (module_ctx )
15
+ (pybind11_bazel ,) = [module for module in module_ctx .modules if module .name == "pybind11_bazel" ]
16
+ version = pybind11_bazel .version
16
17
17
18
# The pybind11_bazel version should typically just be the pybind11 version,
18
19
# but can end with ".bzl.<N>" if the Bazel plumbing was updated separately.
@@ -21,7 +22,8 @@ def _internal_configure_extension_impl(module_ctx):
21
22
name = "pybind11" ,
22
23
build_file = "//:pybind11-BUILD.bazel" ,
23
24
strip_prefix = "pybind11-%s" % version ,
24
- urls = ["https://github.com/pybind/pybind11/archive/v%s.zip" % version ],
25
+ url = "https://github.com/pybind/pybind11/archive/refs/tags/v%s.tar.gz" % version ,
26
+ integrity = _INTEGRITIES .get (version ),
25
27
)
26
28
27
29
internal_configure_extension = module_extension (implementation = _internal_configure_extension_impl )
0 commit comments