classification
Title: Fixing Tools/scripts/pindent.py
Type: behavior Stage: resolved
Components: Demos and Tools Versions: Python 3.4, Python 3.2, Python 3.3, Python 2.7
process
Status: closed Resolution: fixed
Dependencies: Superseder:
Assigned To: serhiy.storchaka Nosy List: asvetlov, ezio.melotti, python-dev, r.david.murray, serhiy.storchaka
Priority: low Keywords: needs review, patch

Created on 2012-08-02 16:24 by serhiy.storchaka, last changed 2013-01-14 22:45 by serhiy.storchaka. This issue is now closed.

Files
File name Uploaded Description Edit
pindent.patch serhiy.storchaka, 2012-08-05 07:08 review
pindent_2.patch serhiy.storchaka, 2012-12-06 19:32 review
pindent_backup.patch serhiy.storchaka, 2013-01-11 13:09 Fix creating a backup on Windows review
Messages (13)
msg167239 - (view) Author: Serhiy Storchaka (serhiy.storchaka) * (Python committer) Date: 2012-08-02 16:24
Here is a patch which fixes some bugs in Tools/scripts/pindent.py and modernizes it with regard to the new Python features abilities that have made since 1994.

1. Now pindent works with "with".
2. Now pindent does not produce improper indentation (tabs by default for space-indented file). It uses for the end-marks indentation the same sequence of whitespaces that for start operator indentation.
3. Now pindent works with escaped newline "\\\n" at start of line and after "class" and "def".
4. Now pindent does not produce indentation for empty line.
5. Fixed one type in help message.
6. Using io.StringIO.
7. Using booleans, augmented assignments, list.pop(), with operators, etc.
msg167442 - (view) Author: R. David Murray (r.david.murray) * (Python committer) Date: 2012-08-04 21:26
There is now a test_tools, so it would be great to have tests to go along with this patch.

I haven't looked at the patch in detail, but as long as you are modernizing it please kill those "# end ..." lines.
msg167471 - (view) Author: Serhiy Storchaka (serhiy.storchaka) * (Python committer) Date: 2012-08-05 07:08
> 5. Fixed one type in help message.

Typo. Should be "Fixed one typo in help message."

Patch updated, unused experimental variable removed.
msg167472 - (view) Author: Serhiy Storchaka (serhiy.storchaka) * (Python committer) Date: 2012-08-05 07:29
> There is now a test_tools, so it would be great to have tests to go along with this patch.

Well, I'll do it. But the tests most likely will be different for different versions of Python (in contrast to the pindent patch).

"pindent -d" and then "pindent -c" on pindent.py must give the original of pindent.py. It exposes some of the above mentioned bugs.

> I haven't looked at the patch in detail, but as long as you are modernizing it please kill those "# end ..." lines.

This is done deliberately. It demonstrates the purpose of the script.
msg177049 - (view) Author: Serhiy Storchaka (serhiy.storchaka) * (Python committer) Date: 2012-12-06 19:32
Patch updated. Tests added.

I am not sure tests will be passed on Windows.
msg178332 - (view) Author: Serhiy Storchaka (serhiy.storchaka) * (Python committer) Date: 2012-12-27 20:57
If no one objects I will commit this next year.
msg179664 - (view) Author: Roundup Robot (python-dev) Date: 2013-01-11 10:40
New changeset f783db4a58ba by Serhiy Storchaka in branch '2.7':
Issue #15539: Fix a number of bugs in Tools/scripts/pindent.py.
http://hg.python.org/cpython/rev/f783db4a58ba

New changeset 9df6b707aef9 by Serhiy Storchaka in branch '3.2':
Issue #15539: Fix a number of bugs in Tools/scripts/pindent.py.
http://hg.python.org/cpython/rev/9df6b707aef9

New changeset 01df1f7841b2 by Serhiy Storchaka in branch '3.3':
Issue #15539: Fix a number of bugs in Tools/scripts/pindent.py.
http://hg.python.org/cpython/rev/01df1f7841b2

