Skip to content

Commit

Permalink
FIX: do not lock RTD environment if no uv.lock
Browse files Browse the repository at this point in the history
  • Loading branch information
redeboer committed Oct 18, 2024
1 parent 53c83e7 commit 537e632
Showing 1 changed file with 17 additions and 10 deletions.
27 changes: 17 additions & 10 deletions src/compwa_policy/check_dev_files/readthedocs.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@

from compwa_policy.errors import PrecommitError
from compwa_policy.utilities import CONFIG_PATH, get_nested_dict
from compwa_policy.utilities.match import git_ls_files
from compwa_policy.utilities.pyproject import get_constraints_file
from compwa_policy.utilities.yaml import create_prettier_round_trip_yaml

Expand Down Expand Up @@ -192,18 +193,24 @@ def _update_build_step_for_pixi(config: ReadTheDocs) -> None:


def _update_build_step_for_uv(config: ReadTheDocs) -> None:
new_command = "export UV_LINK_MODE=copy"
if "uv.lock" in set(git_ls_files(untracked=True)):
new_command += dedent(R"""
uv run --extra doc --locked --with tox \
tox -e doc
""")
else:
new_command += dedent(R"""
uv run --extra doc --with tox \
tox -e doc
""")
new_command += dedent(R"""
mkdir -p $READTHEDOCS_OUTPUT
mv docs/_build/html $READTHEDOCS_OUTPUT
""").strip()
__update_build_step(
config,
new_command=dedent(R"""
export UV_LINK_MODE=copy
uv run \
--extra doc \
--locked \
--with tox \
tox -e doc
mkdir -p $READTHEDOCS_OUTPUT
mv docs/_build/html $READTHEDOCS_OUTPUT
""").strip(),
new_command,
search_function=lambda command: (
"python3 -m sphinx" in command
or "sphinx-build" in command
Expand Down

0 comments on commit 537e632

Please sign in to comment.