diff --git a/patoolib/__init__.py b/patoolib/__init__.py index f70174f..91487d7 100644 --- a/patoolib/__init__.py +++ b/patoolib/__init__.py @@ -197,7 +197,7 @@ def find_archive_program (format, command): for program in programs: exe = find_executable(program) if exe: - if program == '7z' and format == 'rar' and not p7zip_supports_rar(): + if program == '7z' and format == 'rar' and not util.p7zip_supports_rar(): continue return exe # no programs found @@ -215,11 +215,6 @@ def find_encoding_program (program, encoding): return None -def p7zip_supports_rar (): - """Determine if the RAR codec is installed for 7z program.""" - return os.path.exists('/usr/lib/p7zip/Codecs/Rar29.so') - - def list_formats (): for format in ArchiveFormats: print format, "files:" @@ -237,7 +232,7 @@ def list_formats (): if encs: print "(supported encodings: %s)" % ", ".join(encs), elif format == '7z': - if p7zip_supports_rar(): + if util.p7zip_supports_rar(): print "(rar archives supported)", else: print "(rar archives not supported)", diff --git a/patoolib/util.py b/patoolib/util.py index cb9ee03..a5176e7 100644 --- a/patoolib/util.py +++ b/patoolib/util.py @@ -98,3 +98,8 @@ def log_internal_error (out=sys.stderr): traceback.print_exc() print >> out, "System info:" print >> out, "Python %s on %s" % (sys.version, sys.platform) + + +def p7zip_supports_rar (): + """Determine if the RAR codec is installed for 7z program.""" + return os.path.exists('/usr/lib/p7zip/Codecs/Rar29.so') diff --git a/tests/__init__.py b/tests/__init__.py index 56f3ac9..810e1fa 100644 --- a/tests/__init__.py +++ b/tests/__init__.py @@ -110,5 +110,5 @@ def needs_codec (program, codec): def find_codec (program, codec): if program == '7z' and codec == 'rar': - return patoolib.p7zip_supports_rar() + return patoolib.util.p7zip_supports_rar() return patoolib.find_encoding_program(program, codec)