##// END OF EJS Templates
parse cl_args agnostic of leading '-'...
parse cl_args agnostic of leading '-' leading '-' is stripped from all command-line args for parsing. This means that `ipython --gui=qt` will work, as will `ipython gui=qt` non-leading '-' is still allowed, since rc1 unfortunately made it into EPD this week. help output now includes '--' format, to discourage use of short form. argv passed to scripts specified on the command-line is also fixed Also, parsing will stop at the first unrecognized arg, so `ipython foo.py -i` is *not* the same as `ipython -i foo.py` (foo will get -i, not IPython). This makes passing args to scripts match what should be expected. config tests updated accordingly.

File last commit:

r2116:87ec1117
r4189:c3571a2f
Show More
check_sources.py
54 lines | 1.3 KiB | text/x-python | PythonLexer
#!/usr/bin/env python
"""Utility to look for hard tabs and \r characters in all sources.
Usage:
./check_sources.py
It prints summaries and if chosen, line-by-line info of where \\t or \\r
characters can be found in our source tree.
"""
# Config
# If true, all lines that have tabs are printed, with line number
full_report_tabs = True
# If true, all lines that have tabs are printed, with line number
full_report_rets = False
# Code begins
from IPython.external.path import path
rets = []
tabs = []
for f in path('..').walkfiles('*.py'):
errs = ''
cont = f.bytes()
if '\t' in cont:
errs+='t'
tabs.append(f)
if '\r' in cont:
errs+='r'
rets.append(f)
if errs:
print "%3s" % errs, f
if 't' in errs and full_report_tabs:
for ln,line in enumerate(f.lines()):
if '\t' in line:
print 'TAB:',ln,':',line,
if 'r' in errs and full_report_rets:
for ln,line in enumerate(open(f.abspath(),'rb')):
if '\r' in line:
print 'RET:',ln,':',line,
# Summary at the end, to call cleanup tools if necessary
if tabs:
print 'Hard tabs found. These can be cleaned with untabify:'
for f in tabs: print f,
if rets:
print 'Carriage returns (\\r) found in:'
for f in rets: print f,