Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions .bazelrc
Original file line number Diff line number Diff line change
Expand Up @@ -72,3 +72,6 @@ common:ci --repo_env="WPI_PUBLISH_CLASSIFIER_FILTER=headers,sources,linuxsystemc
# Instead, skip the cross transition for ARM on x86, and the reverse on x86.
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
10 changes: 5 additions & 5 deletions WORKSPACE
Original file line number Diff line number Diff line change
Expand Up @@ -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 = "0a1cefefb4a7b550fb0b43f54df67d6da95b7ba352637669e46c987f69986f6a",
strip_prefix = "rules_python-1.5.3",
url = "https://github.com/bazel-contrib/rules_python/releases/download/1.5.3/rules_python-1.5.3.tar.gz",
)

# Download Extra java rules
Expand Down
10 changes: 6 additions & 4 deletions hal/generate_nanopb.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,19 +17,21 @@ def generate_nanopb(nanopb: Path, output_directory: Path, proto_dir: Path):
os.makedirs(output_directory.absolute())

proto_files = proto_dir.glob("*.proto")
env = {x: os.environ[x] for x in ["TMPDIR", "PATH"] if x in os.environ}

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()}",
"-S.cpp",
"-e.npb",
absolute_filename,
],
check=True,
env=env,
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why do we need to clear the environment?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In that case, can we del os.environ["RUNFILES_DIR"] or similar instead then? Makes it more obvious why the env needs to change.

)
java_files = (output_directory).glob("*")
for java_file in java_files:
Expand Down
9 changes: 6 additions & 3 deletions wpimath/generate_nanopb.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,18 +17,21 @@ def generate_nanopb(nanopb: Path, output_directory: Path, proto_dir: Path):
os.makedirs(output_directory.absolute())

proto_files = proto_dir.glob("*.proto")
env = {x: os.environ[x] for x in ["TMPDIR", "PATH"] if x in os.environ}

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,
]
],
env=env,
)
java_files = (output_directory).glob("*")
for java_file in java_files:
Expand Down
10 changes: 6 additions & 4 deletions wpiutil/generate_nanopb.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,19 +17,21 @@ def generate_nanopb(nanopb: Path, output_directory: Path, proto_dir: Path):
os.makedirs(output_directory.absolute())

proto_files = proto_dir.glob("*.proto")
env = {x: os.environ[x] for x in ["TMPDIR", "PATH"] if x in os.environ}

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()}",
"-S.cpp",
"-e.npb",
absolute_filename,
],
check=True,
env=env,
)
java_files = (output_directory).glob("*")
for java_file in java_files:
Expand Down
Loading