X-Git-Url: https://www.irasnyder.com/gitweb/?p=rarslave2.git;a=blobdiff_plain;f=rarslave.py;h=18bb540e48de820a5344aee9e8688445e0d0b4b3;hp=7c1b4c8ea12fda90eb7c9e3a346734a9d9ca3a85;hb=3e0a5dd7c7549636eb70c6a641987da66742f1db;hpb=f66165cb39c650eb1cec0b24e07940760d602ffa diff --git a/rarslave.py b/rarslave.py index 7c1b4c8..18bb540 100755 --- a/rarslave.py +++ b/rarslave.py @@ -122,17 +122,28 @@ def generate_all_parsets (dir): 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: @@ -169,6 +180,7 @@ def run_options (options): if options.check_progs: check_required_progs () + sys.exit (0) if options.write_def_config: config.write_config (default=True) @@ -264,14 +276,14 @@ def main (): 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: