Skip to content

Commit 2db321c

Browse files
Cleanup
1 parent fd70f24 commit 2db321c

File tree

3 files changed

+2
-54
lines changed

3 files changed

+2
-54
lines changed

src/extensions/score_plantuml.py

Lines changed: 0 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -34,40 +34,6 @@
3434
logger = logging.getLogger(__name__)
3535

3636

37-
# def get_runfiles_dir() -> Path:
38-
# if r := os.getenv("RUNFILES_DIR"):
39-
# # Runfiles are only available when running in Bazel.
40-
# # bazel build and bazel run are both supported.
41-
# # i.e. `bazel build //:docs` and `bazel run //:docs`.
42-
# logger.debug("Using runfiles to determine plantuml path.")
43-
#
44-
# runfiles_dir = Path(r)
45-
#
46-
# else:
47-
# # The only way to land here is when running from within the virtual
48-
# # environment created by the `:ide_support` rule in the BUILD file.
49-
# # i.e. esbonio or manual sphinx-build execution within the virtual
50-
# # environment.
51-
# # We'll still use the plantuml binary from the bazel build.
52-
# # But we need to find it first.
53-
# logger.debug("Running outside bazel.")
54-
#
55-
# git_root = Path.cwd().resolve()
56-
# while not (git_root / ".git").exists():
57-
# git_root = git_root.parent
58-
# if git_root == Path("/"):
59-
# sys.exit("Could not find git root.")
60-
#
61-
# runfiles_dir = git_root / "bazel-bin" / "ide_support.runfiles"
62-
#
63-
# if not runfiles_dir.exists():
64-
# sys.exit(
65-
# f"Could not find runfiles_dir at {runfiles_dir}. "
66-
# "Have a look at README.md for instructions on how to build docs."
67-
# )
68-
# return runfiles_dir
69-
70-
7137
def find_correct_path(runfiles: Path) -> Path:
7238
"""
7339
This ensures that the 'plantuml' binary path is found in local 'score_docs_as_code'

src/helper_lib/__init__.py

Lines changed: 1 addition & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -178,30 +178,12 @@ def get_current_git_hash(git_root: Path) -> str:
178178
raise
179179

180180

181-
# def find_git_root(starting_path: Path | None = None) -> Path:
182-
# workspace = os.getenv("BUILD_WORKSPACE_DIRECTORY")
183-
# if workspace:
184-
# return Path(workspace)
185-
# current: Path = (starting_path or Path(__file__)).resolve()
186-
# for parent in current.parents:
187-
# if (parent / ".git").exists():
188-
# return parent
189-
# sys.exit(
190-
# "Could not find git root. "
191-
# + "Please run this script from the root of the repository."
192-
# )
193-
194-
195-
def get_runfiles_dir(start_path: Path | None = None):
181+
def get_runfiles_dir():
196182
"""
197183
Find the Bazel runfiles directory using bazel_runfiles convention,
198184
fallback to RUNFILES_DIR or relative traversal if needed.
199185
"""
200186
# This makes testing much easier
201-
# if start_path is None:
202-
# cwd = Path.cwd()
203-
# else:
204-
# cwd = start_path
205187
if (r := Runfiles.Create()) and (rd := r.EnvVars().get("RUNFILES_DIR")):
206188
runfiles_dir = Path(rd)
207189
else:

src/helper_lib/test_helper_lib.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -271,7 +271,7 @@ def test_git_root_search_success(git_repo: Path, monkeypatch: pytest.MonkeyPatch
271271
# Have to monkeypatch in order to allow us to test
272272
# the 'else' path inside 'get_runfiles_dir'
273273
monkeypatch.setattr(Path, "cwd", lambda: docs_dir)
274-
result = get_runfiles_dir(start_path=docs_dir)
274+
result = get_runfiles_dir()
275275
assert Path(result) == runfiles_dir
276276

277277

0 commit comments

Comments
 (0)