Skip to content

Commit 5f28550

Browse files
authored
fix: fix errors with bazel@head (bazel-contrib#2332)
Fix various errors with upcoming Bazel versions * Use rules_cc 0.0.13 for integration tests. * Set `allow_empty=True` in local toolchains setup Fixes bazel-contrib#2310
1 parent 72ddf0c commit 5f28550

File tree

5 files changed

+77
-7
lines changed

5 files changed

+77
-7
lines changed

python/private/local_runtime_repo_setup.bzl

Lines changed: 13 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -61,18 +61,26 @@ def define_local_runtime_toolchain_impl(
6161
cc_library(
6262
name = "_python_headers",
6363
# NOTE: Keep in sync with watch_tree() called in local_runtime_repo
64-
srcs = native.glob(["include/**/*.h"]),
64+
srcs = native.glob(
65+
["include/**/*.h"],
66+
# A Python install may not have C headers
67+
allow_empty = True,
68+
),
6569
includes = ["include"],
6670
)
6771

6872
cc_library(
6973
name = "_libpython",
7074
# Don't use a recursive glob because the lib/ directory usually contains
7175
# a subdirectory of the stdlib -- lots of unrelated files
72-
srcs = native.glob([
73-
"lib/*{}".format(lib_ext), # Match libpython*.so
74-
"lib/*{}*".format(lib_ext), # Also match libpython*.so.1.0
75-
]),
76+
srcs = native.glob(
77+
[
78+
"lib/*{}".format(lib_ext), # Match libpython*.so
79+
"lib/*{}*".format(lib_ext), # Also match libpython*.so.1.0
80+
],
81+
# A Python install may not have shared libraries.
82+
allow_empty = True,
83+
),
7684
hdrs = [":_python_headers"],
7785
)
7886

tests/integration/compile_pip_requirements/WORKSPACE

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,19 @@
1+
load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive")
2+
3+
http_archive(
4+
name = "protobuf",
5+
sha256 = "da288bf1daa6c04d03a9051781caa52aceb9163586bff9aa6cfb12f69b9395aa",
6+
strip_prefix = "protobuf-27.0",
7+
url = "https://github.com/protocolbuffers/protobuf/releases/download/v27.0/protobuf-27.0.tar.gz",
8+
)
9+
10+
http_archive(
11+
name = "rules_cc",
12+
sha256 = "d9bdd3ec66b6871456ec9c965809f43a0901e692d754885e89293807762d3d80",
13+
strip_prefix = "rules_cc-0.0.13",
14+
urls = ["https://github.com/bazelbuild/rules_cc/releases/download/0.0.13/rules_cc-0.0.13.tar.gz"],
15+
)
16+
117
local_repository(
218
name = "rules_python",
319
path = "../../..",

tests/integration/ignore_root_user_error/WORKSPACE

Lines changed: 16 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,19 @@
1+
load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive")
2+
3+
http_archive(
4+
name = "protobuf",
5+
sha256 = "da288bf1daa6c04d03a9051781caa52aceb9163586bff9aa6cfb12f69b9395aa",
6+
strip_prefix = "protobuf-27.0",
7+
url = "https://github.com/protocolbuffers/protobuf/releases/download/v27.0/protobuf-27.0.tar.gz",
8+
)
9+
10+
http_archive(
11+
name = "rules_cc",
12+
sha256 = "d9bdd3ec66b6871456ec9c965809f43a0901e692d754885e89293807762d3d80",
13+
strip_prefix = "rules_cc-0.0.13",
14+
urls = ["https://github.com/bazelbuild/rules_cc/releases/download/0.0.13/rules_cc-0.0.13.tar.gz"],
15+
)
16+
117
local_repository(
218
name = "rules_python",
319
path = "../../..",
@@ -13,8 +29,6 @@ python_register_toolchains(
1329
python_version = "3.9",
1430
)
1531

16-
load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive")
17-
1832
http_archive(
1933
name = "bazel_skylib",
2034
sha256 = "c6966ec828da198c5d9adbaa94c05e3a1c7f21bd012a0b29ba8ddbccb2c93b0d",

tests/integration/pip_parse/WORKSPACE

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,19 @@
1+
load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive")
2+
3+
http_archive(
4+
name = "protobuf",
5+
sha256 = "da288bf1daa6c04d03a9051781caa52aceb9163586bff9aa6cfb12f69b9395aa",
6+
strip_prefix = "protobuf-27.0",
7+
url = "https://github.com/protocolbuffers/protobuf/releases/download/v27.0/protobuf-27.0.tar.gz",
8+
)
9+
10+
http_archive(
11+
name = "rules_cc",
12+
sha256 = "d9bdd3ec66b6871456ec9c965809f43a0901e692d754885e89293807762d3d80",
13+
strip_prefix = "rules_cc-0.0.13",
14+
urls = ["https://github.com/bazelbuild/rules_cc/releases/download/0.0.13/rules_cc-0.0.13.tar.gz"],
15+
)
16+
117
local_repository(
218
name = "rules_python",
319
path = "../../..",

tests/integration/py_cc_toolchain_registered/WORKSPACE

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,19 @@
1+
load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive")
2+
3+
http_archive(
4+
name = "protobuf",
5+
sha256 = "da288bf1daa6c04d03a9051781caa52aceb9163586bff9aa6cfb12f69b9395aa",
6+
strip_prefix = "protobuf-27.0",
7+
url = "https://github.com/protocolbuffers/protobuf/releases/download/v27.0/protobuf-27.0.tar.gz",
8+
)
9+
10+
http_archive(
11+
name = "rules_cc",
12+
sha256 = "d9bdd3ec66b6871456ec9c965809f43a0901e692d754885e89293807762d3d80",
13+
strip_prefix = "rules_cc-0.0.13",
14+
urls = ["https://github.com/bazelbuild/rules_cc/releases/download/0.0.13/rules_cc-0.0.13.tar.gz"],
15+
)
16+
117
local_repository(
218
name = "rules_python",
319
path = "../../..",

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy