Skip to content
Draft
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
2 changes: 1 addition & 1 deletion MODULE.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ bazel_dep(name = "rules_pkg", version = "1.1.0")
# Python version
#
###############################################################################
bazel_dep(name = "rules_python", version = "1.4.1")
bazel_dep(name = "rules_python", version = "1.5.0")

PYTHON_VERSION = "3.12"

Expand Down
4 changes: 4 additions & 0 deletions src/extensions/BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -20,4 +20,8 @@ py_library(
srcs = ["@score_docs_as_code//src/extensions:score_plantuml.py"],
imports = ["."],
visibility = ["//visibility:public"],
deps = [
"@rules_python//python/runfiles",
"@score_docs_as_code//src:plantuml_for_python",
],
)
6 changes: 3 additions & 3 deletions src/extensions/score_plantuml.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,24 +24,24 @@
In addition it sets common PlantUML options, like output to svg_obj.
"""

import os
import sys
from pathlib import Path

from python.runfiles import Runfiles
from sphinx.application import Sphinx
from sphinx.util import logging

logger = logging.getLogger(__name__)


def get_runfiles_dir() -> Path:
if r := os.getenv("RUNFILES_DIR"):
if (r := Runfiles.Create()) and (rd := r.EnvVars().get("RUNFILES_DIR")):
# Runfiles are only available when running in Bazel.
# bazel build and bazel run are both supported.
# i.e. `bazel build //:docs` and `bazel run //:docs`.
logger.debug("Using runfiles to determine plantuml path.")

runfiles_dir = Path(r)
runfiles_dir = Path(rd)

else:
# The only way to land here is when running from within the virtual
Expand Down
Loading