Status: Accepted
Owner: vlada.pe...@gmail.com
CC: asmeurer
Labels: Type-Defect Priority-Medium Python3

New issue 2673 by vlada.pe...@gmail.com: Improve the use2to3 script
http://code.google.com/p/sympy/issues/detail?id=2673

The discussion around the pull request adding the script[1] mentioned several issues with the script as-is. This didn't stop the pull request, but should still be addressed:

* Use "git ls-files". Currently, the script traverses the whole source and grabs all .py files, skipping a few specific directories. If the user has some extra python files around they might crash 2to3; also, all files will be copied to a new directory and this is also not optimal. ls-files ought to be faster, too. This should fail gracefully when git or the repo is not present, though (fallback to the current solution).

* Call the strip_whitespace utility. There is an upstream issue, see[2], where 2to3 adds an extra space causing code_quality tests to fail. As it's unlikely this will get fixed upstream any time soon, Aaron suggested having use2to3 call the strip_whitespace script automatically.

* The shebang line should maybe be changed to use python3. I don't agree with this: at least Arch has already switched to having Python 3 the default Python version and a python3 shebang there might break things; this is likely a trend that is going to continue. Still, if there's consensus to use it then I'll make the change.

* Change all shebang lines to use python3 (Aaron, am I interpreting your comment[3] correctly here?). See above bullet-point. I actually have to test this more to see what exactly happens, but if we decide to do this probably the best way would be to write a custom fixer that changes shebang lines (so we can reuse the 2to3 machinery, rather than hacking something up).

* Allow a "--destination" argument so the user can specify the dir to copy the code too. This is mentioned in script itself as a TODO; I don't see it as high priority.

These are roughly in the order of priority. I'll work on the first two at least, I'd like to hear everyone's opinion on the third bullet-point. Aaron, did I forget something you mentioned?

[1] https://github.com/sympy/sympy/pull/558
[2] http://bugs.python.org/issue12771
[3] https://github.com/sympy/sympy/pull/558#issuecomment-1864417

--
You received this message because you are subscribed to the Google Groups 
"sympy-issues" group.
To post to this group, send email to sympy-issues@googlegroups.com.
To unsubscribe from this group, send email to 
sympy-issues+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/sympy-issues?hl=en.

Reply via email to