Python3 support#200
Conversation
|
This should be a solution to issue #127. |
There was a problem hiding this comment.
Why have these been added here? Does wok now not invoke the hooks?
The problem with this is that these hooks get run before the site gets built. Some of the hooks depend on the built HTML, so either they will work with old HTML, or will fail because there is not old HTML.
There was a problem hiding this comment.
They can be removed. I did that while trying to workaround the hooks not running. Fixing it.
|
@inglesp wok is still not py3 compliant, I have a PR for that and requirements is now (hopefully temporarily) pointing at the py3 version I made. You can see the link at the end of the description. |
|
Hi @jneves -- thanks for working on this! I've compared the output of building the site with these changes against the output of building against master, and there's a problem with some stray For instance: |
|
By the way, if you're around at the sprints, I'm in the Osper room sitting at the small table. |
|
@inglesp on it - I'm not around today, unfortunately, but will try to fix this asap. |
|
@inglesp found it - lxml returns byte strings if the content is only ASCII, but unicode strings otherwise #wtf |
|
always returns bytes for me: >>> lxml.html.tostring(lxml.html.fromstring('<html><body><p>hello \U0001F431</p></body></html>'))
b'<html><body><p>hello 🐱</p></body></html>'
>>> lxml.html.tostring(lxml.html.fromstring('<html><body><p>hello foo</p></body></html>'))
b'<html><body><p>hello foo</p></body></html>'
>>> lxml.html.tostring(lxml.html.fromstring('<html><body><p>hello \U0001F431</p></body></html>'), encoding='utf8')
b'<html><body><p>hello \xf0\x9f\x90\xb1</p></body></html>'
>>> lxml.html.tostring(lxml.html.fromstring('<html><body><p>hello foo</p></body></html>'), encoding='utf8')
b'<html><body><p>hello foo</p></body></html>' |
|
you should always pass around SGML and SGML fragments as bytes |
This probably needs a review particularly to make sure it still works with python 2. Several dependencies were updated. LinkChecker was disabled (it was already commented out on the code, so I just removed the requirement instead of porting it to python3). Some of the dependencies, particularly vobject and wok are using github repos that have python3 versions. Wok was also done by me for this, feel free to review and comment that on mythmon/wok#133
This change is