Skip to content
Merged
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
10 changes: 6 additions & 4 deletions template/.readthedocs.yml.jinja
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,13 @@ version: 2
build:
os: ubuntu-24.04
tools:
python: {{ latest_python_version }}
{% if 'libsndfile1' in apt_packages -%}
python: "{{ latest_python_version }}"
{%- if apt_packages != "" %}
apt_packages:
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sorry, I did not see it earlier, I think we can loop through all apt_packages here in the list below. In this way every package in apt_packages will be installed, which is also the intended use.

- libsndfile1
{%- endif %}
{%- for package in apt_packages.split(',') %}
- {{ package.strip() }}
{%- endfor %}
{%- endif %}

{%- if add_submodules == true %}

Expand Down
14 changes: 12 additions & 2 deletions tests/test_copier.py
Original file line number Diff line number Diff line change
Expand Up @@ -175,8 +175,9 @@ def test_content_docs_multiple_files(default_project, file_name):


@pytest.mark.parametrize("desired", [
'- libsndfile1',
"python: 3.14",
' apt_packages:\n'
' - libsndfile1',
' python: "3.14"',
" include:\n - path/to/submodule",
])
def test_content_readthedocs(default_project, desired):
Expand All @@ -185,6 +186,15 @@ def test_content_readthedocs(default_project, desired):
assert desired in content


def test_apt_packages_empty(copie, copier_project_defaults):
project = copie.copy(extra_answers={**copier_project_defaults,
"apt_packages": ""})
content = project.project_dir.joinpath(
".readthedocs.yml").read_text()
not_desired = ' apt_packages:\n -'
assert not_desired not in content


@pytest.mark.parametrize("desired", [
'docs/resources/logos/pyfar_logos_fixed_size_my_project.png',
'your/custom/path/',
Expand Down