Fully functioning Python 2 and 3 #50

Merged
merged 85 commits into from Nov 29, 2013

Conversation

Projects
None yet
2 participants
Owner

behdad commented Nov 28, 2013

Everything works as well as before in my testing, and some things work better even.

behdad added some commits Nov 27, 2013

@behdad behdad 2to3 --fix=apply 66214cb
@behdad behdad [subset] 2to3 --fix=funcattrs 553c3bb
@behdad behdad 2to3 --fix=has_key bc5e1cb
@behdad behdad 2to3 --fix=import 2b06aaa
@behdad behdad 2to3 --fix=ne 180ace6
@behdad behdad 2to3 --fix=raise cd5aad9
@behdad behdad 2to3 --fix=repr dc7e6f3
@behdad behdad 2to3 equivalent to --fix=tuple_params
I hope I got this all right...
3a9fd30
@behdad behdad [subset] 2to3 --fix=xrange b466efe
@behdad behdad 2to3 --fix=xrange 97dea0a
@behdad behdad 2to3 --fix=numliterals with manual cleanup ecbe4c8
@behdad behdad 2to3 --fix=itertools 4b775ee
@behdad behdad 2to3 --fix=long with manual cleanup 7cc6d27
@behdad behdad 2to3 --fix=filter 28aeabb
@behdad behdad 2to3 --fix=zip with manual cleanup fa5f2e8
@behdad behdad [subset] 2to3 --fix=idioms c2e2e83
@behdad behdad 2to3 --fix=idioms ac1b435
@behdad behdad 2to3 --fix=map with manual cleanup e5ca796
@behdad behdad 2to3 --fix=types with manual fixups 002c32f
@behdad behdad [subset] 2to3 --fix=print with manual fixup 4cd467c
@behdad behdad [inspect] 2to3 --fix=print with manual fixup d7e8d81
@behdad behdad 2to3 --fix=print with manual fixup 3ec6a25
@behdad behdad 2to3 --fix=imports with manual fixups b92c080
@behdad behdad 2to3 --fix=except 223273f
@behdad behdad 2to3 --fix=types manual additions
Don't know why the tool didn't catch these.
b774f9f
@behdad behdad Remove most uses of module string 14fb031
@behdad behdad [inspect] 2to3 --fix=basestring with manual fixup 3e78b60
@behdad behdad 2to3 --fix=basestring with manual fixup 2a9b868
@behdad behdad 2to3 replace use of module new e1d97b8
@behdad behdad 2to3 manual lambda syntax fix 55e7d79
@behdad behdad [subset] 2to3 --fix=dict with manual cleanup 6890d05
@behdad behdad 2to3 --fix=dict with manual cleanup c2297cd
@behdad behdad 2to3 --fix=unicode equivalents
Remove usage of unicode module.  The rest are mostly false
positives.

Remains u'' in macUtils.py and u"" and unichr in M_E_T_A_.py.
9005774
@behdad behdad Add py23 compat layer 503179f
@behdad behdad [inspect] Use py23 4a818a2
@behdad behdad 2to3 Use py23 to close some of the bytes/str/unicode gaps bb0beb7
@behdad behdad [subset] py23 import 36e20ff
@behdad behdad py23 import in all nontrivial source files and unused import cleanup 7ed91ec
@behdad behdad py23 Use bytechr() instead of chr() b7a2d79
@behdad behdad py23 Introduce Tag to autoconvert tag types ac4672e
@behdad behdad [inspect] py23 from __future__ import print_function b21c903
@behdad behdad [subset] py23 from __future__ import print_function cfeafd7
@behdad behdad py23 from __future__ import print_function 30e691e
@behdad behdad [inspect] py23 from __future__ import division and adjust divisions aa9cc89
@behdad behdad [subset] py23 from __future__ import division and adjust divisions a030a0d
@behdad behdad py23 from __future__ import division and adjust divisions 32c10ee
@behdad behdad py23 use Tag in ttLib/__init__ d2f5d2f
@behdad behdad [subset] py23 fix str usage b21c9d3
@behdad behdad py23 introduce byteord() and use it 319c5fd
@behdad behdad py23 Use more Tag() 960280b
@behdad behdad py23 Remove uses of __cmp__ and cmp() b7fd2e1
@behdad behdad py23 tostr()/tobytes() and using them
ttf->xml seems to be mostly working now.
5cf4008
@behdad behdad py23 Automatically convert str/bytes types in sstruct.pack/unpack a0cd41d
@behdad behdad py23 Fix sstruct exception format 1fcd04d
@behdad behdad py23 Add bytesjoin() 821572c
@behdad behdad py23 Use io.BytesIO to replace StringIO.StringIO 3e8795d
@behdad behdad py23 Fix up byteord() implementation d368939
@behdad behdad ps23 More bytes fixes. All ''join()'s fixed 18316aa
@behdad behdad py23 Turn Unicode XML parsing on; more bytes fixes 5f6418d
@behdad behdad py23 XML encoding fixes
Name table entries that are Unicode are written out as native Unicode
now text in the XML now.
6962f0c
@behdad behdad Fix up EBLC/EBDT non-lazy decompile
Fallout from 3d8d5cd.
4be8db0
@behdad behdad py23 Fixup isinstance(..., str) issues faaca76
@behdad behdad py23 Fix DSIG encoding/decoding 816df48
@behdad behdad py23 cmap bytes fix 43e4b3d
@behdad behdad Fix cmap UVS encode/decode on big-endian systems
Previous code didn't make any sense.
2242b26
@behdad behdad Simplify read/writeUint24() c0a9d69
@behdad behdad py23 More bytes fixes 5e1e8f6
@behdad behdad s/latin-1/latin1/g c076261
@behdad behdad py23 Fix CFF string encodings 024d153
@behdad behdad py23 Fix psCharStrings bytes issues 278c88c
@behdad behdad ps23 Fix CFF glyphname encodings d1ba7b5
@behdad behdad Remove __getslice__
Not needed.  __getitem__ handles it just fine.
714b2a6
@behdad behdad Pad DSIG table to even length
Looks like other font generators do.
1a39097
@behdad behdad Revert XML name table format changes
For the sake of separating py23 effort from feature changes,
I'm reverting the name table XML dump format back to what it
was.  I will clean it up after py23 is merged.
ca80208
@behdad behdad [subset] py23 Use new-style classes 1f26289
@behdad behdad [inspect] py23 Use new-style classes b475c03
@behdad behdad py23 Use new-style classes
Such that we get the same semantics in both Python 2 and 3.
e388db5
@behdad behdad py23 Fixup SING/META tables
They have been totally broken for years.
fd68c9d
@behdad behdad Simplify caselessSort() 4069b39
@behdad behdad py23 Add fixedTools: Smart fixedToFloat() and floatToFixed()
Apparently Python 2 and Python 3 have different default
print precisions for floats.  Or at least with my build it
is the case.   As such, for example with amiri-regular.ttf
I see these annoying differences in the ttx output of the
two versions:

77203c77203
<       <component ... scale="0.5999755859375" flags="0x1004"/>
---
>       <component ... scale="0.599975585938" flags="0x1004"/>

That's just gross.  Specially when these numbers are show to
humans, while we know that's just 0.6.  The fixedToFloat()
routine in this module is smart enough to do that.

Not used yet.
2d67a18
@behdad behdad py23 Use fixedToFloat() in glyf table
Sample output:

Before: <component ... scale="0.599975585938" flags="0x1004"/>
After:  <component ... scale="0.6" flags="0x1004"/>

Now the Python 2 and 3 outputs agree on these.
1336105
@behdad behdad Strip name table records before writing to XML
They will be stripped reading back anyone, so any surrounding
whitespace will be lost.  At least this way diffs of ttx files
are cleaner.
1edfe57
@behdad behdad py23 Use fixedToFloat() for fixed version numbers 3fa26d7

behdad referenced this pull request Nov 28, 2013

Closed

Python 2 and 3 #37

moyogo added some commits Nov 29, 2013

@moyogo @behdad moyogo missing from __future__ import print_function in setup.py
python3: sum() can't sum bytes, using b''.join(seq) instead
db08ee2
@moyogo @behdad moyogo from __future__ imports must be first for python 3.3.2
adding \ to break lines in fontTools/misc/transorm.py
unneeded closing parenthesis in T_S_I__1.py
af1c996

@behdad behdad added a commit that referenced this pull request Nov 29, 2013

@behdad behdad Merge pull request #50 from behdad/2and3
Fully functioning Python 2 and 3
b3b21fb

@behdad behdad merged commit b3b21fb into master Nov 29, 2013

behdad deleted the 2and3 branch Jun 19, 2015

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment