本文整理汇总了Python中diffoscope.difference.Difference.from_command方法的典型用法代码示例。如果您正苦于以下问题:Python Difference.from_command方法的具体用法?Python Difference.from_command怎么用?Python Difference.from_command使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类diffoscope.difference.Difference
的用法示例。
在下文中一共展示了Difference.from_command方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: compare_details
# 需要导入模块: from diffoscope.difference import Difference [as 别名]
# 或者: from diffoscope.difference.Difference import from_command [as 别名]
def compare_details(self, other, source=None):
differences = []
differences.append(Difference.from_command(SquashfsSuperblock, self.path, other.path))
differences.append(Difference.from_command(SquashfsListing, self.path, other.path))
with SquashfsContainer(self).open() as my_container, \
SquashfsContainer(other).open() as other_container:
differences.extend(my_container.compare(other_container))
return differences
示例2: compare_details
# 需要导入模块: from diffoscope.difference import Difference [as 别名]
# 或者: from diffoscope.difference.Difference import from_command [as 别名]
def compare_details(self, other, source=None):
differences = []
differences.append(Difference.from_command(ISO9660PVD, self.path, other.path))
differences.append(Difference.from_command(ISO9660Listing, self.path, other.path))
for extension in ('joliet', 'rockridge'):
try:
differences.append(Difference.from_command(ISO9660Listing, self.path, other.path, command_args=(extension,)))
except subprocess.CalledProcessError:
pass # probably no joliet or rockridge data
return differences
示例3: compare_details
# 需要导入模块: from diffoscope.difference import Difference [as 别名]
# 或者: from diffoscope.difference.Difference import from_command [as 别名]
def compare_details(self, other, source=None):
differences = []
# look up differences in metadata
zipinfo_difference = Difference.from_command(Zipinfo, self.path, other.path) or \
Difference.from_command(ZipinfoVerbose, self.path, other.path)
differences.append(zipinfo_difference)
with ZipContainer(self).open() as my_container, \
ZipContainer(other).open() as other_container:
differences.extend(my_container.compare(other_container))
return differences
示例4: compare_details
# 需要导入模块: from diffoscope.difference import Difference [as 别名]
# 或者: from diffoscope.difference.Difference import from_command [as 别名]
def compare_details(self, other, source=None):
differences = []
differences.append(Difference.from_command(ISO9660PVD, self.path, other.path))
differences.append(Difference.from_command(ISO9660Listing, self.path, other.path))
for extension in ('joliet', 'rockridge'):
try:
differences.append(Difference.from_command(ISO9660Listing, self.path, other.path, command_args=(extension,)))
except subprocess.CalledProcessError:
pass # probably no joliet or rockridge data
with LibarchiveContainer(self).open() as my_container, \
LibarchiveContainer(other).open() as other_container:
differences.extend(my_container.compare(other_container))
return differences
示例5: compare
# 需要导入模块: from diffoscope.difference import Difference [as 别名]
# 或者: from diffoscope.difference.Difference import from_command [as 别名]
def compare(self, other, source=None):
differences = []
try:
find_diff = Difference.from_command(FindAll, self.path, other.path)
if find_diff:
differences.append(find_diff)
except RequiredToolNotFound:
logger.info("Unable to find 'getfacl'.")
differences.extend(compare_meta(self.name, other.name))
with DirectoryContainer(self).open() as my_container, \
DirectoryContainer(other).open() as other_container:
my_names = my_container.get_member_names()
other_names = other_container.get_member_names()
for name in sorted(set(my_names).intersection(other_names)):
my_file = my_container.get_member(name)
other_file = other_container.get_member(name)
with my_file.get_content(), other_file.get_content():
inner_difference = diffoscope.comparators.compare_files(
my_file, other_file, source=name)
meta_differences = compare_meta(my_file.name, other_file.name)
if meta_differences and not inner_difference:
inner_difference = Difference(None, my_file.path, other_file.path)
if inner_difference:
inner_difference.add_details(meta_differences)
differences.append(inner_difference)
if not differences:
return None
difference = Difference(None, self.path, other.path, source)
difference.add_details(differences)
return difference
示例6: compare_details
# 需要导入模块: from diffoscope.difference import Difference [as 别名]
# 或者: from diffoscope.difference.Difference import from_command [as 别名]
def compare_details(self, other, source=None):
differences = []
with TarContainer(self).open() as my_container, \
TarContainer(other).open() as other_container:
differences.append(Difference.from_command(TarListing, self.path, other.path))
differences.extend(my_container.compare(other_container))
return differences
示例7: compare_details
# 需要导入模块: from diffoscope.difference import Difference [as 别名]
# 或者: from diffoscope.difference.Difference import from_command [as 别名]
def compare_details(self, other, source=None):
differences = []
differences.append(Difference.from_command(
CpioContent, self.path, other.path, source="file list"))
with LibarchiveContainer(self).open() as my_container, \
LibarchiveContainer(other).open() as other_container:
differences.extend(my_container.compare(other_container))
return differences
示例8: compare_details
# 需要导入模块: from diffoscope.difference import Difference [as 别名]
# 或者: from diffoscope.difference.Difference import from_command [as 别名]
def compare_details(self, other, source=None):
differences = []
ignore_files = self.container.source.container.source.files_with_same_content_in_data
with DebTarContainer(self, ignore_files).open() as my_container, \
DebTarContainer(other, ignore_files).open() as other_container:
differences.append(Difference.from_command(TarListing, self.path, other.path))
differences.extend(my_container.compare(other_container))
return differences
示例9: compare_binary_files
# 需要导入模块: from diffoscope.difference import Difference [as 别名]
# 或者: from diffoscope.difference.Difference import from_command [as 别名]
def compare_binary_files(file1, file2, source=None):
import diffoscope.comparators.utils
try:
return Difference.from_command(diffoscope.comparators.utils.Xxd, file1.path, file2.path, source=[file1.name, file2.name])
except RequiredToolNotFound:
hexdump1 = hexdump_fallback(file1.path)
hexdump2 = hexdump_fallback(file2.path)
comment = 'xxd not available in path. Falling back to Python hexlify.\n'
return Difference.from_text(hexdump1, hexdump2, file1.name, file2.name, source, comment)
示例10: test_trim_stderr_in_command
# 需要导入模块: from diffoscope.difference import Difference [as 别名]
# 或者: from diffoscope.difference.Difference import from_command [as 别名]
def test_trim_stderr_in_command():
class FillStderr(Command):
def cmdline(self):
return ['tee', '/dev/stderr']
def feed_stdin(self, stdin):
for dummy in range(0, Command.MAX_STDERR_LINES + 1):
stdin.write('error {}\n'.format(self.path).encode('utf-8'))
difference = Difference.from_command(FillStderr, 'dummy1', 'dummy2')
assert '[ 1 lines ignored ]' in difference.comment
示例11: compare_meta
# 需要导入模块: from diffoscope.difference import Difference [as 别名]
# 或者: from diffoscope.difference.Difference import from_command [as 别名]
def compare_meta(path1, path2):
logger.debug('compare_meta(%s, %s)', path1, path2)
differences = []
try:
differences.append(Difference.from_command(Stat, path1, path2))
except RequiredToolNotFound:
logger.warn("'stat' not found! Is PATH wrong?")
try:
lsattr1 = lsattr(path1)
lsattr2 = lsattr(path2)
differences.append(Difference.from_text(
lsattr1, lsattr2, path1, path2, source="lattr"))
except RequiredToolNotFound:
logger.info("Unable to find 'lsattr'.")
try:
differences.append(Difference.from_command(Getfacl, path1, path2))
except RequiredToolNotFound:
logger.info("Unable to find 'getfacl'.")
return [d for d in differences if d is not None]
示例12: compare
# 需要导入模块: from diffoscope.difference import Difference [as 别名]
# 或者: from diffoscope.difference.Difference import from_command [as 别名]
def compare(self, other, source=None):
differences = super().compare(other, source)
details = None
try:
details = Difference.from_command(Pstotext, self.path, other.path)
except RequiredToolNotFound:
logger.debug('ps2ascii not found')
if details:
differences.add_details([details])
return differences
示例13: compare_details
# 需要导入模块: from diffoscope.difference import Difference [as 别名]
# 或者: from diffoscope.difference.Difference import from_command [as 别名]
def compare_details(self, other, source=None):
differences = []
# Check for fat binaries, trigger a difference if the architectures differ
my_archs = MachoFile.get_arch_from_macho(self.path)
other_archs = MachoFile.get_arch_from_macho(other.path)
differences.append(Difference.from_text('\n'.join(my_archs),
'\n'.join(other_archs),
self.name, other.name, source='architectures'))
# Compare common architectures for differences
for common_arch in set(my_archs) & set(other_archs):
differences.append(Difference.from_command(OtoolHeaders, self.path, other.path, command_args=[common_arch],
comment="Mach-O headers for architecture %s" % common_arch))
differences.append(Difference.from_command(OtoolLibraries, self.path, other.path, command_args=[common_arch],
comment="Mach-O load commands for architecture %s" % common_arch))
differences.append(Difference.from_command(OtoolDisassemble, self.path, other.path, command_args=[common_arch],
comment="Code for architecture %s" % common_arch))
return differences
示例14: compare_details
# 需要导入模块: from diffoscope.difference import Difference [as 别名]
# 或者: from diffoscope.difference.Difference import from_command [as 别名]
def compare_details(self, other, source=None):
return [Difference.from_command(CbfsListing, self.path, other.path)]
示例15: compare_details
# 需要导入模块: from diffoscope.difference import Difference [as 别名]
# 或者: from diffoscope.difference.Difference import from_command [as 别名]
def compare_details(self, other, source=None):
return [Difference.from_command(Sqlite3Dump, self.path, other.path)]