Skip to content

Upgrade Sphinx #1157

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

Closed
ngzhian opened this issue Mar 26, 2020 · 0 comments · Fixed by #1171
Closed

Upgrade Sphinx #1157

ngzhian opened this issue Mar 26, 2020 · 0 comments · Fixed by #1171
Assignees

Comments

@ngzhian
Copy link
Member

ngzhian commented Mar 26, 2020

Currently we fix Sphinx to 1.7.9 (see https://github.com/WebAssembly/spec/blob/master/.travis.yml#L15), which though was just released in Sept 2018, has already seen many new release (~25, it is at v2.4.4 now). And these release have many, many changes https://www.sphinx-doc.org/en/master/changes.html#release-1-8-0-released-sep-13-2018.

I've been mucking around to see if this will be a straightforward task, generally speaking it is not, since we have a bunch of custom extensions (see https://github.com/WebAssembly/spec/blob/master/document/core/util/mathdef.py) that does interesting stuff. I also don't have a good way of comparing the existing output v.s. the output generated by upgrading to 1.8.0 + fixes to our scripts. Best I can do is try to diff and see what changed, and for binary files like pdfs, click around and see if things work, focusing on the math and math_block nodes.

As I'm typing this, I found #1075, so it looks like upgrading to 1.8.0 might not be as easy to upgrade to v2.3.0 (the version where the accidentally removed function was added back), so I'll try that too.

Side note: instructions for building document/ is incorrect, see https://github.com/WebAssembly/spec/blob/master/document/README.md, pip install sphinx will get you a newer version of Sphinx, which will error out when you build stuff.

@ngzhian ngzhian self-assigned this Mar 26, 2020
ngzhian added a commit to ngzhian/spec that referenced this issue Mar 26, 2020
Couple of breaking changes due to the Sphinx upgrade, requiring fixes:

1. node['latex'] is an invalid access. It was used when Sphinx created
custom math nodes for the math role. But now that docutils supports it,
we don't need to do this anymore.
2. we copied latex_visit_math and latex_visit_displaymath from sphinx's
LaTeXTranslator visit_math and visit_math_block, we can't call them
directly because those call respective superclass methods, and since we
call add_node, it will override those methods with ext_latex_visit_math,
and ending up in a stack overflow.
3. directly create a math node rather than calling into docutils
math_role, because it only looks at raw_text, and overrides text,
which contains what we care about (latex code).
4. Similar changes to mathdefbs

Finally we can pin the Sphinx version to 2.3.0 in .travis.yml.

I mostly manually verified that this change is okay, looking at the html
(multi-page), html (single-page), and pdf, checking the math equations,
both inline and block, making sure the links still work.

Issue WebAssembly#1157
ngzhian added a commit that referenced this issue Mar 27, 2020
* Upgrade Sphinx to 2.3.0 and fixes to extensions

Couple of breaking changes due to the Sphinx upgrade, requiring fixes:

1. node['latex'] is an invalid access. It was used when Sphinx created
custom math nodes for the math role. But now that docutils supports it,
we don't need to do this anymore.
2. we copied latex_visit_math and latex_visit_displaymath from sphinx's
LaTeXTranslator visit_math and visit_math_block, we can't call them
directly because those call respective superclass methods, and since we
call add_node, it will override those methods with ext_latex_visit_math,
and ending up in a stack overflow.
3. directly create a math node rather than calling into docutils
math_role, because it only looks at raw_text, and overrides text,
which contains what we care about (latex code).
4. Similar changes to mathdefbs

Finally we can pin the Sphinx version to 2.3.0 in .travis.yml.

I mostly manually verified that this change is okay, looking at the html
(multi-page), html (single-page), and pdf, checking the math equations,
both inline and block, making sure the links still work.

Issue #1157

* Fix Sphinx name in travis.yml

* No sudo for pip install Sphinx

* Add TODOs for code copied from sphinx
ngzhian added a commit to ngzhian/spec that referenced this issue Mar 27, 2020
With the Sphinx upgrade in WebAssembly#1157 we no longer need these sed commands.
At the same time, clean up the way we configure mathjax, using a config
value, instead of sed.
ngzhian added a commit to ngzhian/spec that referenced this issue Mar 28, 2020
Instead of overwriting the nodes, we extend the translators provided by
Sphinx, and customize the visit_math and visit_math_block logic, to do
our hyperlinking logic before calling the base class visit methods. This
allows us to deduplicate the logic we copied earlier.

Issue WebAssembly#1157
rossberg pushed a commit that referenced this issue Mar 30, 2020
With the Sphinx upgrade in #1157 we no longer need these sed commands.
At the same time, clean up the way we configure mathjax, using a config
value, instead of sed.
ngzhian added a commit to ngzhian/spec that referenced this issue Mar 30, 2020
Instead of overwriting the nodes, we extend the translators provided by
Sphinx, and customize the visit_math and visit_math_block logic, to do
our hyperlinking logic before calling the base class visit methods. This
allows us to deduplicate the logic we copied earlier.

Issue WebAssembly#1157
ngzhian added a commit to ngzhian/spec that referenced this issue Mar 31, 2020
Instead of overwriting the nodes, we extend the translators provided by
Sphinx, and customize the visit_math and visit_math_block logic, to do
our hyperlinking logic before calling the base class visit methods. This
allows us to deduplicate the logic we copied earlier.

For mathdefbs.py, remove all latex related logic, since we don't use
this extension to build latex.

Issue WebAssembly#1157
Ms2ger pushed a commit that referenced this issue Mar 31, 2020
Instead of overwriting the nodes, we extend the translators provided by
Sphinx, and customize the visit_math and visit_math_block logic, to do
our hyperlinking logic before calling the base class visit methods. This
allows us to deduplicate the logic we copied earlier.

For mathdefbs.py, remove all latex related logic, since we don't use
this extension to build latex.

Issue #1157
ngzhian added a commit to ngzhian/spec that referenced this issue Apr 2, 2020
ngzhian added a commit to ngzhian/spec that referenced this issue Apr 2, 2020
ngzhian added a commit that referenced this issue Apr 2, 2020
rossberg added a commit that referenced this issue Feb 11, 2021
* Upgrade to latest Sphinx release (2.4.4) (#1171)

Fixes #1157

* Support 4GB of memory both in initial and max.

* [interpreter] Strictify and specify .bin.wast format (#1173)

* Merge nontrapping-float-to-int proposal into spec (#1143)

See the non-trapping-float-to-int-conversions proposal here:

https://github.com/WebAssembly/nontrapping-float-to-int-conversions

* Merge sign-extension-ops proposal into spec (#1144)

See the sign-extension-ops proposal here:

https://github.com/WebAssembly/sign-extension-ops

This PR is built on top of #1143 (merge nontrapping-float-to-int).

* Merge multi-value proposal into spec (#1145)

See the multi-value proposal here:

https://github.com/WebAssembly/multi-value

This PR is built on top of the following PRs:

* #1143 (merge nontrapping-float-to-int)
* #1144 (merge sign-extension-ops)

* [interpreter] Remove junk in README

* [interpreter] Remove junk in README

* [spec] Fix grammar for fractions (#1178)

* [spec] Add missing i64.extend32_s syntax (#1179)

* [js-api][web-api] Fix some markup errors.

* Add a README to the proposals directory.

* Add more address overflow tests (#1188)

There are already tests for effective address overflow, but those have a
large value baked into the offset. These tests all use `1` as the
immediate offset, and use `-1` for the address on the stack, which may
be compiled differently.

* Add a test for non-treelike behavior of stack (#961)

We've recently found a bug in a WebAssembly library we've been working
with where we're mapping WebAssembly to a tree-like IR internally. The
way we parse into this representation, however, has a bug when the
function isn't itself tree-like but rather exibits properties that
exploit a stack machine. For example this isn't so straightforward to
represent in a tree-like fashion:

    (import "" "a" (func $foo))
    (import "" "b" (func $foo (result i32)))
    (func (result i32)
      call $b
      call $b
      call $a
      i32.xor)

The extra `call $a` in the middle is valid `WebAssembly` but needs
special treatment when converting to a more tree-like IR format. I
figured it'd be good to ensure there's a spec test covering this case as
we currently pass the suite of spec tests but still contain this bug!

* [js-api] Various editorial improvements.

* [js-api] Replace pseudo-ASCII characters by normal ones.

This also required disambiguating the references to "module", as there are now
two definitions by that name.

* [js-api] Improve prose in 'run a host function'.

* [js-api] Improve some of the multi-value prose.

* Synchronize js-api tests.

* Add script to synchronize js-api tests.

Co-authored-by: Ng Zhi An <[email protected]>
Co-authored-by: Alon Zakai <[email protected]>
Co-authored-by: Ben Smith <[email protected]>
Co-authored-by: Ms2ger <[email protected]>
Co-authored-by: Alex Crichton <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant