Skip to content
This repository has been archived by the owner on Jan 29, 2019. It is now read-only.

Python3 support #200

Open
wants to merge 11 commits into
base: master
Choose a base branch
from
Open

Python3 support #200

wants to merge 11 commits into from

Conversation

jneves
Copy link

@jneves jneves commented Sep 20, 2015

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 Reviewable

@jneves
Copy link
Author

jneves commented Sep 20, 2015

This should be a solution to issue #127.

@@ -11,9 +11,15 @@ help:
@echo ''

build:
python hooks/flat_schedule.py
python hooks/guidebook.py
python hooks/schedule_summary.py
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

They can be removed. I did that while trying to workaround the hooks not running. Fixing it.

@jneves
Copy link
Author

jneves commented Sep 21, 2015

@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.

@inglesp
Copy link
Contributor

inglesp commented Sep 21, 2015

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 b' string prefixes finding their way into the flat schedule.

For instance:

2575c2541
<                     <div class=title><a class="reference external" href="/abstracts/#mellow">The Mellow Night</a>
---
>                     <div class=title>b'<a class="reference external" href="/abstracts/#mellow">The Mellow Night</a>'

@inglesp
Copy link
Contributor

inglesp commented Sep 21, 2015

By the way, if you're around at the sprints, I'm in the Osper room sitting at the small table.

@jneves
Copy link
Author

jneves commented Sep 21, 2015

@inglesp on it - I'm not around today, unfortunately, but will try to fix this asap.

@jneves
Copy link
Author

jneves commented Sep 21, 2015

@inglesp found it - lxml returns byte strings if the content is only ASCII, but unicode strings otherwise #wtf

@graingert
Copy link

always returns bytes for me:

>>> lxml.html.tostring(lxml.html.fromstring('<html><body><p>hello \U0001F431</p></body></html>'))
b'<html><body><p>hello &#128049;</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>'

@graingert
Copy link

you should always pass around SGML and SGML fragments as bytes

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants