26 Nov 2009 titus   » (Journeyer)

Comparing two Python source files for equivalence

We've been doing some wholesale PEP 8 reformatting over in the pygr project and we're trying to figure out how to review the changes to make sure nothing inadvertently got broken. Most of the changes are in spacing and line breaks, not in variable names, so I think what we really want is a whitespace-ignoring diff utility. That's not that difficult to find -- except that we're coding in Python, so relative whitespace indentation levels are significant!

Any suggestions for tools that could help?

I've tried several approaches based on tokenizing and using ASTs, but I'm not that clever. I'm going to take another look at processing two token streams, and if that doesn't work, I think 2to3 may hold the key...

--titus

Syndicated 2009-11-26 14:20:12 from Titus Brown

Latest blog entries     Older blog entries

New Advogato Features

New HTML Parser: The long-awaited libxml2 based HTML parser code is live. It needs further work but already handles most markup better than the original parser.

Keep up with the latest Advogato features by reading the Advogato status blog.

If you're a C programmer with some spare time, take a look at the mod_virgule project page and help us with one of the tasks on the ToDo list!