Skip to content
Snippets Groups Projects
Commit 85c21007 authored by Chris Lamb's avatar Chris Lamb :eyes:
Browse files

Fallback to the regular .zip container support if apktool is not available by...

Fallback to the regular .zip container support if apktool is not available by simply swapping out the container class at import-time. (Re: #86)

Alternative solution pending.
parent 9a200bc9
No related branches found
No related tags found
No related merge requests found
......@@ -22,7 +22,7 @@ import os.path
import logging
import subprocess
from diffoscope.tools import tool_required
from diffoscope.tools import tool_required, find_executable
from diffoscope.tempfiles import get_temporary_directory
from .utils.file import File
......@@ -172,7 +172,9 @@ class ApkFile(File):
FILE_TYPE_HEADER_PREFIX = b"PK\x03\x04"
FILE_TYPE_RE = re.compile(r'^(Java|Zip) archive data.*\b')
FILE_EXTENSION_SUFFIX = '.apk'
CONTAINER_CLASS = ApkContainer
CONTAINER_CLASS = (
ApkContainer if find_executable('apktool') else ZipContainer
)
def compare_details(self, other, source=None):
return zipinfo_differences(self, other)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment