##// END OF EJS Templates
Cleanup check_sources and remove hard tabs from some files....
Fernando Perez -
Show More
@@ -19,17 +19,17 b' __docformat__ = "restructuredtext en"'
19 from setuptools import setup
19 from setuptools import setup
20
20
21 infoPlist = dict(
21 infoPlist = dict(
22 CFBundleDevelopmentRegion='English',
22 CFBundleDevelopmentRegion='English',
23 CFBundleIdentifier='org.scipy.ipython.cocoa_frontend',
23 CFBundleIdentifier='org.scipy.ipython.cocoa_frontend',
24 NSPrincipalClass='IPythonCocoaController',
24 NSPrincipalClass='IPythonCocoaController',
25 )
25 )
26
26
27 setup(
27 setup(
28 plugin=['IPythonCocoaFrontendLoader.py'],
28 plugin=['IPythonCocoaFrontendLoader.py'],
29 setup_requires=['py2app'],
29 setup_requires=['py2app'],
30 options=dict(py2app=dict(
30 options=dict(py2app=dict(
31 plist=infoPlist,
31 plist=infoPlist,
32 site_packages=True,
32 site_packages=True,
33 excludes=['IPython','twisted','PyObjCTools']
33 excludes=['IPython','twisted','PyObjCTools']
34 )),
34 )),
35 ) No newline at end of file
35 )
@@ -44,7 +44,7 b' class _Helper(object):'
44
44
45 def __call__(self, *args, **kwds):
45 def __call__(self, *args, **kwds):
46 class DummyWriter(object):
46 class DummyWriter(object):
47 '''Dumy class to handle help output'''
47 '''Dumy class to handle help output'''
48 def __init__(self, pager):
48 def __init__(self, pager):
49 self._pager = pager
49 self._pager = pager
50
50
@@ -76,12 +76,12 b' class WxNonBlockingIPShell(NonBlockingIPShell):'
76 """ A replacement from python's raw_input.
76 """ A replacement from python's raw_input.
77 """
77 """
78 self.answer = None
78 self.answer = None
79 if(self._threading == True):
79 if(self._threading == True):
80 wx.CallAfter(self._yesNoBox, prompt)
80 wx.CallAfter(self._yesNoBox, prompt)
81 while self.answer is None:
81 while self.answer is None:
82 time.sleep(.1)
82 time.sleep(.1)
83 else:
83 else:
84 self._yesNoBox(prompt)
84 self._yesNoBox(prompt)
85 return self.answer
85 return self.answer
86
86
87 def _yesNoBox(self, prompt):
87 def _yesNoBox(self, prompt):
@@ -111,7 +111,7 b' def fix_error_editor(self,filename,linenum,column,msg):'
111
111
112 # vds: >>
112 # vds: >>
113 def synchronize_with_editor(self, filename, linenum, column):
113 def synchronize_with_editor(self, filename, linenum, column):
114 pass
114 pass
115 # vds: <<
115 # vds: <<
116
116
117 class CommandChainDispatcher:
117 class CommandChainDispatcher:
@@ -45,10 +45,10 b' def skipif(skip_condition=True, msg=None):'
45 Parameters
45 Parameters
46 ----------
46 ----------
47 skip_condition : bool or callable.
47 skip_condition : bool or callable.
48 Flag to determine whether to skip test. If the condition is a
48 Flag to determine whether to skip test. If the condition is a
49 callable, it is used at runtime to dynamically make the decision. This
49 callable, it is used at runtime to dynamically make the decision. This
50 is useful for tests that may require costly imports, to delay the cost
50 is useful for tests that may require costly imports, to delay the cost
51 until the test suite is actually executed.
51 until the test suite is actually executed.
52 msg : string
52 msg : string
53 Message to give on raising a SkipTest exception
53 Message to give on raising a SkipTest exception
54
54
@@ -21,7 +21,7 b' from twisted.internet import defer'
21 class DeferredTestCase(unittest.TestCase):
21 class DeferredTestCase(unittest.TestCase):
22
22
23 def assertDeferredEquals(self, deferred, expectedResult,
23 def assertDeferredEquals(self, deferred, expectedResult,
24 chainDeferred=None):
24 chainDeferred=None):
25 """Calls assertEquals on the result of the deferred and expectedResult.
25 """Calls assertEquals on the result of the deferred and expectedResult.
26
26
27 chainDeferred can be used to pass in previous Deferred objects that
27 chainDeferred can be used to pass in previous Deferred objects that
@@ -32,7 +32,7 b' class DeferredTestCase(unittest.TestCase):'
32
32
33 if chainDeferred is None:
33 if chainDeferred is None:
34 chainDeferred = defer.succeed(None)
34 chainDeferred = defer.succeed(None)
35
35
36 def gotResult(actualResult):
36 def gotResult(actualResult):
37 self.assertEquals(actualResult, expectedResult)
37 self.assertEquals(actualResult, expectedResult)
38
38
@@ -41,7 +41,7 b' class DeferredTestCase(unittest.TestCase):'
41 return chainDeferred.addCallback(lambda _: deferred)
41 return chainDeferred.addCallback(lambda _: deferred)
42
42
43 def assertDeferredRaises(self, deferred, expectedException,
43 def assertDeferredRaises(self, deferred, expectedException,
44 chainDeferred=None):
44 chainDeferred=None):
45 """Calls assertRaises on the Failure of the deferred and expectedException.
45 """Calls assertRaises on the Failure of the deferred and expectedException.
46
46
47 chainDeferred can be used to pass in previous Deferred objects that
47 chainDeferred can be used to pass in previous Deferred objects that
@@ -1,18 +1,32 b''
1 #!/usr/bin/env python
1 #!/usr/bin/env python
2 """Utility to look for hard tabs and \r characters in all sources.
2 """Utility to look for hard tabs and \r characters in all sources.
3
4 Usage:
5
6 ./check_sources.py
7
8 It prints summaries and if chosen, line-by-line info of where \\t or \\r
9 characters can be found in our source tree.
3 """
10 """
4
11
5 from IPython.external.path import path
12 # Config
13 # If true, all lines that have tabs are printed, with line number
14 full_report_tabs = True
15 # If true, all lines that have tabs are printed, with line number
16 full_report_rets = False
6
17
7 fs = path('..').walkfiles('*.py')
18 # Code begins
19 from IPython.external.path import path
8
20
9 rets = []
21 rets = []
22 tabs = []
10
23
11 for f in fs:
24 for f in path('..').walkfiles('*.py'):
12 errs = ''
25 errs = ''
13 cont = f.bytes()
26 cont = f.bytes()
14 if '\t' in cont:
27 if '\t' in cont:
15 errs+='t'
28 errs+='t'
29 tabs.append(f)
16
30
17 if '\r' in cont:
31 if '\r' in cont:
18 errs+='r'
32 errs+='r'
@@ -20,13 +34,21 b' for f in fs:'
20
34
21 if errs:
35 if errs:
22 print "%3s" % errs, f
36 print "%3s" % errs, f
23 if 't' in errs:
37
24 for ln,line in enumerate(f.lines()):
38 if 't' in errs and full_report_tabs:
25 if '\t' in line:
39 for ln,line in enumerate(f.lines()):
26 print 'TAB:',ln,':',line,
40 if '\t' in line:
27 if 'r' in errs:
41 print 'TAB:',ln,':',line,
28 for ln,line in enumerate(open(f.abspath(),'rb')):
42
29 if '\r' in line:
43 if 'r' in errs and full_report_rets:
30 print 'RET:',ln,':',line,
44 for ln,line in enumerate(open(f.abspath(),'rb')):
31
45 if '\r' in line:
32 rr = rets[-1]
46 print 'RET:',ln,':',line,
47
48 # Summary at the end, to call cleanup tools if necessary
49 if tabs:
50 print 'Hard tabs found. These can be cleaned with untabify:'
51 for f in tabs: print f,
52 if rets:
53 print 'Carriage returns (\\r) found in:'
54 for f in rets: print f,
General Comments 0
You need to be logged in to leave comments. Login now