Skip to content

Commit

Permalink
Remove the BUILD_WORKING_DIRECTORY boilerplate from tools (#110)
Browse files Browse the repository at this point in the history
  • Loading branch information
jvolkman authored Aug 1, 2024
1 parent 325f7c3 commit d04a132
Show file tree
Hide file tree
Showing 10 changed files with 0 additions and 46 deletions.
5 changes: 0 additions & 5 deletions pycross/private/tools/bzl_lock_generator.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import os
from pathlib import Path
from typing import Any

Expand Down Expand Up @@ -29,8 +28,4 @@ def main(args: Any) -> None:


if __name__ == "__main__":
# When under `bazel run`, change to the actual working dir.
if "BUILD_WORKING_DIRECTORY" in os.environ:
os.chdir(os.environ["BUILD_WORKING_DIRECTORY"])

main(parse_flags())
5 changes: 0 additions & 5 deletions pycross/private/tools/pdm_translator.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
from __future__ import annotations

import os
import re
from collections import defaultdict
from dataclasses import dataclass
Expand Down Expand Up @@ -393,8 +392,4 @@ def parse_flags() -> Any:


if __name__ == "__main__":
# When under `bazel run`, change to the actual working dir.
if "BUILD_WORKING_DIRECTORY" in os.environ:
os.chdir(os.environ["BUILD_WORKING_DIRECTORY"])

main(parse_flags())
5 changes: 0 additions & 5 deletions pycross/private/tools/poetry_translator.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import os
from collections import defaultdict
from dataclasses import dataclass
from pathlib import Path
Expand Down Expand Up @@ -274,8 +273,4 @@ def parse_flags() -> Any:


if __name__ == "__main__":
# When under `bazel run`, change to the actual working dir.
if "BUILD_WORKING_DIRECTORY" in os.environ:
os.chdir(os.environ["BUILD_WORKING_DIRECTORY"])

main(parse_flags())
4 changes: 0 additions & 4 deletions pycross/private/tools/raw_lock_resolver.py
Original file line number Diff line number Diff line change
Expand Up @@ -572,8 +572,4 @@ def main(args: Any) -> None:


if __name__ == "__main__":
# When under `bazel run`, change to the actual working dir.
if "BUILD_WORKING_DIRECTORY" in os.environ:
os.chdir(os.environ["BUILD_WORKING_DIRECTORY"])

main(parse_flags())
4 changes: 0 additions & 4 deletions pycross/private/tools/repairwheel/repair_wheel_hook.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,4 @@ def main() -> None:


if __name__ == "__main__":
# When under `bazel run`, change to the actual working dir.
if "BUILD_WORKING_DIRECTORY" in os.environ:
os.chdir(os.environ["BUILD_WORKING_DIRECTORY"])

main()
5 changes: 0 additions & 5 deletions pycross/private/tools/resolved_lock_renderer.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
from __future__ import annotations

import json
import os
import textwrap
from argparse import ArgumentParser
from collections import defaultdict
Expand Down Expand Up @@ -684,8 +683,4 @@ def main(args: Any) -> None:


if __name__ == "__main__":
# When under `bazel run`, change to the actual working dir.
if "BUILD_WORKING_DIRECTORY" in os.environ:
os.chdir(os.environ["BUILD_WORKING_DIRECTORY"])

main(parse_flags())
5 changes: 0 additions & 5 deletions pycross/private/tools/target_environment_generator.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
from __future__ import annotations

import json
import os
from argparse import Namespace
from dataclasses import dataclass
from dataclasses import field
Expand Down Expand Up @@ -181,10 +180,6 @@ def parse_flags() -> Namespace:


if __name__ == "__main__":
# When under `bazel run`, change to the actual working dir.
if "BUILD_WORKING_DIRECTORY" in os.environ:
os.chdir(os.environ["BUILD_WORKING_DIRECTORY"])

args = parse_flags()
if args.subparser_name == "create":
input_dict = {k: v for k, v in vars(args).items() if v is not None}
Expand Down
5 changes: 0 additions & 5 deletions pycross/private/tools/uv_translator.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
from __future__ import annotations

import os
import re
from collections import defaultdict
from collections.abc import Callable
Expand Down Expand Up @@ -447,8 +446,4 @@ def main(args: Any) -> None:


if __name__ == "__main__":
# When under `bazel run`, change to the actual working dir.
if "BUILD_WORKING_DIRECTORY" in os.environ:
os.chdir(os.environ["BUILD_WORKING_DIRECTORY"])

main(parse_flags())
4 changes: 0 additions & 4 deletions pycross/private/tools/wheel_builder.py
Original file line number Diff line number Diff line change
Expand Up @@ -1030,8 +1030,4 @@ def main_wrapper(args: Any) -> None:


if __name__ == "__main__":
# When under `bazel run`, change to the actual working dir.
if "BUILD_WORKING_DIRECTORY" in os.environ:
os.chdir(os.environ["BUILD_WORKING_DIRECTORY"])

main_wrapper(parse_flags())
4 changes: 0 additions & 4 deletions pycross/private/tools/wheel_installer.py
Original file line number Diff line number Diff line change
Expand Up @@ -157,8 +157,4 @@ def parse_flags() -> Any:


if __name__ == "__main__":
# When under `bazel run`, change to the actual working dir.
if "BUILD_WORKING_DIRECTORY" in os.environ:
os.chdir(os.environ["BUILD_WORKING_DIRECTORY"])

main(parse_flags())

0 comments on commit d04a132

Please sign in to comment.