summaryrefslogtreecommitdiffstatshomepage
path: root/3rdparty/sol2/Catch/scripts/fixTrailingWhitespace.py
diff options
context:
space:
mode:
author Miodrag Milanovic <mmicko@gmail.com>2017-02-05 16:01:50 +0100
committer Miodrag Milanovic <mmicko@gmail.com>2017-02-05 16:06:06 +0100
commitac096aa2a0921efde96b76252dffb119dcf27efc (patch)
tree2ad9a28a7f6babce8cfcbf5995e3e055ff13ff60 /3rdparty/sol2/Catch/scripts/fixTrailingWhitespace.py
parent29df715138452ee18ba19ec4b07e18c4b3185de7 (diff)
Update sol2 (nw)
Diffstat (limited to '3rdparty/sol2/Catch/scripts/fixTrailingWhitespace.py')
-rw-r--r--3rdparty/sol2/Catch/scripts/fixTrailingWhitespace.py46
1 files changed, 0 insertions, 46 deletions
diff --git a/3rdparty/sol2/Catch/scripts/fixTrailingWhitespace.py b/3rdparty/sol2/Catch/scripts/fixTrailingWhitespace.py
deleted file mode 100644
index a1b6bbe871b..00000000000
--- a/3rdparty/sol2/Catch/scripts/fixTrailingWhitespace.py
+++ /dev/null
@@ -1,46 +0,0 @@
-from __future__ import print_function
-import os
-from scriptCommon import catchPath
-
-changedFiles = 0
-
-def isSourceFile( path ):
- return path.endswith( ".cpp" ) or path.endswith( ".h" ) or path.endswith( ".hpp" )
-
-def fixAllFilesInDir( dir ):
- for f in os.listdir( dir ):
- path = os.path.join( dir,f )
- if os.path.isfile( path ):
- if isSourceFile( path ):
- fixFile( path )
- else:
- fixAllFilesInDir( path )
-
-def fixFile( path ):
- f = open( path, 'r' )
- lines = []
- changed = 0
- for line in f:
- trimmed = line.rstrip() + "\n"
- if trimmed != line:
- changed = changed +1
- lines.append( trimmed )
- f.close()
- if changed > 0:
- global changedFiles
- changedFiles = changedFiles + 1
- print( path + ":" )
- print( " - fixed " + str(changed) + " line(s)" )
- altPath = path + ".backup"
- os.rename( path, altPath )
- f2 = open( path, 'w' )
- for line in lines:
- f2.write( line )
- f2.close()
- os.remove( altPath )
-
-fixAllFilesInDir(catchPath)
-if changedFiles > 0:
- print( "Fixed " + str(changedFiles) + " file(s)" )
-else:
- print( "No trailing whitespace found" )