diff options
| author | Baptiste Lepilleur <gaiacrtn@free.fr> | 2003-05-07 20:12:39 +0000 |
|---|---|---|
| committer | Baptiste Lepilleur <gaiacrtn@free.fr> | 2003-05-07 20:12:39 +0000 |
| commit | e574fbb976097a58401ef25033e8c8fb63510ace (patch) | |
| tree | 6d5decb35f92b803ea65a56d51db4bdbf0f0d2b4 /devtools | |
| parent | ea186c2750c58bf8fa00ec5a7549424e53d3c2e7 (diff) | |
| download | cppunit-e574fbb976097a58401ef25033e8c8fb63510ace.tar.gz | |
added : small utility to updated all .cvsignore
Diffstat (limited to 'devtools')
| -rw-r--r-- | devtools/cvs-ignore-update.py | 43 |
1 files changed, 43 insertions, 0 deletions
diff --git a/devtools/cvs-ignore-update.py b/devtools/cvs-ignore-update.py new file mode 100644 index 0000000..335f6f7 --- /dev/null +++ b/devtools/cvs-ignore-update.py @@ -0,0 +1,43 @@ +# Explore directory recursively and append the specified line +# to all .cvsignore. +# put together by a newbie to python, use at your own risk! + +import os + +def addEOL( line ): + if len(line) > 0: + line = line.rstrip( '\n\r' ) + '\n' + return line + +def listFiles( dummy, dirName, fileNames ): + print "* Content of directory: ", os.path.abspath(dirName), ":" + for file in fileNames: + print file + +def updateCVSIgnore( linesToAdd, cvsignorePath ): + fread = file( cvsignorePath, 'r' ) + lines = fread.readlines() + fread.close() + + lines.extend( linesToAdd ) + lines = [addEOL(line) for line in lines] + + fwrite = file( cvsignorePath, 'w+' ) + fwrite.writelines( lines ) + fwrite.close() + print 'Updated: ', cvsignorePath + +def listCVSIgnore( linesToAdd, dirName, fileNames ): + print "Exploring: ", os.path.abspath( dirName ) + if ( fileNames.count( 'CVS' ) > 0 ): + fileNames.remove( 'CVS' ) + if ( fileNames.count( '.cvsignore' ) > 0 ): + cvsignorePath = os.path.join( dirName, '.cvsignore' ) + updateCVSIgnore( linesToAdd, os.path.abspath( cvsignorePath ) ) + +#if __name__ == '__main__': +# os.path.walk(sys.argv[1], lister, None) # dir name in cmdline + +lines = [ 'SunWS_cache', 'ir.out' ] + +os.path.walk( ".", listCVSIgnore, lines ) |
