Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

FIX: do not lock RTD environment if no uv.lock #449

Merged
merged 1 commit into from
Oct 18, 2024
Merged
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
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
Loading