diff options
| author | Skip Montanaro <[email protected]> | 2021-02-16 20:14:16 -0600 |
|---|---|---|
| committer | Skip Montanaro <[email protected]> | 2021-02-16 20:14:16 -0600 |
| commit | c2587c76f1b416cdbecb979e54941933246bf856 (patch) | |
| tree | bb61ee9128075ce22af4eafa232f13c2e5a07896 /lib/packmail.py | |
| parent | d90761a005b24018ae237bf551515772a1de656f (diff) | |
| download | python-0.9.1-patched-QoL-c2587c76f1b416cdbecb979e54941933246bf856.tar.xz python-0.9.1-patched-QoL-c2587c76f1b416cdbecb979e54941933246bf856.zip | |
starting over
Diffstat (limited to 'lib/packmail.py')
| -rw-r--r-- | lib/packmail.py | 62 |
1 files changed, 31 insertions, 31 deletions
diff --git a/lib/packmail.py b/lib/packmail.py index 40b5b7a..c7bebe8 100644 --- a/lib/packmail.py +++ b/lib/packmail.py @@ -6,43 +6,43 @@ from stat import ST_MTIME # Pack one file def pack(outfp, file, name): - fp = open(file, 'r') - outfp.write('sed "s/^X//" >' + name + ' <<"!"\n') - while 1: - line = fp.readline() - if not line: break - if line[-1:] <> '\n': - line = line + '\n' - outfp.write('X' + line) - outfp.write('!\n') + fp = open(file, 'r') + outfp.write('sed "s/^X//" >' + name + ' <<"!"\n') + while 1: + line = fp.readline() + if not line: break + if line[-1:] <> '\n': + line = line + '\n' + outfp.write('X' + line) + outfp.write('!\n') # Pack some files from a directory def packsome(outfp, dirname, names): - for name in names: - print name - file = macpath.cat(dirname, name) - pack(outfp, file, name) + for name in names: + print name + file = macpath.cat(dirname, name) + pack(outfp, file, name) # Pack all files from a directory def packall(outfp, dirname): - names = mac.listdir(dirname) - names.sort() - packsome(outfp, dirname, names) + names = mac.listdir(dirname) + names.sort() + packsome(outfp, dirname, names) # Pack all files from a directory that are not older than a give one def packnotolder(outfp, dirname, oldest): - names = mac.listdir(dirname) - oldest = macpath.cat(dirname, oldest) - st = mac.stat(oldest) - mtime = st[ST_MTIME] - todo = [] - for name in names: - print name, '...', - st = mac.stat(macpath.cat(dirname, name)) - if st[ST_MTIME] >= mtime: - print 'Yes.' - todo.append(name) - else: - print 'No.' - todo.sort() - packsome(outfp, dirname, todo) + names = mac.listdir(dirname) + oldest = macpath.cat(dirname, oldest) + st = mac.stat(oldest) + mtime = st[ST_MTIME] + todo = [] + for name in names: + print name, '...', + st = mac.stat(macpath.cat(dirname, name)) + if st[ST_MTIME] >= mtime: + print 'Yes.' + todo.append(name) + else: + print 'No.' + todo.sort() + packsome(outfp, dirname, todo) |
