Skip to content
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

Polyglot: Support Python 3 too #744

Merged
merged 67 commits into from Mar 3, 2019
Merged

Polyglot: Support Python 3 too #744

merged 67 commits into from Mar 3, 2019

Conversation

ralsina
Copy link
Contributor

@ralsina ralsina commented Feb 12, 2019

Attempt to make the codebase py2/py3 compatible

  • Support installing in py2 and py3
  • Make tests run with py2 and py3 in travis
  • Keep tests passing in py2

And then progressively fix tests in py3 until they all pass (or close enough)

@ralsina
Copy link
Contributor Author

ralsina commented Feb 12, 2019

This breaks math (test_slides and test_issue_363)

@akrabat akrabat changed the title Polyglot [WIP] Polyglot Feb 12, 2019
@ralsina
Copy link
Contributor Author

ralsina commented Feb 12, 2019

Woohoo, 144 failures.

@ralsina
Copy link
Contributor Author

ralsina commented Feb 12, 2019

142!

@ralsina
Copy link
Contributor Author

ralsina commented Feb 12, 2019

140!

@ralsina
Copy link
Contributor Author

ralsina commented Feb 12, 2019

111!

@ralsina
Copy link
Contributor Author

ralsina commented Feb 12, 2019

Extensions are broken in py3, which is unsurprising since they do manual, obscure import things, relevant tests are test_extensions and test_fancytitles

@ralsina
Copy link
Contributor Author

ralsina commented Feb 12, 2019

110!

oz123
oz123 previously approved these changes Feb 12, 2019
@lornajane lornajane dismissed oz123’s stale review February 12, 2019 20:38

The tests are still failing ... hang on :)

@ralsina
Copy link
Contributor Author

ralsina commented Feb 12, 2019

They are going to keep failing for a while, I am done for today ;-)

@ralsina
Copy link
Contributor Author

ralsina commented Feb 13, 2019

109!

@ralsina
Copy link
Contributor Author

ralsina commented Feb 13, 2019

105!

@ralsina
Copy link
Contributor Author

ralsina commented Feb 13, 2019

101! (with svglib instead of svg2rlg)

@ralsina
Copy link
Contributor Author

ralsina commented Feb 13, 2019

100!

@ralsina
Copy link
Contributor Author

ralsina commented Feb 13, 2019

With python 3.7 literally 1 (one) ONE test passes, compared to a couple hundred with 3.6 so ... that needs looking at :-)

Looks like document frames are broken on python 3.7. Printing frames for a very basic document in python 2.7:

[[56.6929133858, 70.8661417323, 481.88976378, 700.157480315, 6, 6, 6, 6,]]

In 3.7:

[[2.0, 7.0, 100.0, 100.0, 6, 6, 6, 6,]]

I am guessing I broke something when removing the map() calls?

@ralsina
Copy link
Contributor Author

ralsina commented Feb 13, 2019

Looks like a bug in adjustUnits

@ralsina
Copy link
Contributor Author

ralsina commented Feb 13, 2019

In python 2.7:

>>> re.split(r'(-?[0-9.]*)', '2cm')
['', '2', 'cm']

In python 3.7:

>>> re.split(r'(-?[0-9.]*)', '2cm')
['', '2', '', '', 'c', '', 'm', '', '']

In python 3.6: same as python 2.7

@ralsina
Copy link
Contributor Author

ralsina commented Feb 13, 2019

Back to 100 failures.

@ralsina
Copy link
Contributor Author

ralsina commented Feb 13, 2019

95!

@ralsina
Copy link
Contributor Author

ralsina commented Feb 13, 2019

I think most of the remaining failures are because I changed how the target reference ids are constructed, which should be easy to fix all in one swoop.

@ralsina
Copy link
Contributor Author

ralsina commented Feb 13, 2019

I probably broke it in 42239d3

@ralsina
Copy link
Contributor Author

ralsina commented Feb 13, 2019

The worst part is that links include object ID, which means they change on each run :-(

@ralsina
Copy link
Contributor Author

ralsina commented Feb 13, 2019

55!

@ralsina
Copy link
Contributor Author

ralsina commented Feb 13, 2019

And that is it for today.

@ralsina
Copy link
Contributor Author

ralsina commented Feb 13, 2019

I think the next problem is in syntax highlighting.

@ralsina
Copy link
Contributor Author

ralsina commented Feb 14, 2019

Interesting one! stylesheet paths are in different order in py2 and py3:

< [INFO] styles.py:113 StylePath:['/Users/ralsina/code/rst2pdf/rst2pdf/styles', '/Users/ralsina/.rst2pdf/styles', '.']
---
> [INFO] styles.py:113 StylePath:['/Users/ralsina/.rst2pdf/styles', '/Users/ralsina/code/rst2pdf/rst2pdf/styles', '.']

@ralsina
Copy link
Contributor Author

ralsina commented Feb 14, 2019

Still 55, but hey, that was just wrong.

@ralsina
Copy link
Contributor Author

ralsina commented Feb 14, 2019

The basic difference seems to be that in python2 RL is inserting colors (specifically 0 0 0 rg) that it doesn't in python3.

The outputs are identical in many tests except for that.

@ralsina
Copy link
Contributor Author

ralsina commented Feb 14, 2019

44!

@akrabat
Copy link
Member

akrabat commented Mar 1, 2019

Rebased against master after merging #755

@akrabat akrabat merged commit 8858112 into master Mar 3, 2019
akrabat added a commit that referenced this pull request Mar 3, 2019
@akrabat akrabat mentioned this pull request Mar 3, 2019
@akrabat akrabat changed the title Polyglot Polyglot: Support Python 3 too Mar 3, 2019
@akrabat akrabat deleted the polyglot branch March 3, 2019 10:27
@oz123
Copy link
Collaborator

oz123 commented Mar 3, 2019

This is most exciting.

@ralsina
Copy link
Contributor Author

ralsina commented Mar 4, 2019

I am very happy. This branch was a lot of work :)

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 this pull request may close these issues.

None yet

3 participants