diff options
author | Tim Peters <tim.peters@gmail.com> | 2004-07-18 06:16:08 (GMT) |
---|---|---|
committer | Tim Peters <tim.peters@gmail.com> | 2004-07-18 06:16:08 (GMT) |
commit | 182b5aca27d376b08a2904bed42b751496f932f3 (patch) | |
tree | df13115820dbc879c0fe2eae488c9f8c0215a7da /Mac/scripts/cachersrc.py | |
parent | e6ddc8b20b493fef2e7cffb2e1351fe1d238857e (diff) | |
download | cpython-182b5aca27d376b08a2904bed42b751496f932f3.zip cpython-182b5aca27d376b08a2904bed42b751496f932f3.tar.gz cpython-182b5aca27d376b08a2904bed42b751496f932f3.tar.bz2 |
Whitespace normalization, via reindent.py.
Diffstat (limited to 'Mac/scripts/cachersrc.py')
-rw-r--r-- | Mac/scripts/cachersrc.py | 59 |
1 files changed, 29 insertions, 30 deletions
diff --git a/Mac/scripts/cachersrc.py b/Mac/scripts/cachersrc.py index e6524c9..e2eed8b 100644 --- a/Mac/scripts/cachersrc.py +++ b/Mac/scripts/cachersrc.py @@ -10,36 +10,35 @@ import sys import getopt class NoArgsError(Exception): - pass - + pass + def handler((verbose, force), dirname, fnames): - for fn in fnames: - if fn[-5:] == '.rsrc' and fn[-13:] != '.rsrc.df.rsrc': - if force: - try: - os.unlink(os.path.join(dirname, fn + '.df.rsrc')) - except IOError: - pass - macresource.open_pathname(os.path.join(dirname, fn), verbose=verbose) - + for fn in fnames: + if fn[-5:] == '.rsrc' and fn[-13:] != '.rsrc.df.rsrc': + if force: + try: + os.unlink(os.path.join(dirname, fn + '.df.rsrc')) + except IOError: + pass + macresource.open_pathname(os.path.join(dirname, fn), verbose=verbose) + def main(): - try: - opts, args = getopt.getopt(sys.argv[1:], 'vf') - if not args: - raise NoArgsError - except (getopt.GetoptError, NoArgsError): - sys.stderr.write('Usage: cachersrc.py dirname ...\n') - sys.exit(1) - verbose = 0 - force = 0 - for o, v in opts: - if o == '-v': - verbose = 1 - if o == '-f': - force = 1 - for dir in sys.argv[1:]: - os.path.walk(dir, handler, (verbose, force)) - + try: + opts, args = getopt.getopt(sys.argv[1:], 'vf') + if not args: + raise NoArgsError + except (getopt.GetoptError, NoArgsError): + sys.stderr.write('Usage: cachersrc.py dirname ...\n') + sys.exit(1) + verbose = 0 + force = 0 + for o, v in opts: + if o == '-v': + verbose = 1 + if o == '-f': + force = 1 + for dir in sys.argv[1:]: + os.path.walk(dir, handler, (verbose, force)) + if __name__ == '__main__': - main() -
\ No newline at end of file + main() |