How to use the diffoscope.tools.tool_required function in diffoscope

To help you get started, we’ve selected a few diffoscope examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github anthraxx / diffoscope / diffoscope / comparators / macho.py View on Github external
    @tool_required('otool')
    def cmdline(self):
        return ['otool'] + self.otool_options() + [self.path]
github anthraxx / diffoscope / diffoscope / comparators / elf.py View on Github external
    @tool_required('readelf')
    def cmdline(self):
        return ['readelf', '--wide'] + self.readelf_options() + [self.path]
github anthraxx / diffoscope / diffoscope / comparators / javascript.py View on Github external
    @tool_required('js-beautify')
    def cmdline(self):
        return ['js-beautify', self.path]
github anthraxx / diffoscope / diffoscope / comparators / llvm.py View on Github external
    @tool_required('llvm-dis')
    def cmdline(self):
        # execute llvm-dis from the same directory as the file, so it doesn't
        # embed the whole path, including our tempdir, into the output.
        # this makes it easier to generate reproducible diffs for our tests.
        return ['find', self.path, '-execdir', 'llvm-dis', '-o', '-', '{}', ';']
github anthraxx / diffoscope / diffoscope / comparators / pdf.py View on Github external
    @tool_required('pdftotext')
    def cmdline(self):
        return ['pdftotext', self.path, '-']
github anthraxx / diffoscope / diffoscope / comparators / mono.py View on Github external
    @tool_required('pedump')
    def cmdline(self):
        return ['pedump', self.path]
github anthraxx / diffoscope / diffoscope / comparators / haskell.py View on Github external
    @tool_required('ghc')
    def cmdline(self):
        return ['ghc', '--show-iface', self.path]
github anthraxx / diffoscope / diffoscope / comparators / llvm.py View on Github external
    @tool_required('llvm-bcanalyzer')
    def cmdline(self):
        return ['llvm-bcanalyzer', '-dump', self.path]
github anthraxx / diffoscope / diffoscope / comparators / elf.py View on Github external
@tool_required('readelf')
def get_build_id(path):
    try:
        output = subprocess.check_output(
            ['readelf', '--notes', path],
            stderr=subprocess.DEVNULL,
        )
    except subprocess.CalledProcessError as e:
        logger.debug("Unable to get Build ID for %s: %s", path, e)
        return None

    m = re.search(r'^\s+Build ID: ([0-9a-f]+)$', output.decode('utf-8'), flags=re.MULTILINE)
    if not m:
        return None

    return m.group(1)
github anthraxx / diffoscope / diffoscope / comparators / bzip2.py View on Github external
    @tool_required('bzip2')
    def extract(self, member_name, dest_dir):
        dest_path = os.path.join(dest_dir, member_name)
        logger.debug('bzip2 extracting to %s', dest_path)
        with open(dest_path, 'wb') as fp:
            subprocess.check_call(
                ["bzip2", "--decompress", "--stdout", self.source.path],
                shell=False, stdout=fp, stderr=None)
        return dest_path