|
7 | 7 | from pathlib import Path |
8 | 8 |
|
9 | 9 | from sphinx_gallery.sorting import ExplicitOrder |
| 10 | +from sphinx.util import logging as sphinx_logging |
| 11 | + |
| 12 | +logger = sphinx_logging.getLogger(__name__) |
10 | 13 |
|
11 | 14 | # Gallery sections shall be displayed in the following order. |
12 | 15 | # Non-matching sections are inserted at the unsorted position |
@@ -98,7 +101,7 @@ class MplFileExplicitOrder(ExplicitOrder): |
98 | 101 | Use this if you want to ensure that a full order is intentionally maintained. |
99 | 102 | """ |
100 | 103 | def __init__(self, src_dir): |
101 | | - ordered_list = self.read_gallery_order(Path(src_dir)) or [] |
| 104 | + ordered_list = self.read_gallery_order(Path(src_dir).resolve()) or [] |
102 | 105 | super().__init__(ordered_list) |
103 | 106 |
|
104 | 107 | @staticmethod |
@@ -135,13 +138,14 @@ def read_gallery_order(src_dir: Path): |
135 | 138 | non_existing_examples = listed_examples - existing_examples |
136 | 139 | missing_examples = existing_examples - listed_examples |
137 | 140 |
|
| 141 | + rel_txt_path = gallery_order_txt.relative_to(gallery_order_txt.parents[3]) |
138 | 142 | if non_existing_examples: |
139 | | - raise ValueError( |
140 | | - f"The following examples listed in {gallery_order_txt} do not exist: " |
| 143 | + logger.warning( |
| 144 | + f"The following examples listed in {rel_txt_path} do not exist: " |
141 | 145 | f"{', '.join(non_existing_examples)}") |
142 | 146 | if placeholder_index is None and missing_examples: |
143 | | - raise ValueError( |
144 | | - f"The following examples are not listed in {gallery_order_txt}. " |
| 147 | + logger.warning( |
| 148 | + f"The following examples are not listed in {rel_txt_path}. " |
145 | 149 | f"Either include them or add a '*' to indicate where not listed " |
146 | 150 | f"examples should be placed: " |
147 | 151 | f"{', '.join(missing_examples)}" |
|
0 commit comments