Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
@tool_required('otool')
def cmdline(self):
return ['otool'] + self.otool_options() + [self.path]
@tool_required('readelf')
def cmdline(self):
return ['readelf', '--wide'] + self.readelf_options() + [self.path]
@tool_required('js-beautify')
def cmdline(self):
return ['js-beautify', self.path]
@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', '-', '{}', ';']
@tool_required('pdftotext')
def cmdline(self):
return ['pdftotext', self.path, '-']
@tool_required('pedump')
def cmdline(self):
return ['pedump', self.path]
@tool_required('ghc')
def cmdline(self):
return ['ghc', '--show-iface', self.path]
@tool_required('llvm-bcanalyzer')
def cmdline(self):
return ['llvm-bcanalyzer', '-dump', self.path]
@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)
@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