New changeset 8452c23139c6 by Serhiy Storchaka in branch 'default':
Issue #15539: Fix a number of bugs in Tools/scripts/pindent.py.
http://hg.python.org/cpython/rev/8452c23139c6
msg179669 - (view) Author: Ezio Melotti (ezio.melotti) * (Python committer) Date: 2013-01-11 11:23
Some buildbots are failing: 
http://buildbot.python.org/all/builders/AMD64%20Windows7%20SP1%202.7/builds/341/steps/test/logs/stdio
http://buildbot.python.org/all/builders/AMD64%20Windows7%20SP1%203.x/builds/1263/steps/test/logs/stdio
msg179676 - (view) Author: Serhiy Storchaka (serhiy.storchaka) * (Python committer) Date: 2013-01-11 13:09
Here is a patch which should fix creating a backup on Windows. Please test it. If test_tools passes on Windows then I'll commit the patch, in contrary case I'll just skip checking of backup on Windows.
msg179725 - (view) Author: Roundup Robot (python-dev) Date: 2013-01-11 20:23
New changeset 2d0c5f97af48 by Serhiy Storchaka in branch '2.7':
Issue #15539: Fix backup file creation in pindent.py on Windows
http://hg.python.org/cpython/rev/2d0c5f97af48

New changeset a9990104f728 by Serhiy Storchaka in branch '3.2':
Issue #15539: Fix a backup file creation in pindent.py on Windows.
http://hg.python.org/cpython/rev/a9990104f728

New changeset 735361e8709e by Serhiy Storchaka in branch '3.3':
Issue #15539: Fix a backup file creation in pindent.py on Windows.
http://hg.python.org/cpython/rev/735361e8709e

New changeset c46dec051819 by Serhiy Storchaka in branch 'default':
Issue #15539: Fix a backup file creation in pindent.py on Windows.
http://hg.python.org/cpython/rev/c46dec051819
msg179726 - (view) Author: Serhiy Storchaka (serhiy.storchaka) * (Python committer) Date: 2013-01-11 20:27
I hope it will help buidbots.
msg179982 - (view) Author: Andrew Svetlov (asvetlov) * (Python committer) Date: 2013-01-14 21:58
Is it fixed now?
msg179986 - (view) Author: Serhiy Storchaka (serhiy.storchaka) * (Python committer) Date: 2013-01-14 22:45
Yes, it's fixed.
History
Date User Action Args
2013-01-14 22:45:05serhiy.storchakasetmessages: + msg179986
2013-01-14 21:58:13asvetlovsetnosy: + asvetlov
messages: + msg179982
2013-01-12 20:09:35serhiy.storchakasetstatus: open -> closed
stage: patch review -> resolved
2013-01-11 20:27:35serhiy.storchakasetmessages: + msg179726
2013-01-11 20:23:43python-devsetmessages: + msg179725
2013-01-11 13:09:26serhiy.storchakasetstatus: closed -> open
files: + pindent_backup.patch
messages: + msg179676

stage: resolved -> patch review
2013-01-11 11:23:38ezio.melottisetmessages: + msg179669
2013-01-11 10:42:51serhiy.storchakasetstatus: open -> closed
stage: patch review -> resolved
resolution: fixed
versions: + Python 3.4
2013-01-11 10:40:07python-devsetnosy: + python-dev
messages: + msg179664
2012-12-27 20:57:29serhiy.storchakasetassignee: serhiy.storchaka
messages: + msg178332
2012-12-07 16:28:50ezio.melottisetnosy: + ezio.melotti
2012-12-06 19:32:01serhiy.storchakasetfiles: + pindent_2.patch

messages: + msg177049
2012-08-05 11:03:49serhiy.storchakasetkeywords: + needs review
priority: normal -> low
stage: patch review
2012-08-05 07:29:38serhiy.storchakasetmessages: + msg167472
2012-08-05 07:09:03serhiy.storchakasetfiles: - pindent.patch
2012-08-05 07:08:25serhiy.storchakasetfiles: + pindent.patch

messages: + msg167471
2012-08-04 21:26:11r.david.murraysetnosy: + r.david.murray
messages: + msg167442
2012-08-02 16:24:35serhiy.storchakacreate