From 30c58834bd628d725a8eb6b7be53f000cd624caf Mon Sep 17 00:00:00 2001 From: Bastian Kleineidam Date: Mon, 22 Feb 2010 21:55:16 +0100 Subject: [PATCH] Improved format listing --- patoolib/__init__.py | 21 +++++++++++++++++++-- 1 file changed, 19 insertions(+), 2 deletions(-) diff --git a/patoolib/__init__.py b/patoolib/__init__.py index 6680b54..de18a52 100644 --- a/patoolib/__init__.py +++ b/patoolib/__init__.py @@ -191,11 +191,28 @@ def list_formats (): for format in ArchiveFormats: print format, "files:" for command in ArchiveCommands: + programs = ArchivePrograms[format] + if command not in programs and None not in programs: + print " %8s: - (not supported)" % command + continue try: program = find_archive_program(format, command) - print " %8s: %s" % (command, program) + print " %8s: %s" % (command, program), + basename = os.path.basename(program) + if format == 'tar': + encs = [x for x in ArchiveEncodings if find_executable(x)] + if encs: + print "(supported encodings: %s)" % ", ".join(encs), + elif format == '7z': + if os.path.exists('/usr/lib/p7zip/Codecs/Rar29.so'): + print "(rar archives supported)", + else: + print "(rar archives not supported)", + print except util.PatoolError: - print " %8s: - (not supported)" % command + handlers = programs.get(None, programs[command]) + print " %8s: - (no program found; install one of %s)" % \ + (command, ", ".join(handlers)) return 0