def check_required_progs():
"""Check if the required programs are installed"""
- shell_not_found = 32512
needed = []
- if rsutil.common.run_command ('par2repair --help > /dev/null 2>&1') == shell_not_found:
- needed.append ('par2repair')
+ try:
+ rsutil.common.run_command(['par2repair', '--help'])
+ except OSError:
+ needed.append('par2repair')
+ except RuntimeError:
+ pass
- if rsutil.common.run_command ('unrar --help > /dev/null 2>&1') == shell_not_found:
- needed.append ('unrar')
+ try:
+ rsutil.common.run_command(['unrar', '--help'])
+ except OSError:
+ needed.append('unrar')
+ except RuntimeError:
+ pass
- if rsutil.common.run_command ('unzip --help > /dev/null 2>&1') == shell_not_found:
- needed.append ('unzip')
+ try:
+ rsutil.common.run_command(['unzip', '--help'])
+ except OSError:
+ needed.append('unzip')
+ except RuntimeError:
+ pass
if needed:
for n in needed:
if options.check_progs:
check_required_progs ()
+ sys.exit (0)
if options.write_def_config:
config.write_config (default=True)
parsets = generate_all_parsets (dir)
for (p2dir, p2file) in parsets:
detector = RarslaveDetector.RarslaveDetector (p2dir, p2file)
- ret = detector.runMatchingTypes ()
+ detector.runMatchingTypes ()
# Non-recursive
else:
parsets = generate_all_parsets (options.work_dir)
for (p2dir, p2file) in parsets:
detector = RarslaveDetector.RarslaveDetector (p2dir, p2file)
- ret = detector.runMatchingTypes ()
+ detector.runMatchingTypes ()
# Print the results
if logger.size () > 0: