Subversion Repositories programming

Compare Revisions

Ignore whitespace Rev 149 → Rev 150

/shell_programs/rarslave.py
45,6 → 45,11
# - Made all regexes case insensitive.
# - Made all command-line options override the config file.
#
# - 2005-10-30
# - Added the '-o' option, to output debugging info. Hopefully next time
# someone finds a bug, they can output this and send it to me with a
# description of the bug they're seeing.
#
 
################################################################################
# REQUIREMENTS:
282,6 → 287,14
self.verified = False
self.extracted = False
 
def print_debug_info(self):
"""Special function for debugging"""
print '========== DEBUG INFO STARTS HERE =========='
print 'parfile: %s' % (self.parfile, )
print 'extra_pars: %s' % (self.extra_pars, )
print 'files: %s' % (self.files, )
print '========== DEBUG INFO ENDS HERE =========='
def get_filenames(self):
return get_par2_filenames(parfile)
 
502,7 → 515,7
 
return parsets
 
def directory_worker(dir):
def directory_worker(dir, options):
"""Attempts to find, verify, and extract every parset in the directory
given as a parameter"""
 
511,14 → 524,22
 
parsets = get_parsets()
 
# Verify each parset
for p in parsets:
p.verify()
# Print debug info if we're supposed to
if options.debug_info:
for p in parsets:
p.debug()
 
# Attempt to extract each parset
for p in parsets:
p.extract()
# No debug info
else:
# Verify each parset
for p in parsets:
p.verify()
 
# Attempt to extract each parset
for p in parsets:
p.extract()
 
os.chdir(cwd)
 
def main():
548,6 → 569,11
action='store_true', dest='write_config',
default=False, help="Write out the current config")
 
parser.add_option('-o', '--output-debug-info',
action='store_true', dest='debug_info',
default=False,
help="Output debug info for every parset, then exit")
 
# Parse the given options
(options, args) = parser.parse_args()
 
569,9 → 595,9
# Run rarslave!
if options.recursive:
for root, dirs, files in os.walk(options.work_dir):
directory_worker(root)
directory_worker(root, options)
else:
directory_worker(options.work_dir)
directory_worker(options.work_dir, options)
 
if __name__ == '__main__':
main()