Moved p7zip_supports_rar() function to util package where it belongs.
This commit is contained in:
parent
90f4d607df
commit
fdb1f398bf
|
@ -197,7 +197,7 @@ def find_archive_program (format, command):
|
||||||
for program in programs:
|
for program in programs:
|
||||||
exe = find_executable(program)
|
exe = find_executable(program)
|
||||||
if exe:
|
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
|
continue
|
||||||
return exe
|
return exe
|
||||||
# no programs found
|
# no programs found
|
||||||
|
@ -215,11 +215,6 @@ def find_encoding_program (program, encoding):
|
||||||
return None
|
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 ():
|
def list_formats ():
|
||||||
for format in ArchiveFormats:
|
for format in ArchiveFormats:
|
||||||
print format, "files:"
|
print format, "files:"
|
||||||
|
@ -237,7 +232,7 @@ def list_formats ():
|
||||||
if encs:
|
if encs:
|
||||||
print "(supported encodings: %s)" % ", ".join(encs),
|
print "(supported encodings: %s)" % ", ".join(encs),
|
||||||
elif format == '7z':
|
elif format == '7z':
|
||||||
if p7zip_supports_rar():
|
if util.p7zip_supports_rar():
|
||||||
print "(rar archives supported)",
|
print "(rar archives supported)",
|
||||||
else:
|
else:
|
||||||
print "(rar archives not supported)",
|
print "(rar archives not supported)",
|
||||||
|
|
|
@ -98,3 +98,8 @@ def log_internal_error (out=sys.stderr):
|
||||||
traceback.print_exc()
|
traceback.print_exc()
|
||||||
print >> out, "System info:"
|
print >> out, "System info:"
|
||||||
print >> out, "Python %s on %s" % (sys.version, sys.platform)
|
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')
|
||||||
|
|
|
@ -110,5 +110,5 @@ def needs_codec (program, codec):
|
||||||
|
|
||||||
def find_codec (program, codec):
|
def find_codec (program, codec):
|
||||||
if program == '7z' and codec == 'rar':
|
if program == '7z' and codec == 'rar':
|
||||||
return patoolib.p7zip_supports_rar()
|
return patoolib.util.p7zip_supports_rar()
|
||||||
return patoolib.find_encoding_program(program, codec)
|
return patoolib.find_encoding_program(program, codec)
|
||||||
|
|
Loading…
Reference in New Issue