1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
|
other: 0.626
mistranslation: 0.615
device: 0.586
instruction: 0.572
semantic: 0.555
graphic: 0.532
assembly: 0.531
network: 0.518
socket: 0.501
boot: 0.486
KVM: 0.470
vnc: 0.465
[Qemu-devel] [Bug] Docs build fails at interop.rst
https://paste.fedoraproject.org/paste/kOPx4jhtUli---TmxSLrlw
running python3-sphinx-2.0.1-1.fc31.noarch on Fedora release 31
(Rawhide)
uname - a
Linux iouring 5.1.0-0.rc6.git3.1.fc31.x86_64 #1 SMP Thu Apr 25 14:25:32
UTC 2019 x86_64 x86_64 x86_64 GNU/Linux
Reverting commmit 90edef80a0852cf8a3d2668898ee40e8970e431
allows for the build to occur
Regards
Aarushi Mehta
On 5/20/19 7:30 AM, Aarushi Mehta wrote:
>
https://paste.fedoraproject.org/paste/kOPx4jhtUli---TmxSLrlw
>
running python3-sphinx-2.0.1-1.fc31.noarch on Fedora release 31
>
(Rawhide)
>
>
uname - a
>
Linux iouring 5.1.0-0.rc6.git3.1.fc31.x86_64 #1 SMP Thu Apr 25 14:25:32
>
UTC 2019 x86_64 x86_64 x86_64 GNU/Linux
>
>
Reverting commmit 90edef80a0852cf8a3d2668898ee40e8970e431
>
allows for the build to occur
>
>
Regards
>
Aarushi Mehta
>
>
Ah, dang. The blocks aren't strictly conforming json, but the version I
tested this under didn't seem to care. Your version is much newer. (I
was using 1.7 as provided by Fedora 29.)
For now, try reverting 9e5b6cb87db66dfb606604fe6cf40e5ddf1ef0e7 instead,
which should at least turn off the "warnings as errors" option, but I
don't think that reverting -n will turn off this warning.
I'll try to get ahold of this newer version and see if I can't fix it
more appropriately.
--js
On 5/20/19 12:37 PM, John Snow wrote:
>
>
>
On 5/20/19 7:30 AM, Aarushi Mehta wrote:
>
>
https://paste.fedoraproject.org/paste/kOPx4jhtUli---TmxSLrlw
>
> running python3-sphinx-2.0.1-1.fc31.noarch on Fedora release 31
>
> (Rawhide)
>
>
>
> uname - a
>
> Linux iouring 5.1.0-0.rc6.git3.1.fc31.x86_64 #1 SMP Thu Apr 25 14:25:32
>
> UTC 2019 x86_64 x86_64 x86_64 GNU/Linux
>
>
>
> Reverting commmit 90edef80a0852cf8a3d2668898ee40e8970e431
>
> allows for the build to occur
>
>
>
> Regards
>
> Aarushi Mehta
>
>
>
>
>
>
Ah, dang. The blocks aren't strictly conforming json, but the version I
>
tested this under didn't seem to care. Your version is much newer. (I
>
was using 1.7 as provided by Fedora 29.)
>
>
For now, try reverting 9e5b6cb87db66dfb606604fe6cf40e5ddf1ef0e7 instead,
>
which should at least turn off the "warnings as errors" option, but I
>
don't think that reverting -n will turn off this warning.
>
>
I'll try to get ahold of this newer version and see if I can't fix it
>
more appropriately.
>
>
--js
>
...Sigh, okay.
So, I am still not actually sure what changed from pygments 2.2 and
sphinx 1.7 to pygments 2.4 and sphinx 2.0.1, but it appears as if Sphinx
by default always tries to do add a filter to the pygments lexer that
raises an error on highlighting failure, instead of the default behavior
which is to just highlight those errors in the output. There is no
option to Sphinx that I am aware of to retain this lexing behavior.
(Effectively, it's strict or nothing.)
This approach, apparently, is broken in Sphinx 1.7/Pygments 2.2, so the
build works with our malformed json.
There are a few options:
1. Update conf.py to ignore these warnings (and all future lexing
errors), and settle for the fact that there will be no QMP highlighting
wherever we use the directionality indicators ('->', '<-').
2. Update bitmaps.rst to remove the directionality indicators.
3. Update bitmaps.rst to format the QMP blocks as raw text instead of JSON.
4. Update bitmaps.rst to remove the "json" specification from the code
block. This will cause sphinx to "guess" the formatting, and the
pygments guesser will decide it's Python3.
This will parse well enough, but will mis-highlight 'true' and 'false'
which are not python keywords. This approach may break in the future if
the Python3 lexer is upgraded to be stricter (because '->' and '<-' are
still invalid), and leaves us at the mercy of both the guesser and the
lexer.
I'm not actually sure what I dislike the least; I think I dislike #1 the
most. #4 gets us most of what we want but is perhaps porcelain.
I suspect if we attempt to move more of our documentation to ReST and
Sphinx that we will need to answer for ourselves how we intend to
document QMP code flow examples.
--js
On Mon, May 20, 2019 at 05:25:28PM -0400, John Snow wrote:
>
>
>
On 5/20/19 12:37 PM, John Snow wrote:
>
>
>
>
>
> On 5/20/19 7:30 AM, Aarushi Mehta wrote:
>
>>
https://paste.fedoraproject.org/paste/kOPx4jhtUli---TmxSLrlw
>
>> running python3-sphinx-2.0.1-1.fc31.noarch on Fedora release 31
>
>> (Rawhide)
>
>>
>
>> uname - a
>
>> Linux iouring 5.1.0-0.rc6.git3.1.fc31.x86_64 #1 SMP Thu Apr 25 14:25:32
>
>> UTC 2019 x86_64 x86_64 x86_64 GNU/Linux
>
>>
>
>> Reverting commmit 90edef80a0852cf8a3d2668898ee40e8970e431
>
>> allows for the build to occur
>
>>
>
>> Regards
>
>> Aarushi Mehta
>
>>
>
>>
>
>
>
> Ah, dang. The blocks aren't strictly conforming json, but the version I
>
> tested this under didn't seem to care. Your version is much newer. (I
>
> was using 1.7 as provided by Fedora 29.)
>
>
>
> For now, try reverting 9e5b6cb87db66dfb606604fe6cf40e5ddf1ef0e7 instead,
>
> which should at least turn off the "warnings as errors" option, but I
>
> don't think that reverting -n will turn off this warning.
>
>
>
> I'll try to get ahold of this newer version and see if I can't fix it
>
> more appropriately.
>
>
>
> --js
>
>
>
>
...Sigh, okay.
>
>
So, I am still not actually sure what changed from pygments 2.2 and
>
sphinx 1.7 to pygments 2.4 and sphinx 2.0.1, but it appears as if Sphinx
>
by default always tries to do add a filter to the pygments lexer that
>
raises an error on highlighting failure, instead of the default behavior
>
which is to just highlight those errors in the output. There is no
>
option to Sphinx that I am aware of to retain this lexing behavior.
>
(Effectively, it's strict or nothing.)
>
>
This approach, apparently, is broken in Sphinx 1.7/Pygments 2.2, so the
>
build works with our malformed json.
>
>
There are a few options:
>
>
1. Update conf.py to ignore these warnings (and all future lexing
>
errors), and settle for the fact that there will be no QMP highlighting
>
wherever we use the directionality indicators ('->', '<-').
>
>
2. Update bitmaps.rst to remove the directionality indicators.
>
>
3. Update bitmaps.rst to format the QMP blocks as raw text instead of JSON.
>
>
4. Update bitmaps.rst to remove the "json" specification from the code
>
block. This will cause sphinx to "guess" the formatting, and the
>
pygments guesser will decide it's Python3.
>
>
This will parse well enough, but will mis-highlight 'true' and 'false'
>
which are not python keywords. This approach may break in the future if
>
the Python3 lexer is upgraded to be stricter (because '->' and '<-' are
>
still invalid), and leaves us at the mercy of both the guesser and the
>
lexer.
>
>
I'm not actually sure what I dislike the least; I think I dislike #1 the
>
most. #4 gets us most of what we want but is perhaps porcelain.
>
>
I suspect if we attempt to move more of our documentation to ReST and
>
Sphinx that we will need to answer for ourselves how we intend to
>
document QMP code flow examples.
Writing a custom lexer that handles "<-" and "->" was simple (see below).
Now, is it possible to convince Sphinx to register and use a custom lexer?
$ cat > /tmp/lexer.py <<EOF
from pygments.lexer import RegexLexer, DelegatingLexer
from pygments.lexers.data import JsonLexer
import re
from pygments.token import *
class QMPExampleMarkersLexer(RegexLexer):
tokens = {
'root': [
(r' *-> *', Generic.Prompt),
(r' *<- *', Generic.Output),
]
}
class QMPExampleLexer(DelegatingLexer):
def __init__(self, **options):
super(QMPExampleLexer, self).__init__(JsonLexer,
QMPExampleMarkersLexer, Error, **options)
EOF
$ pygmentize -l /tmp/lexer.py:QMPExampleLexer -x -f html <<EOF
-> {
"execute": "drive-backup",
"arguments": {
"device": "drive0",
"bitmap": "bitmap0",
"target": "drive0.inc0.qcow2",
"format": "qcow2",
"sync": "incremental",
"mode": "existing"
}
}
<- { "return": {} }
EOF
<div class="highlight"><pre><span></span><span class="gp"> ->
</span><span class="p">{</span>
<span class="nt">"execute"</span><span class="p">:</span>
<span class="s2">"drive-backup"</span><span class="p">,</span>
<span class="nt">"arguments"</span><span class="p">:</span>
<span class="p">{</span>
<span class="nt">"device"</span><span class="p">:</span>
<span class="s2">"drive0"</span><span class="p">,</span>
<span class="nt">"bitmap"</span><span class="p">:</span>
<span class="s2">"bitmap0"</span><span class="p">,</span>
<span class="nt">"target"</span><span class="p">:</span>
<span class="s2">"drive0.inc0.qcow2"</span><span class="p">,</span>
<span class="nt">"format"</span><span class="p">:</span>
<span class="s2">"qcow2"</span><span class="p">,</span>
<span class="nt">"sync"</span><span class="p">:</span>
<span class="s2">"incremental"</span><span class="p">,</span>
<span class="nt">"mode"</span><span class="p">:</span>
<span class="s2">"existing"</span>
<span class="p">}</span>
<span class="p">}</span>
<span class="go"> <- </span><span class="p">{</span> <span
class="nt">"return"</span><span class="p">:</span> <span
class="p">{}</span> <span class="p">}</span>
</pre></div>
$
--
Eduardo
On 5/20/19 7:04 PM, Eduardo Habkost wrote:
>
On Mon, May 20, 2019 at 05:25:28PM -0400, John Snow wrote:
>
>
>
>
>
> On 5/20/19 12:37 PM, John Snow wrote:
>
>>
>
>>
>
>> On 5/20/19 7:30 AM, Aarushi Mehta wrote:
>
>>>
https://paste.fedoraproject.org/paste/kOPx4jhtUli---TmxSLrlw
>
>>> running python3-sphinx-2.0.1-1.fc31.noarch on Fedora release 31
>
>>> (Rawhide)
>
>>>
>
>>> uname - a
>
>>> Linux iouring 5.1.0-0.rc6.git3.1.fc31.x86_64 #1 SMP Thu Apr 25 14:25:32
>
>>> UTC 2019 x86_64 x86_64 x86_64 GNU/Linux
>
>>>
>
>>> Reverting commmit 90edef80a0852cf8a3d2668898ee40e8970e431
>
>>> allows for the build to occur
>
>>>
>
>>> Regards
>
>>> Aarushi Mehta
>
>>>
>
>>>
>
>>
>
>> Ah, dang. The blocks aren't strictly conforming json, but the version I
>
>> tested this under didn't seem to care. Your version is much newer. (I
>
>> was using 1.7 as provided by Fedora 29.)
>
>>
>
>> For now, try reverting 9e5b6cb87db66dfb606604fe6cf40e5ddf1ef0e7 instead,
>
>> which should at least turn off the "warnings as errors" option, but I
>
>> don't think that reverting -n will turn off this warning.
>
>>
>
>> I'll try to get ahold of this newer version and see if I can't fix it
>
>> more appropriately.
>
>>
>
>> --js
>
>>
>
>
>
> ...Sigh, okay.
>
>
>
> So, I am still not actually sure what changed from pygments 2.2 and
>
> sphinx 1.7 to pygments 2.4 and sphinx 2.0.1, but it appears as if Sphinx
>
> by default always tries to do add a filter to the pygments lexer that
>
> raises an error on highlighting failure, instead of the default behavior
>
> which is to just highlight those errors in the output. There is no
>
> option to Sphinx that I am aware of to retain this lexing behavior.
>
> (Effectively, it's strict or nothing.)
>
>
>
> This approach, apparently, is broken in Sphinx 1.7/Pygments 2.2, so the
>
> build works with our malformed json.
>
>
>
> There are a few options:
>
>
>
> 1. Update conf.py to ignore these warnings (and all future lexing
>
> errors), and settle for the fact that there will be no QMP highlighting
>
> wherever we use the directionality indicators ('->', '<-').
>
>
>
> 2. Update bitmaps.rst to remove the directionality indicators.
>
>
>
> 3. Update bitmaps.rst to format the QMP blocks as raw text instead of JSON.
>
>
>
> 4. Update bitmaps.rst to remove the "json" specification from the code
>
> block. This will cause sphinx to "guess" the formatting, and the
>
> pygments guesser will decide it's Python3.
>
>
>
> This will parse well enough, but will mis-highlight 'true' and 'false'
>
> which are not python keywords. This approach may break in the future if
>
> the Python3 lexer is upgraded to be stricter (because '->' and '<-' are
>
> still invalid), and leaves us at the mercy of both the guesser and the
>
> lexer.
>
>
>
> I'm not actually sure what I dislike the least; I think I dislike #1 the
>
> most. #4 gets us most of what we want but is perhaps porcelain.
>
>
>
> I suspect if we attempt to move more of our documentation to ReST and
>
> Sphinx that we will need to answer for ourselves how we intend to
>
> document QMP code flow examples.
>
>
Writing a custom lexer that handles "<-" and "->" was simple (see below).
>
>
Now, is it possible to convince Sphinx to register and use a custom lexer?
>
Spoilers, yes, and I've sent a patch to list. Thanks for your help!
|