blob: 821f7e153801ae218fe4bada9a427680841035cd [file] [log] [blame]
Jack Jansenb5ec5e42000-11-29 10:02:22 +00001Original README for Tabcleaner.py
2
3tabcleaner.py is a utility that reformats leading whitespace in a Python source.
4It uses tokenize.py (from the std distribution) to detect INDENTs and DEDENTs,
5then reformats according to the user's options (tabs-only, spaces-only with
6indent size n, or mixed with tab worth m and indent level of n).
7
8Python does not care about the indent of comments and multi-linestrings.
9tabcleaner places these at what Python considers the current indentlevel. About
10half the time, this is correct; the rest of the time it is probably one indent
11level less than what was desired. It is pretty much guaranteed to be
12syntactically correct, (earlier versions broke on some triple-quoted strings).
13
14With no args, (or "-h") prints usage text.
15
16Contact: gmcm@hypernet.com
17
18Additional comments: I have made a few slight changes. It was written to take
19command line arguments, so that you can set parameters like the size of indents,
20and whether you want the result to be all tabs, or all spaces, or a mixture of
21both (an evil combination, if you ask me). It is set, be default, to change your
22indentation to all tabs.
23
24In the current version of Python, all the code in the standard library is
25indented with only spaces. This is a somewhat awkward standard on the mac, so
26most MacPython code is indented with only tabs. This script can be used to do any
27version, but all tabs is the default, which seems to be the best option for the
28Mac.
29
30How to use it on a Mac:
31
32The script is set up to take filenames (or directory names) on the command line.
33To simulate this behaviour with MacPython, you can build an applet out of it
34(with BuildApplet, which should be in your Python folder). Any files draggged and
35dropped onto the resulting applet will be converted to all tabs, with a backup
36copy havning been saved.
37
38If you want the script to convert to space based indentation, your best bet is
39probably to change the default on line 46 of the file.
40
41-Chris Barker cbarker@jps.net