|
1 | 1 | """Notifications related to Read the Docs YAML config file."""
|
| 2 | +import textwrap |
2 | 3 |
|
3 | 4 | from django.utils.translation import gettext_noop as _
|
4 | 5 |
|
|
13 | 14 | id=ConfigError.GENERIC,
|
14 | 15 | header=_("There was an unexpected problem in your config file"),
|
15 | 16 | body=_(
|
16 |
| - """ |
| 17 | + textwrap.dedent( |
| 18 | + """ |
17 | 19 | There was an unexpected problem in your config file.
|
18 | 20 | Make sure the encoding is correct.
|
19 | 21 | """
|
| 22 | + ).strip(), |
20 | 23 | ),
|
21 | 24 | type=ERROR,
|
22 | 25 | ),
|
23 | 26 | Message(
|
24 | 27 | id=ConfigError.DEFAULT_PATH_NOT_FOUND,
|
25 | 28 | header=_("Config file not found at default path"),
|
26 | 29 | body=_(
|
27 |
| - """ |
| 30 | + textwrap.dedent( |
| 31 | + """ |
28 | 32 | No default configuration file found at repository's root.
|
29 | 33 | """
|
| 34 | + ).strip(), |
30 | 35 | ),
|
31 | 36 | type=ERROR,
|
32 | 37 | ),
|
33 | 38 | Message(
|
34 | 39 | id=ConfigError.CONFIG_PATH_NOT_FOUND,
|
35 | 40 | header=_("Configuration file not found"),
|
36 | 41 | body=_(
|
37 |
| - """ |
| 42 | + textwrap.dedent( |
| 43 | + """ |
38 | 44 | Configuration file not found in <code>{directory}</code>.
|
39 | 45 | """
|
| 46 | + ).strip(), |
40 | 47 | ),
|
41 | 48 | type=ERROR,
|
42 | 49 | ),
|
43 | 50 | Message(
|
44 | 51 | id=ConfigError.KEY_NOT_SUPPORTED_IN_VERSION,
|
45 | 52 | header=_("Configuration key not supported in this version"),
|
46 | 53 | body=_(
|
47 |
| - """ |
| 54 | + textwrap.dedent( |
| 55 | + """ |
48 | 56 | The <code>{key}</code> configuration option is not supported in this version.
|
49 | 57 | """
|
| 58 | + ).strip(), |
50 | 59 | ),
|
51 | 60 | type=ERROR,
|
52 | 61 | ),
|
53 | 62 | Message(
|
54 | 63 | id=ConfigError.PYTHON_SYSTEM_PACKAGES_REMOVED,
|
55 | 64 | header=_("Invalid configuration key"),
|
56 | 65 | body=_(
|
57 |
| - """ |
| 66 | + textwrap.dedent( |
| 67 | + """ |
58 | 68 | The configuration key <code>python.system_packages</code> has been deprecated and removed.
|
59 | 69 | Refer to https://blog.readthedocs.com/drop-support-system-packages/ to read more
|
60 | 70 | about this change and how to upgrade your config file."
|
61 | 71 | """
|
| 72 | + ).strip(), |
62 | 73 | ),
|
63 | 74 | type=ERROR,
|
64 | 75 | ),
|
65 | 76 | Message(
|
66 | 77 | id=ConfigError.PYTHON_USE_SYSTEM_SITE_PACKAGES_REMOVED,
|
67 | 78 | header=_("Invalid configuration key"),
|
68 | 79 | body=_(
|
69 |
| - """ |
| 80 | + textwrap.dedent( |
| 81 | + """ |
70 | 82 | The configuration key <code>python.use_system_site_packages</code> has been deprecated and removed.
|
71 | 83 | Refer to https://blog.readthedocs.com/drop-support-system-packages/ to read more
|
72 | 84 | about this change and how to upgrade your config file."
|
73 | 85 | """
|
| 86 | + ).strip(), |
74 | 87 | ),
|
75 | 88 | type=ERROR,
|
76 | 89 | ),
|
77 | 90 | Message(
|
78 | 91 | id=ConfigError.INVALID_VERSION,
|
79 | 92 | header=_("Invalid configuration version"),
|
80 | 93 | body=_(
|
81 |
| - """ |
| 94 | + textwrap.dedent( |
| 95 | + """ |
82 | 96 | Invalid version of the configuration file.
|
83 | 97 | """
|
| 98 | + ).strip(), |
84 | 99 | ),
|
85 | 100 | type=ERROR,
|
86 | 101 | ),
|
87 | 102 | Message(
|
88 | 103 | id=ConfigError.GENERIC_INVALID_CONFIG_KEY,
|
89 | 104 | header=_("Invalid configuration option"),
|
90 | 105 | body=_(
|
91 |
| - """ |
| 106 | + textwrap.dedent( |
| 107 | + """ |
92 | 108 | Invalid configuration option: <code>{key}</code>.
|
93 | 109 |
|
94 | 110 | Read the Docs configuration file: <code>{source_file}</code>.
|
95 | 111 |
|
96 | 112 | <code>{error_message}</code>
|
97 | 113 | """
|
| 114 | + ).strip(), |
98 | 115 | ),
|
99 | 116 | type=ERROR,
|
100 | 117 | ),
|
101 | 118 | Message(
|
102 | 119 | id=ConfigError.NOT_BUILD_TOOLS_OR_COMMANDS,
|
103 | 120 | header=_("Invalid configuration option: <code>build</code>"),
|
104 | 121 | body=_(
|
105 |
| - """ |
| 122 | + textwrap.dedent( |
| 123 | + """ |
106 | 124 | At least one item should be provided in "tools" or "commands".
|
107 | 125 | """
|
| 126 | + ).strip(), |
108 | 127 | ),
|
109 | 128 | type=ERROR,
|
110 | 129 | ),
|
111 | 130 | Message(
|
112 | 131 | id=ConfigError.BUILD_JOBS_AND_COMMANDS,
|
113 | 132 | header=_("Invalid configuration option"),
|
114 | 133 | body=_(
|
115 |
| - """ |
| 134 | + textwrap.dedent( |
| 135 | + """ |
116 | 136 | The keys <code>build.jobs</code> and <code>build.commands</code> can't be used together.
|
117 | 137 | """
|
| 138 | + ).strip(), |
118 | 139 | ),
|
119 | 140 | type=ERROR,
|
120 | 141 | ),
|
121 | 142 | Message(
|
122 | 143 | id=ConfigError.APT_INVALID_PACKAGE_NAME_PREFIX,
|
123 | 144 | header=_("Invalid APT package name"),
|
124 | 145 | body=_(
|
125 |
| - """ |
| 146 | + textwrap.dedent( |
| 147 | + """ |
126 | 148 | The name of the packages (e.g. <code>{package}</code>) can't start with <code>{prefix}</code>
|
127 | 149 | """
|
| 150 | + ).strip(), |
128 | 151 | ),
|
129 | 152 | type=ERROR,
|
130 | 153 | ),
|
131 | 154 | Message(
|
132 | 155 | id=ConfigError.APT_INVALID_PACKAGE_NAME,
|
133 | 156 | header=_("Invalid APT package name"),
|
134 | 157 | body=_(
|
135 |
| - """ |
| 158 | + textwrap.dedent( |
| 159 | + """ |
136 | 160 | The name of the package <code>{pacakge}</name> is invalid.
|
137 | 161 | """
|
| 162 | + ).strip(), |
138 | 163 | ),
|
139 | 164 | type=ERROR,
|
140 | 165 | ),
|
141 | 166 | Message(
|
142 | 167 | id=ConfigError.USE_PIP_FOR_EXTRA_REQUIREMENTS,
|
143 | 168 | header=_("Invalid Python install method"),
|
144 | 169 | body=_(
|
145 |
| - """ |
| 170 | + textwrap.dedent( |
| 171 | + """ |
146 | 172 | You need to install your project with pip to use <code>extra_requirements</code>.
|
147 | 173 | """
|
| 174 | + ).strip(), |
148 | 175 | ),
|
149 | 176 | type=ERROR,
|
150 | 177 | ),
|
151 | 178 | Message(
|
152 | 179 | id=ConfigError.PIP_PATH_OR_REQUIREMENT_REQUIRED,
|
153 | 180 | header=_("Invalid configuration key"),
|
154 | 181 | body=_(
|
155 |
| - """ |
| 182 | + textwrap.dedent( |
| 183 | + """ |
156 | 184 | <code>path</code> or <code>requirements</code> key is required for <code>python.install</code>.
|
157 | 185 | """
|
| 186 | + ).strip(), |
158 | 187 | ),
|
159 | 188 | type=ERROR,
|
160 | 189 | ),
|
161 | 190 | Message(
|
162 | 191 | id=ConfigError.SPHINX_MKDOCS_CONFIG_TOGETHER,
|
163 | 192 | header=_("Invalid configuration key"),
|
164 | 193 | body=_(
|
165 |
| - """ |
| 194 | + textwrap.dedent( |
| 195 | + """ |
166 | 196 | You can not have <code>sphinx</code> and <code>mkdocs</code> keys at the same time.
|
167 | 197 | """
|
| 198 | + ).strip(), |
168 | 199 | ),
|
169 | 200 | type=ERROR,
|
170 | 201 | ),
|
171 | 202 | Message(
|
172 | 203 | id=ConfigError.SUBMODULES_INCLUDE_EXCLUDE_TOGETHER,
|
173 | 204 | header=_("Invalid configuration key"),
|
174 | 205 | body=_(
|
175 |
| - """ |
| 206 | + textwrap.dedent( |
| 207 | + """ |
176 | 208 | You can not have <code>exclude</code> and <code>include</code> submodules at the same time.
|
177 | 209 | """
|
| 210 | + ).strip(), |
178 | 211 | ),
|
179 | 212 | type=ERROR,
|
180 | 213 | ),
|
181 | 214 | Message(
|
182 | 215 | id=ConfigError.INVALID_KEY_NAME,
|
183 | 216 | header=_("Invalid configuration key: {key}"),
|
184 | 217 | body=_(
|
185 |
| - """ |
| 218 | + textwrap.dedent( |
| 219 | + """ |
186 | 220 | Make sure the key name <code>{key}</code> is correct.
|
187 | 221 | """
|
| 222 | + ).strip(), |
188 | 223 | ),
|
189 | 224 | type=ERROR,
|
190 | 225 | ),
|
191 | 226 | Message(
|
192 | 227 | id=ConfigError.SYNTAX_INVALID,
|
193 | 228 | header=_("Invalid syntax in configuration file"),
|
194 | 229 | body=_(
|
195 |
| - """ |
| 230 | + textwrap.dedent( |
| 231 | + """ |
196 | 232 | Error while parsing <code>{filename}</code>.
|
197 | 233 |
|
198 | 234 | {error_message}
|
199 | 235 | """
|
| 236 | + ).strip(), |
200 | 237 | ),
|
201 | 238 | type=ERROR,
|
202 | 239 | ),
|
|
209 | 246 | id=ConfigValidationError.INVALID_BOOL,
|
210 | 247 | header=_("Config file validation error"),
|
211 | 248 | body=_(
|
212 |
| - """ |
| 249 | + textwrap.dedent( |
| 250 | + """ |
213 | 251 | Config validation error in <code>{key}</code>.
|
214 | 252 | Expected one of (0, 1, true, false), got <code>{value}</code>.
|
215 | 253 | """
|
| 254 | + ).strip(), |
216 | 255 | ),
|
217 | 256 | type=ERROR,
|
218 | 257 | ),
|
219 | 258 | Message(
|
220 | 259 | id=ConfigValidationError.INVALID_CHOICE,
|
221 | 260 | header=_("Config file validation error"),
|
222 | 261 | body=_(
|
223 |
| - """ |
| 262 | + textwrap.dedent( |
| 263 | + """ |
224 | 264 | Config validation error in <code>{key}</code>.
|
225 | 265 | Expected one of ({choices}), got <code>{value}</code>.
|
226 | 266 | """
|
| 267 | + ).strip(), |
227 | 268 | ),
|
228 | 269 | type=ERROR,
|
229 | 270 | ),
|
230 | 271 | Message(
|
231 | 272 | id=ConfigValidationError.INVALID_DICT,
|
232 | 273 | header=_("Config file validation error"),
|
233 | 274 | body=_(
|
234 |
| - """ |
| 275 | + textwrap.dedent( |
| 276 | + """ |
235 | 277 | Config validation error in <code>{key}</code>.
|
236 | 278 | Expected a dictionary, got <code>{value}</code>.
|
237 | 279 | """
|
| 280 | + ).strip(), |
238 | 281 | ),
|
239 | 282 | type=ERROR,
|
240 | 283 | ),
|
241 | 284 | Message(
|
242 | 285 | id=ConfigValidationError.INVALID_PATH,
|
243 | 286 | header=_("Config file validation error"),
|
244 | 287 | body=_(
|
245 |
| - """ |
| 288 | + textwrap.dedent( |
| 289 | + """ |
246 | 290 | Config validation error in <code>{key}</code>.
|
247 | 291 | The path <code>{value}</code> does not exist.
|
248 | 292 | """
|
| 293 | + ).strip(), |
249 | 294 | ),
|
250 | 295 | type=ERROR,
|
251 | 296 | ),
|
252 | 297 | Message(
|
253 | 298 | id=ConfigValidationError.INVALID_PATH_PATTERN,
|
254 | 299 | header=_("Config file validation error"),
|
255 | 300 | body=_(
|
256 |
| - """ |
| 301 | + textwrap.dedent( |
| 302 | + """ |
257 | 303 | Config validation error in <code>{key}</code>.
|
258 | 304 | The path <code>{value}</code> is not a valid path pattern.
|
259 | 305 | """
|
| 306 | + ).strip(), |
260 | 307 | ),
|
261 | 308 | type=ERROR,
|
262 | 309 | ),
|
263 | 310 | Message(
|
264 | 311 | id=ConfigValidationError.INVALID_STRING,
|
265 | 312 | header=_("Config file validation error"),
|
266 | 313 | body=_(
|
267 |
| - """ |
| 314 | + textwrap.dedent( |
| 315 | + """ |
268 | 316 | Config validation error in <code>{key}</code>.
|
269 | 317 | Expected a string, got <code>{value}</code>.
|
270 | 318 | """
|
| 319 | + ).strip(), |
271 | 320 | ),
|
272 | 321 | type=ERROR,
|
273 | 322 | ),
|
274 | 323 | Message(
|
275 | 324 | id=ConfigValidationError.INVALID_LIST,
|
276 | 325 | header=_("Config file validation error"),
|
277 | 326 | body=_(
|
278 |
| - """ |
| 327 | + textwrap.dedent( |
| 328 | + """ |
279 | 329 | Config validation error in <code>{key}</code>.
|
280 | 330 | Expected a list, got <code>{value}</code>.
|
281 | 331 | """
|
| 332 | + ).strip(), |
282 | 333 | ),
|
283 | 334 | type=ERROR,
|
284 | 335 | ),
|
285 | 336 | Message(
|
286 | 337 | id=ConfigValidationError.VALUE_NOT_FOUND,
|
287 | 338 | header=_("Config file validation error"),
|
288 | 339 | body=_(
|
289 |
| - """ |
| 340 | + textwrap.dedent( |
| 341 | + """ |
290 | 342 | Config validation error in <code>{key}</code>.
|
291 | 343 | Value <code>{value}</code> not found.
|
292 | 344 | """
|
| 345 | + ).strip(), |
293 | 346 | ),
|
294 | 347 | type=ERROR,
|
295 | 348 | ),
|
|
0 commit comments