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

Add support for ttx(1) from fonttools. (Re: reproducible-builds/diffoscope#315)

parent 26310e2c
No related branches found
No related tags found
No related merge requests found
Pipeline #445721 failed
......@@ -29,6 +29,7 @@ Build-Depends:
ffmpeg <!nocheck>,
flake8 <!nocheck>,
fontforge-extras <!nocheck>,
fonttools <!nocheck>,
fp-utils [!ppc64el !s390x] <!nocheck>,
ghc <!nocheck>,
ghostscript <!nocheck>,
......
......@@ -7,7 +7,7 @@
# $ mv debian/tests/control.tmp debian/tests/control
Tests: pytest-with-recommends
Depends: python3-all, diffoscope, black, python3-pytest, python3-h5py, file, linux-image-amd64 [amd64] | linux-image-generic [amd64], abootimg, acl, apksigner, apktool [!ppc64el !s390x], binutils-multiarch, bzip2, caca-utils, colord, coreboot-utils, db-util, default-jdk-headless | default-jdk | java-sdk, device-tree-compiler, docx2txt, e2fsprogs, enjarify, ffmpeg, fontforge-extras, fp-utils [!ppc64el !s390x], genisoimage, gettext, ghc, ghostscript, giflib-tools, gnumeric, gnupg, gnupg-utils, hdf5-tools, imagemagick, jsbeautifier, libarchive-tools, libxmlb-dev, llvm, lz4 | liblz4-tool, mono-utils, ocaml-nox, odt2txt, oggvideotools [!s390x], openssh-client, openssl, pgpdump, poppler-utils, procyon-decompiler, python3-pdfminer, r-base-core, rpm2cpio, sng, sqlite3, squashfs-tools, tcpdump, u-boot-tools, unzip, wabt, xmlbeans, xxd, xz-utils, zip, zstd, androguard, python3-argcomplete, python3-binwalk, python3-defusedxml, python3-distro, python3-guestfs, python3-jsondiff, python3-progressbar, python3-pypdf2, python3-debian, python3-pyxattr, python3-rpm, python3-tlsh
Depends: python3-all, diffoscope, black, python3-pytest, python3-h5py, file, linux-image-amd64 [amd64] | linux-image-generic [amd64], abootimg, acl, apksigner, apktool [!ppc64el !s390x], binutils-multiarch, bzip2, caca-utils, colord, coreboot-utils, db-util, default-jdk-headless | default-jdk | java-sdk, device-tree-compiler, docx2txt, e2fsprogs, enjarify, ffmpeg, fontforge-extras, fonttools, fp-utils [!ppc64el !s390x], genisoimage, gettext, ghc, ghostscript, giflib-tools, gnumeric, gnupg, gnupg-utils, hdf5-tools, imagemagick, jsbeautifier, libarchive-tools, libxmlb-dev, llvm, lz4 | liblz4-tool, mono-utils, ocaml-nox, odt2txt, oggvideotools [!s390x], openssh-client, openssl, pgpdump, poppler-utils, procyon-decompiler, python3-pdfminer, r-base-core, rpm2cpio, sng, sqlite3, squashfs-tools, tcpdump, u-boot-tools, unzip, wabt, xmlbeans, xxd, xz-utils, zip, zstd,
Tests: pytest
Depends: python3-all, diffoscope, python3-pytest, python3-h5py, file, python3-tlsh
......
......@@ -2,7 +2,7 @@
# diffoscope: in-depth comparison of files, archives, and directories
#
# Copyright © 2014-2015 Jérémy Bobbio <lunar@debian.org>
# Copyright © 2015-2018, 2020 Chris Lamb <lamby@debian.org>
# Copyright © 2015-2018, 2020, 2022 Chris Lamb <lamby@debian.org>
#
# diffoscope is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
......@@ -19,6 +19,7 @@
import re
from diffoscope.exc import RequiredToolNotFound
from diffoscope.tools import tool_required
from diffoscope.difference import Difference
......@@ -35,9 +36,23 @@ class Showttf(Command):
return line.decode("latin-1").encode("utf-8")
class Ttx(Command):
@tool_required("ttx")
def cmdline(self):
return ["ttx", "-o-", self.path]
class TtfFile(File):
DESCRIPTION = "TrueType font files"
FILE_TYPE_RE = re.compile(r"^(TrueType|OpenType) font data", re.IGNORECASE)
def compare_details(self, other, source=None):
return [Difference.from_operation(Showttf, self.path, other.path)]
xs = []
for x in (Showttf, Ttx):
try:
xs.append(Difference.from_operation(x, self.path, other.path))
except RequiredToolNotFound as exc:
self.add_comment(exc.get_comment())
return xs
......@@ -216,6 +216,7 @@ EXTERNAL_TOOLS = {
"wasm2wat": {"debian": "wabt", "arch": "wabt", "guix": "wabt"},
"tar": {"debian": "tar", "arch": "tar", "guix": "tar"},
"tcpdump": {"debian": "tcpdump", "arch": "tcpdump", "guix": "tcpdump"},
"ttx": {"debian": "fonttools"},
"unsquashfs": {
"debian": "squashfs-tools",
"arch": "squashfs-tools",
......
......@@ -46,11 +46,14 @@ def differences(ttf1, ttf2):
@skip_unless_tools_exist("showttf")
@skip_unless_tools_exist("ttx")
def test_diff(differences):
assert_diff(differences[0], "ttf_expected_diff")
assert_diff(differences[1], "ttf_ttx_expected_diff")
@skip_unless_tools_exist("showttf")
@skip_unless_tools_exist("ttx")
def test_compare_non_existing(monkeypatch, ttf1):
monkeypatch.setattr(Config(), "new_file", True)
difference = ttf1.compare(MissingFile("/nonexisting", ttf1))
......
@@ -216,15 +216,15 @@
<GlyphID id="210" name="uni0D41_uni0D4D"/>
</GlyphOrder>
<head>
<!-- Most of this table will be recalculated by the compiler -->
<tableVersion value="1.0"/>
<fontRevision value="1.2"/>
- <checkSumAdjustment value="0x2d668113"/>
+ <checkSumAdjustment value="0x2966810f"/>
<magicNumber value="0x5f0f3cf5"/>
<flags value="00000000 00011111"/>
<unitsPerEm value="1024"/>
<created value="Fri Jan 6 19:21:03 2006"/>
<modified value="Tue May 11 11:54:49 2010"/>
<xMin value="-335"/>
<yMin value="-472"/>
@@ -12752,15 +12752,15 @@
<namerecord nameID="1" platformID="1" platEncID="0" langID="0x0" unicode="True">
Samyak Malayalam
</namerecord>
<namerecord nameID="2" platformID="1" platEncID="0" langID="0x0" unicode="True">
Medium
</namerecord>
<namerecord nameID="3" platformID="1" platEncID="0" langID="0x0" unicode="True">
- FontForge 2.0 : Samyak Malayalam : 23-6-2015
+ FontForge 2.0 : Samyak Malayalam : 25-6-2015
</namerecord>
<namerecord nameID="4" platformID="1" platEncID="0" langID="0x0" unicode="True">
Samyak Malayalam
</namerecord>
<namerecord nameID="5" platformID="1" platEncID="0" langID="0x0" unicode="True">
Original Version 1.00 (2005)
</namerecord>
@@ -12810,15 +12810,15 @@
<namerecord nameID="1" platformID="3" platEncID="1" langID="0x409">
Samyak Malayalam
</namerecord>
<namerecord nameID="2" platformID="3" platEncID="1" langID="0x409">
Medium
</namerecord>
<namerecord nameID="3" platformID="3" platEncID="1" langID="0x409">
- FontForge 2.0 : Samyak Malayalam : 23-6-2015
+ FontForge 2.0 : Samyak Malayalam : 25-6-2015
</namerecord>
<namerecord nameID="4" platformID="3" platEncID="1" langID="0x409">
Samyak Malayalam
</namerecord>
<namerecord nameID="5" platformID="3" platEncID="1" langID="0x409">
Original Version 1.00 (2005)
</namerecord>
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