Welcome, guest | Sign In | My Account | Store | Cart

Notice! PyPM is being replaced with the ActiveState Platform, which enhances PyPM’s build and deploy capabilities. Create your free Platform account to download ActivePython or customize Python with the packages you require and get automatic updates.

Download
ActivePython

FixIndents is unavailable in PyPM, because there aren't any builds for it in the package repositories. Click the linked icons to find out why.

 Python 2.7Python 3.2Python 3.3
Windows (32-bit)
Windows (64-bit)
Mac OS X (10.5+)
Linux (32-bit)
Linux (64-bit)
0.2 Failed View build log
 
Links
License
MIT
Dependencies
Lastest release
version 0.2 on Jan 9th, 2014

A simple yet flexible utility to convert indentation in your source code files.

Why?

I needed to convert indentations in a source code file, and I wasn't able to find anything really flexible to do this. So, this is an attempt to code something flexible enough to handle any possible use-case.

Installation

From GitHub

To install the latest revision, just clone the repository and run the setup.py script:

git clone https://github.com/mattoufoutu/FixIndents.git
cd FixIndents
python setup.py install
From PyPI

As usual...:

pip install FixIndents

Usage

fixindents -h
usage: fixindents.py [-h] [--version] (--source-tabs | --source-size SIZE)
                     (--dest-tabs | --dest-size SIZE) --source SOURCE
                     (--dest DEST | --debug) [--exclude FOLDERS]
                     [--extensions EXTENSIONS]

A simple yet flexible utility to convert indentation.

optional arguments:
  -h, --help            show this help message and exit
  --version             show program's version number and exit
  --source-tabs         Source file uses tabs for indentation.
  --source-size SIZE    Indents size in source file(s).
  --dest-tabs           Use tabs for indentation in destination file.
  --dest-size SIZE      Indents size in destination file.
  --source SOURCE       File of folder from which code should be read.
  --dest DEST           File or folder to which code should be written.
  --debug               Output converted data to console, don't write
                        anything.
  --exclude FOLDERS     Comma-separated list of directory names to ignore.
                        Only useful when SOURCE is a directory.
  --extensions EXTENSIONS
                        Comma-separated list of specific file extensions to
                        convert. Only useful when SOURCE is a directory.
Exemples

Convert fixindents.py 4-spaces indents to tab indents, write to fixendents_tabs.py:

fixindents.py --source-size 4 --dest-tabs --source fixindents.py --dest fixindents_tabs.py

Convert previously created fixindents_tabs.py to 2-spaces indents, write to fixindents_space.py:

fixindents.py --source-tabs --dest-size 2 --source fixindents_tabs.py --dest fixindents_space.py

Convert all files in the FixIndents folder from 4-spaces to tabs, write to the FixIndentsTabs folder:

fixindents.py --source-size 4 --dest-tabs --source FixIndents --dest FixIndentsTabs

Convert 4-spaces .py files in the FixIndents folder to tabs, write to the FixIndentsTabs folder:

fixindents.py --source-size 4 --dest-tabs --source FixIndents --dest FixIndentsTabs --extentions ".py"

Contribute

Feel free to fork this repository and improve the code, any pull-request will be welcome.

Subscribe to package updates

Last updated Jan 9th, 2014

What does the lock icon mean?

Builds marked with a lock icon are only available via PyPM to users with a current ActivePython Business Edition subscription.

Need custom builds or support?

ActivePython Enterprise Edition guarantees priority access to technical support, indemnification, expert consulting and quality-assured language builds.

Plan on re-distributing ActivePython?

Get re-distribution rights and eliminate legal risks with ActivePython OEM Edition.