[bazel] Use script based python bootstrapping (#8180)

This fixes issues found building AOS with import paths.
This commit is contained in:
Austin Schuh
2025-11-10 09:03:11 -08:00
committed by GitHub
parent c2e0f381ce
commit 4529ef0ea6
5 changed files with 17 additions and 16 deletions

View File

@@ -84,4 +84,7 @@ common:ci --repo_env="WPI_PUBLISH_CLASSIFIER_FILTER=headers,sources,linuxsystemc
common:ci_windows_x86 --repo_env="WPI_PUBLISH_CLASSIFIER_FILTER=headers,sources,linuxsystemcore,linuxsystemcoredebug,linuxsystemcorestatic,linuxsystemcorestaticdebug,linuxx86-64,linuxx86-64debug,linuxx86-64static,linuxx86-64staticdebug,osxuniversal,osxuniversaldebug,osxuniversalstatic,osxuniversalstaticdebug,windowsx86-64,windowsx86-64debug,windowsx86-64static,windowsx86-64staticdebug"
common:ci_windows_arm --repo_env="WPI_PUBLISH_CLASSIFIER_FILTER=headers,sources,linuxsystemcore,linuxsystemcoredebug,linuxsystemcorestatic,linuxsystemcorestaticdebug,linuxx86-64,linuxx86-64debug,linuxx86-64static,linuxx86-64staticdebug,osxuniversal,osxuniversaldebug,osxuniversalstatic,osxuniversalstaticdebug,windowsarm64,windowsarm64debug,windowsarm64static,windowsarm64staticdebug"
build --@rules_python//python/config_settings:bootstrap_impl=script
build --@rules_python//python/config_settings:venvs_use_declare_symlink=no
try-import %workspace%/bazel_auth.rc

View File

@@ -42,18 +42,18 @@ http_archive(
http_archive(
name = "rules_pkg",
sha256 = "cad05f864a32799f6f9022891de91ac78f30e0fa07dc68abac92a628121b5b11",
sha256 = "b7215c636f22c1849f1c3142c72f4b954bb12bb8dcf3cbe229ae6e69cc6479db",
urls = [
"https://github.com/bazelbuild/rules_pkg/releases/download/1.0.0/rules_pkg-1.0.0.tar.gz",
"https://github.com/bazelbuild/rules_pkg/releases/download/1.1.0/rules_pkg-1.1.0.tar.gz",
],
)
# Rules Python
http_archive(
name = "rules_python",
sha256 = "9f9f3b300a9264e4c77999312ce663be5dee9a56e361a1f6fe7ec60e1beef9a3",
strip_prefix = "rules_python-1.4.1",
url = "https://github.com/bazel-contrib/rules_python/releases/download/1.4.1/rules_python-1.4.1.tar.gz",
sha256 = "6b9185460d11d57a32139b103363fce39d81889206561ef582678273b74372ac",
strip_prefix = "rules_python-1.7.0-rc5",
url = "https://github.com/bazel-contrib/rules_python/releases/download/1.7.0-rc5/rules_python-1.7.0-rc5.tar.gz",
)
# Download Extra java rules

View File

@@ -19,9 +19,9 @@ def generate_nanopb(nanopb: Path, output_directory: Path, proto_dir: Path):
proto_files = proto_dir.glob("*.proto")
for path in proto_files:
absolute_filename = path.absolute()
subprocess.run(
[
sys.executable,
subprocess.check_call(
([sys.executable] if nanopb.endswith(".py") else [])
+ [
nanopb,
f"-I{absolute_filename.parent}",
f"-D{output_directory.absolute()}",
@@ -29,7 +29,6 @@ def generate_nanopb(nanopb: Path, output_directory: Path, proto_dir: Path):
"-e.npb",
absolute_filename,
],
check=True,
)
java_files = (output_directory).glob("*")
for java_file in java_files:

View File

@@ -20,15 +20,15 @@ def generate_nanopb(nanopb: Path, output_directory: Path, proto_dir: Path):
for path in proto_files:
absolute_filename = path.absolute()
subprocess.check_call(
[
sys.executable,
([sys.executable] if nanopb.endswith(".py") else [])
+ [
nanopb,
f"-I{absolute_filename.parent}",
f"-D{output_directory.absolute()}",
"-S.cpp",
"-e.npb",
absolute_filename,
]
],
)
java_files = (output_directory).glob("*")
for java_file in java_files:

View File

@@ -19,9 +19,9 @@ def generate_nanopb(nanopb: Path, output_directory: Path, proto_dir: Path):
proto_files = proto_dir.glob("*.proto")
for path in proto_files:
absolute_filename = path.absolute()
subprocess.run(
[
sys.executable,
subprocess.check_call(
([sys.executable] if nanopb.endswith(".py") else [])
+ [
nanopb,
f"-I{absolute_filename.parent}",
f"-D{output_directory.absolute()}",
@@ -29,7 +29,6 @@ def generate_nanopb(nanopb: Path, output_directory: Path, proto_dir: Path):
"-e.npb",
absolute_filename,
],
check=True,
)
java_files = (output_directory).glob("*")
for java_file in java_files: