Severity 943022 serious Tags 943022 +patch Thanks fonts-noto-color-emoji build-depends on python-nototools, which depends on python-fonttools which is no longer built by the fonttools source package.
Fortunately upstream has fixes that allow this package to be built with python3, I applied them as quilt patches, changed the build-dependency and was able to succesfully build the package. Note that this patch depends on python3-nototools, which is currently only in experimental, and the current version of which cannot be successfully installed. The patch was tested with a locally built python3-nototools that was fixed as described in https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=943761 , that patch needs to be applied and the nototools source package uploaded to unstable before this can be fixed in unstable. Debdiff attatched, no immediate intent to NMU.
diff -Nru fonts-noto-color-emoji-0~20180810/debian/changelog fonts-noto-color-emoji-0~20180810/debian/changelog --- fonts-noto-color-emoji-0~20180810/debian/changelog 2018-08-21 19:26:49.000000000 +0000 +++ fonts-noto-color-emoji-0~20180810/debian/changelog 2019-12-11 02:56:18.000000000 +0000 @@ -1,3 +1,11 @@ +fonts-noto-color-emoji (0~20180810-1.1) UNRELEASED; urgency=medium + + * Change build-dependencies from python-nototools to python3-nototools + * Apply upstream patches for python 3 support. + * Clean up __pycache__ in clean target. + + -- Peter Michael Green <[email protected]> Wed, 11 Dec 2019 02:56:18 +0000 + fonts-noto-color-emoji (0~20180810-1) unstable; urgency=medium * New upstream release (LP: #1788256) diff -Nru fonts-noto-color-emoji-0~20180810/debian/control fonts-noto-color-emoji-0~20180810/debian/control --- fonts-noto-color-emoji-0~20180810/debian/control 2018-08-21 19:26:49.000000000 +0000 +++ fonts-noto-color-emoji-0~20180810/debian/control 2019-12-11 02:56:18.000000000 +0000 @@ -10,7 +10,7 @@ libpng-dev, pkg-config, pngquant, - python-nototools, + python3-nototools, zopfli, Standards-Version: 4.1.3 Homepage: https://www.google.com/get/noto/help/emoji/ diff -Nru fonts-noto-color-emoji-0~20180810/debian/patches/py3-01-a9ca546689d384b0ca73ad2a476891c3caaedc20.patch fonts-noto-color-emoji-0~20180810/debian/patches/py3-01-a9ca546689d384b0ca73ad2a476891c3caaedc20.patch --- fonts-noto-color-emoji-0~20180810/debian/patches/py3-01-a9ca546689d384b0ca73ad2a476891c3caaedc20.patch 1970-01-01 00:00:00.000000000 +0000 +++ fonts-noto-color-emoji-0~20180810/debian/patches/py3-01-a9ca546689d384b0ca73ad2a476891c3caaedc20.patch 2019-12-11 02:50:37.000000000 +0000 @@ -0,0 +1,303 @@ +commit a9ca546689d384b0ca73ad2a476891c3caaedc20 +Author: Mike FABIAN <[email protected]> +Date: Wed Jul 17 10:33:21 2019 +0200 + + Make it work both with Python2 and Python3 + +diff --git a/add_glyphs.py b/add_glyphs.py +index 5c71b61b..36d40e67 100644 +--- a/add_glyphs.py ++++ b/add_glyphs.py +@@ -66,7 +66,7 @@ def collect_seq_to_file(image_dirs, prefix, suffix): + + + def remap_values(seq_to_file, map_fn): +- return {k: map_fn(v) for k, v in seq_to_file.iteritems()} ++ return {k: map_fn(v) for k, v in seq_to_file.items()} + + + def get_png_file_to_advance_mapper(lineheight): +@@ -228,7 +228,7 @@ def get_rtl_seq(seq): + + rev_seq = list(seq) + rev_seq.reverse() +- for i in xrange(1, len(rev_seq)): ++ for i in range(1, len(rev_seq)): + if is_fitzpatrick(rev_seq[i-1]): + tmp = rev_seq[i] + rev_seq[i] = rev_seq[i-1] +@@ -282,7 +282,7 @@ def add_ligature_sequences(font, seqs, aliases): + return + + rtl_seq_to_target_name = { +- get_rtl_seq(seq): name for seq, name in seq_to_target_name.iteritems()} ++ get_rtl_seq(seq): name for seq, name in seq_to_target_name.items()} + seq_to_target_name.update(rtl_seq_to_target_name) + # sequences that don't have rtl variants get mapped to the empty sequence, + # delete it. +@@ -291,7 +291,7 @@ def add_ligature_sequences(font, seqs, aliases): + + # organize by first codepoint in sequence + keyed_ligatures = collections.defaultdict(list) +- for t in seq_to_target_name.iteritems(): ++ for t in seq_to_target_name.items(): + first_cp = t[0][0] + keyed_ligatures[first_cp].append(t) + +@@ -341,7 +341,7 @@ def apply_aliases(seq_dict, aliases): + source is a key in the dictionary, we can delete it. This updates the + dictionary and returns the usable aliases.""" + usable_aliases = {} +- for k, v in aliases.iteritems(): ++ for k, v in aliases.items(): + if v in seq_dict: + usable_aliases[k] = v + if k in seq_dict: +diff --git a/map_pua_emoji.py b/map_pua_emoji.py +index aac031c5..ff8d6a9b 100644 +--- a/map_pua_emoji.py ++++ b/map_pua_emoji.py +@@ -53,8 +53,8 @@ def add_pua_cmap(source_file, target_file): + """Add PUA characters to the cmap of the first font and save as second.""" + font = ttLib.TTFont(source_file) + cmap = font_data.get_cmap(font) +- for pua, (ch1, ch2) in (add_emoji_gsub.EMOJI_KEYCAPS.items() +- + add_emoji_gsub.EMOJI_FLAGS.items()): ++ for pua, (ch1, ch2) in (list(add_emoji_gsub.EMOJI_KEYCAPS.items()) ++ + list(add_emoji_gsub.EMOJI_FLAGS.items())): + if pua not in cmap: + glyph_name = get_glyph_name_from_gsub([ch1, ch2], font) + if glyph_name is not None: +diff --git a/third_party/color_emoji/emoji_builder.py b/third_party/color_emoji/emoji_builder.py +index 4157807e..7f17c62f 100644 +--- a/third_party/color_emoji/emoji_builder.py ++++ b/third_party/color_emoji/emoji_builder.py +@@ -19,7 +19,7 @@ + + + from __future__ import print_function +-import sys, struct, StringIO ++import sys, struct + from png import PNG + import os + from os import path +@@ -112,9 +112,9 @@ class CBDT: + line_height = (ascent + descent) * y_ppem / float (upem) + line_ascent = ascent * y_ppem / float (upem) + y_bearing = int (round (line_ascent - .5 * (line_height - height))) +- # fudge y_bearing if calculations are a bit off +- if y_bearing == 128: +- y_bearing = 127 ++ # fudge y_bearing if calculations are a bit off ++ if y_bearing == 128: ++ y_bearing = 127 + advance = width + + vert_x_bearing = - width / 2 +@@ -133,22 +133,22 @@ class CBDT: + # CHAR vertBearingX + # CHAR vertBearingY + # BYTE vertAdvance +- try: +- if big_metrics: +- self.write (struct.pack ("BBbbBbbB", ++ try: ++ if big_metrics: ++ self.write (struct.pack ("BBbbBbbB", + height, width, + x_bearing, y_bearing, + advance, + vert_x_bearing, vert_y_bearing, + vert_advance)) +- else: +- self.write (struct.pack ("BBbbB", ++ else: ++ self.write (struct.pack ("BBbbB", + height, width, + x_bearing, y_bearing, + advance)) +- except Exception as e: +- raise ValueError("%s, h: %d w: %d x: %d y: %d %d a:" % ( +- e, height, width, x_bearing, y_bearing, advance)) ++ except Exception as e: ++ raise ValueError("%s, h: %d w: %d x: %d y: %d %d a:" % ( ++ e, height, width, x_bearing, y_bearing, advance)) + + def write_format1 (self, png): + +@@ -179,12 +179,15 @@ class CBDT: + self.write (pixel) + offset += stride + +- png_allowed_chunks = ["IHDR", "PLTE", "tRNS", "sRGB", "IDAT", "IEND"] ++ png_allowed_chunks = [ ++ "IHDR", "PLTE", "tRNS", "sRGB", "IDAT", "IEND", # Python2 ++ b"IHDR", b"PLTE", b"tRNS", b"sRGB", b"IDAT", b"IEND", # Python3 ++ ] + + def write_format17 (self, png): + self.write_format17or18(png, False) + +- def write_format18 (self, png): ++ def write_format18 (self, png): + self.write_format17or18(png, True) + + def write_format17or18 (self, png, big_metrics): +@@ -202,7 +205,7 @@ class CBDT: + + def image_write_func (self, image_format): + if image_format == 1: return self.write_format1 +- if image_format == 17: return self.write_format17 ++ if image_format == 17: return self.write_format17 + if image_format == 18: return self.write_format18 + return None + +@@ -441,7 +444,10 @@ By default they are dropped. + + def add_font_table (font, tag, data): + tab = ttLib.tables.DefaultTable.DefaultTable (tag) +- tab.data = str(data) ++ if sys.version_info >= (3, 0, 0): ++ tab.data = data ++ else: ++ tab.data = str(data) + font[tag] = tab + + def drop_outline_tables (font): +@@ -478,7 +484,7 @@ By default they are dropped. + eblc.write_header () + eblc.start_strikes (len (img_prefixes)) + +- def is_vs(cp): ++ def is_vs(cp): + return cp >= 0xfe00 and cp <= 0xfe0f + + for img_prefix in img_prefixes: +@@ -491,14 +497,20 @@ By default they are dropped. + codes = img_file[len (img_prefix):-4] + if "_" in codes: + pieces = codes.split ("_") +- cps = [int(code, 16) for code in pieces] +- uchars = "".join ([unichr(cp) for cp in cps if not is_vs(cp)]) ++ cps = [int(code, 16) for code in pieces] ++ if sys.version_info >= (3, 0, 0): ++ uchars = "".join ([chr(cp) for cp in cps if not is_vs(cp)]) ++ else: ++ uchars = "".join ([unichr(cp) for cp in cps if not is_vs(cp)]) + else: +- cp = int(codes, 16) +- if is_vs(cp): +- print("ignoring unexpected vs input %04x" % cp) +- continue +- uchars = unichr(cp) ++ cp = int(codes, 16) ++ if is_vs(cp): ++ print("ignoring unexpected vs input %04x" % cp) ++ continue ++ if sys.version_info >= (3, 0, 0): ++ uchars = chr(cp) ++ else: ++ uchars = unichr(cp) + img_files[uchars] = img_file + if not img_files: + raise Exception ("No image files found in '%s'." % glb) +@@ -561,8 +573,7 @@ By default they are dropped. + # hack removal of cmap pua entry for unknown flag glyph. If we try to + # remove it earlier, getGlyphID dies. Need to restructure all of this + # code. +- font_data.delete_from_cmap(font, [0xfe82b]) +- ++ font_data.delete_from_cmap(font, [0xfe82b]) + font.save (out_file) + print("Output font '%s' generated." % out_file) + +diff --git a/third_party/color_emoji/png.py b/third_party/color_emoji/png.py +index 20f849ae..f5d4c2d5 100644 +--- a/third_party/color_emoji/png.py ++++ b/third_party/color_emoji/png.py +@@ -17,7 +17,12 @@ + # Google Author(s): Behdad Esfahbod + # + +-import struct, StringIO ++import struct ++import sys ++if sys.version_info >= (3,0,0): # Python3 ++ from io import StringIO ++else: ++ from StringIO import StringIO + + + class PNG: +@@ -26,7 +31,7 @@ class PNG: + + def __init__ (self, f): + +- if isinstance(f, basestring): ++ if (isinstance(f, str) or isinstance(f, type(u''))): + f = open (f, 'rb') + + self.f = f +@@ -43,7 +48,10 @@ class PNG: + + def data (self): + self.seek (0) +- return bytearray (self.f.read ()) ++ if sys.version_info >= (3,0,0): # Python3 ++ return bytearray (self.f.read (), 'iso-8859-1') ++ else: ++ return bytearray (self.f.read ()) + + class BadSignature (Exception): pass + class BadChunk (Exception): pass +@@ -55,7 +63,8 @@ class PNG: + return PNG.signature + + def read_chunk (self): +- length = struct.unpack (">I", self.f.read (4))[0] ++ buf = self.f.read (4) ++ length = struct.unpack (">I", buf)[0] + chunk_type = self.f.read (4) + chunk_data = self.f.read (length) + if len (chunk_data) != length: +@@ -67,7 +76,7 @@ class PNG: + + def read_IHDR (self): + (chunk_type, chunk_data, crc) = self.read_chunk () +- if chunk_type != "IHDR": ++ if chunk_type not in ("IHDR", b"IHDR"): + raise PNG.BadChunk + # Width: 4 bytes + # Height: 4 bytes +@@ -93,15 +102,24 @@ class PNG: + + def filter_chunks (self, chunks): + self.seek (0); +- out = StringIO.StringIO () +- out.write (self.read_signature ()) ++ out = StringIO () ++ if sys.version_info >= (3,0,0): # Python3 ++ out.write (self.read_signature ().decode('iso-8859-1')) ++ else: ++ out.write (self.read_signature ()) + while True: + chunk_type, chunk_data, crc = self.read_chunk () + if chunk_type in chunks: +- out.write (struct.pack (">I", len (chunk_data))) +- out.write (chunk_type) +- out.write (chunk_data) +- out.write (crc) +- if chunk_type == "IEND": ++ if sys.version_info >= (3,0,0): # Python3 ++ out.write (struct.pack (">I", len (chunk_data)).decode('iso-8859-1')) ++ out.write (chunk_type.decode('iso-8859-1')) ++ out.write (chunk_data.decode('iso-8859-1')) ++ out.write (crc.decode('iso-8859-1')) ++ else: ++ out.write (struct.pack (">I", len (chunk_data))) ++ out.write (chunk_type) ++ out.write (chunk_data) ++ out.write (crc) ++ if chunk_type in ("IEND", b"IEND"): + break + return PNG (out) diff -Nru fonts-noto-color-emoji-0~20180810/debian/patches/py3-02-188ffcf08cfa6cabdfcf5dc2723154574d2c66cf.patch fonts-noto-color-emoji-0~20180810/debian/patches/py3-02-188ffcf08cfa6cabdfcf5dc2723154574d2c66cf.patch --- fonts-noto-color-emoji-0~20180810/debian/patches/py3-02-188ffcf08cfa6cabdfcf5dc2723154574d2c66cf.patch 1970-01-01 00:00:00.000000000 +0000 +++ fonts-noto-color-emoji-0~20180810/debian/patches/py3-02-188ffcf08cfa6cabdfcf5dc2723154574d2c66cf.patch 2019-12-11 02:38:19.000000000 +0000 @@ -0,0 +1,200 @@ +commit 188ffcf08cfa6cabdfcf5dc2723154574d2c66cf +Author: Mike FABIAN <[email protected]> +Date: Wed Jul 17 10:35:02 2019 +0200 + + Use Python3 explicitly + +diff --git a/Makefile b/Makefile +index e8d53b5a..ec75d98e 100644 +--- a/Makefile ++++ b/Makefile +@@ -207,7 +207,7 @@ endif + # Run make without -j if this happens. + + %.ttx: %.ttx.tmpl $(ADD_GLYPHS) $(ALL_COMPRESSED_FILES) +- @python $(ADD_GLYPHS) -f "$<" -o "$@" -d "$(COMPRESSED_DIR)" $(ADD_GLYPHS_FLAGS) ++ @python3 $(ADD_GLYPHS) -f "$<" -o "$@" -d "$(COMPRESSED_DIR)" $(ADD_GLYPHS_FLAGS) + + %.ttf: %.ttx + @rm -f "$@" +@@ -215,8 +215,8 @@ endif + + $(EMOJI).ttf: $(EMOJI).tmpl.ttf $(EMOJI_BUILDER) $(PUA_ADDER) \ + $(ALL_COMPRESSED_FILES) | check_vs_adder +- @python $(EMOJI_BUILDER) $(SMALL_METRICS) -V $< "$@" "$(COMPRESSED_DIR)/emoji_u" +- @python $(PUA_ADDER) "$@" "$@-with-pua" ++ @python3 $(EMOJI_BUILDER) $(SMALL_METRICS) -V $< "$@" "$(COMPRESSED_DIR)/emoji_u" ++ @python3 $(PUA_ADDER) "$@" "$@-with-pua" + @$(VS_ADDER) -vs 2640 2642 2695 --dstdir '.' -o "$@-with-pua-varsel" "$@-with-pua" + @mv "$@-with-pua-varsel" "$@" + @rm "$@-with-pua" +diff --git a/add_aliases.py b/add_aliases.py +index 90aed7d9..b943f5db 100755 +--- a/add_aliases.py ++++ b/add_aliases.py +@@ -1,4 +1,4 @@ +-#!/usr/bin/env python ++#!/usr/bin/env python3 + # + # Copyright 2017 Google Inc. All rights reserved. + # +diff --git a/add_emoji_gsub.py b/add_emoji_gsub.py +index bae73cbb..9f578a30 100755 +--- a/add_emoji_gsub.py ++++ b/add_emoji_gsub.py +@@ -1,4 +1,4 @@ +-#!/usr/bin/env python ++#!/usr/bin/env python3 + # + # Copyright 2014 Google Inc. All rights reserved. + # +diff --git a/add_glyphs.py b/add_glyphs.py +index 36d40e67..4d4430f4 100644 +--- a/add_glyphs.py ++++ b/add_glyphs.py +@@ -1,4 +1,4 @@ +-#!/usr/bin/env python ++#!/usr/bin/env python3 + + """Extend a ttx file with additional data. + +diff --git a/add_svg_glyphs.py b/add_svg_glyphs.py +index 0f7a6b3b..63091578 100755 +--- a/add_svg_glyphs.py ++++ b/add_svg_glyphs.py +@@ -1,4 +1,4 @@ +-#!/usr/bin/env python ++#!/usr/bin/env python3 + # Copyright 2015 Google, Inc. All Rights Reserved. + # + # Licensed under the Apache License, Version 2.0 (the "License"); +diff --git a/check_emoji_sequences.py b/check_emoji_sequences.py +index f29bbe90..dff1b865 100755 +--- a/check_emoji_sequences.py ++++ b/check_emoji_sequences.py +@@ -1,4 +1,4 @@ +-#!/usr/bin/env python ++#!/usr/bin/env python3 + # + # Copyright 2016 Google Inc. All rights reserved. + # +diff --git a/collect_emoji_svg.py b/collect_emoji_svg.py +index ea39cbde..9d2ba640 100755 +--- a/collect_emoji_svg.py ++++ b/collect_emoji_svg.py +@@ -1,4 +1,4 @@ +-#!/usr/bin/env python ++#!/usr/bin/env python3 + # Copyright 2015 Google, Inc. All Rights Reserved. + # + # Licensed under the Apache License, Version 2.0 (the "License"); +diff --git a/flag_glyph_name.py b/flag_glyph_name.py +index 50c266b8..e5ce40c2 100755 +--- a/flag_glyph_name.py ++++ b/flag_glyph_name.py +@@ -1,4 +1,4 @@ +-#!/usr/bin/env python ++#!/usr/bin/env python3 + # + # Copyright 2014 Google Inc. All rights reserved. + # +diff --git a/flag_info.py b/flag_info.py +index 233243f7..3dbd63f2 100755 +--- a/flag_info.py ++++ b/flag_info.py +@@ -1,4 +1,4 @@ +-#!/usr/bin/python ++#!/usr/bin/python3 + # + # Copyright 2016 Google Inc. All rights reserved. + # +diff --git a/gen_version.py b/gen_version.py +index 749f12ed..48581a82 100755 +--- a/gen_version.py ++++ b/gen_version.py +@@ -1,4 +1,4 @@ +-#!/usr/bin/env python ++#!/usr/bin/env python3 + # + # Copyright 2015 Google Inc. All rights reserved. + # +diff --git a/generate_emoji_html.py b/generate_emoji_html.py +index 8e0d56ca..09fa8ed0 100755 +--- a/generate_emoji_html.py ++++ b/generate_emoji_html.py +@@ -1,4 +1,4 @@ +-#!/usr/bin/env python ++#!/usr/bin/env python3 + # + # Copyright 2016 Google Inc. All rights reserved. + # +diff --git a/generate_emoji_name_data.py b/generate_emoji_name_data.py +index b2280580..9a726216 100755 +--- a/generate_emoji_name_data.py ++++ b/generate_emoji_name_data.py +@@ -1,4 +1,4 @@ +-#!/usr/bin/env python ++#!/usr/bin/env python3 + # -*- coding: utf-8 -*-# + # + # Copyright 2015 Google Inc. All rights reserved. +diff --git a/generate_emoji_thumbnails.py b/generate_emoji_thumbnails.py +index e67da533..5f70351e 100755 +--- a/generate_emoji_thumbnails.py ++++ b/generate_emoji_thumbnails.py +@@ -1,4 +1,4 @@ +-#!/usr/bin/env python ++#!/usr/bin/env python3 + # Copyright 2017 Google Inc. All rights reserved. + # + # Licensed under the Apache License, Version 2.0 (the "License"); +diff --git a/generate_test_html.py b/generate_test_html.py +index 21ab1c64..e45108cb 100755 +--- a/generate_test_html.py ++++ b/generate_test_html.py +@@ -1,4 +1,4 @@ +-#!/usr/bin/env python ++#!/usr/bin/env python3 + # Copyright 2015 Google, Inc. All Rights Reserved. + # + # Licensed under the Apache License, Version 2.0 (the "License"); +diff --git a/map_pua_emoji.py b/map_pua_emoji.py +index ff8d6a9b..912ddac5 100644 +--- a/map_pua_emoji.py ++++ b/map_pua_emoji.py +@@ -1,4 +1,4 @@ +-#!/usr/bin/env python ++#!/usr/bin/env python3 + # + # Copyright 2014 Google Inc. All rights reserved. + # +diff --git a/materialize_emoji_images.py b/materialize_emoji_images.py +index d8a8b0e8..83e3fdd2 100755 +--- a/materialize_emoji_images.py ++++ b/materialize_emoji_images.py +@@ -1,4 +1,4 @@ +-#!/usr/bin/env python ++#!/usr/bin/env python3 + # + # Copyright 2016 Google Inc. All rights reserved. + # +diff --git a/strip_vs_from_filenames.py b/strip_vs_from_filenames.py +index f27cb3c2..f0f7422f 100755 +--- a/strip_vs_from_filenames.py ++++ b/strip_vs_from_filenames.py +@@ -1,4 +1,4 @@ +-#!/usr/bin/env python ++#!/usr/bin/env python3 + # + # Copyright 2017 Google Inc. All rights reserved. + # +diff --git a/svg_cleaner.py b/svg_cleaner.py +index e968d2fc..40d3827e 100755 +--- a/svg_cleaner.py ++++ b/svg_cleaner.py +@@ -1,4 +1,4 @@ +-#!/usr/bin/env python ++#!/usr/bin/env python3 + # Copyright 2015 Google, Inc. All Rights Reserved. + # + # Licensed under the Apache License, Version 2.0 (the "License"); diff -Nru fonts-noto-color-emoji-0~20180810/debian/patches/py3-04-3d5ac2aea9d6acfa084048db6937a873676378b3.patch fonts-noto-color-emoji-0~20180810/debian/patches/py3-04-3d5ac2aea9d6acfa084048db6937a873676378b3.patch --- fonts-noto-color-emoji-0~20180810/debian/patches/py3-04-3d5ac2aea9d6acfa084048db6937a873676378b3.patch 1970-01-01 00:00:00.000000000 +0000 +++ fonts-noto-color-emoji-0~20180810/debian/patches/py3-04-3d5ac2aea9d6acfa084048db6937a873676378b3.patch 2019-12-11 02:55:48.000000000 +0000 @@ -0,0 +1,48 @@ +Adjusted by Peter Michael Green to apply to the Debian fonts-noto-color-emoji package. +commit 3d5ac2aea9d6acfa084048db6937a873676378b3 +Author: Cosimo Lupo <[email protected]> +Date: Mon Oct 21 15:58:06 2019 +0100 + + Makefile: define PYTHON=python3 make variable + +Index: fonts-noto-color-emoji-0~20180810/Makefile +=================================================================== +--- fonts-noto-color-emoji-0~20180810.orig/Makefile ++++ fonts-noto-color-emoji-0~20180810/Makefile +@@ -19,6 +19,7 @@ CFLAGS = -std=c99 -Wall -Wextra `pkg-con + LDFLAGS = -lm `pkg-config --libs cairo` + PNGQUANTDIR := third_party/pngquant + PNGQUANT := $(PNGQUANTDIR)/pngquant ++PYTHON = python3 + PNGQUANTFLAGS = --speed 1 --skip-if-larger --quality 85-95 --force + BODY_DIMENSIONS = 136x128 + IMOPS := -size $(BODY_DIMENSIONS) canvas:none -compose copy -gravity center +@@ -88,7 +89,7 @@ FLAG_NAMES = $(FLAGS:%=%.png) + FLAG_FILES = $(addprefix $(FLAGS_DIR)/, $(FLAG_NAMES)) + RESIZED_FLAG_FILES = $(addprefix $(RESIZED_FLAGS_DIR)/, $(FLAG_NAMES)) + +-FLAG_GLYPH_NAMES = $(shell ./flag_glyph_name.py $(FLAGS)) ++FLAG_GLYPH_NAMES = $(shell $(PYTHON) flag_glyph_name.py $(FLAGS)) + RENAMED_FLAG_NAMES = $(FLAG_GLYPH_NAMES:%=emoji_%.png) + RENAMED_FLAG_FILES = $(addprefix $(RENAMED_FLAGS_DIR)/, $(RENAMED_FLAG_NAMES)) + +@@ -209,7 +210,7 @@ endif + # Run make without -j if this happens. + + %.ttx: %.ttx.tmpl $(ADD_GLYPHS) $(ALL_COMPRESSED_FILES) +- @python3 $(ADD_GLYPHS) -f "$<" -o "$@" -d "$(COMPRESSED_DIR)" $(ADD_GLYPHS_FLAGS) ++ @$(PYTHON) $(ADD_GLYPHS) -f "$<" -o "$@" -d "$(COMPRESSED_DIR)" $(ADD_GLYPHS_FLAGS) + + %.ttf: %.ttx + @rm -f "$@" +@@ -217,8 +218,8 @@ endif + + $(EMOJI).ttf: $(EMOJI).tmpl.ttf $(EMOJI_BUILDER) $(PUA_ADDER) \ + $(ALL_COMPRESSED_FILES) | check_vs_adder +- @python3 $(EMOJI_BUILDER) $(SMALL_METRICS) -V $< "$@" "$(COMPRESSED_DIR)/emoji_u" +- @python3 $(PUA_ADDER) "$@" "$@-with-pua" ++ @$(PYTHON) $(EMOJI_BUILDER) $(SMALL_METRICS) -V $< "$@" "$(COMPRESSED_DIR)/emoji_u" ++ @$(PYTHON) $(PUA_ADDER) "$@" "$@-with-pua" + @$(VS_ADDER) -vs 2640 2642 2695 --dstdir '.' -o "$@-with-pua-varsel" "$@-with-pua" + @mv "$@-with-pua-varsel" "$@" + @rm "$@-with-pua" diff -Nru fonts-noto-color-emoji-0~20180810/debian/patches/py3-05-03e6d6e39cc3694a4157b48e3afe76cfa8c85dd2.patch fonts-noto-color-emoji-0~20180810/debian/patches/py3-05-03e6d6e39cc3694a4157b48e3afe76cfa8c85dd2.patch --- fonts-noto-color-emoji-0~20180810/debian/patches/py3-05-03e6d6e39cc3694a4157b48e3afe76cfa8c85dd2.patch 1970-01-01 00:00:00.000000000 +0000 +++ fonts-noto-color-emoji-0~20180810/debian/patches/py3-05-03e6d6e39cc3694a4157b48e3afe76cfa8c85dd2.patch 2019-12-11 02:36:38.000000000 +0000 @@ -0,0 +1,30 @@ +commit 03e6d6e39cc3694a4157b48e3afe76cfa8c85dd2 +Author: Cosimo Lupo <[email protected]> +Date: Mon Oct 21 16:03:06 2019 +0100 + + map_pua_emoji: use itertools.chain() to concatenate dict.items() + +diff --git a/map_pua_emoji.py b/map_pua_emoji.py +index 912ddac5..bd8e1027 100644 +--- a/map_pua_emoji.py ++++ b/map_pua_emoji.py +@@ -19,6 +19,7 @@ + __author__ = '[email protected] (Roozbeh Pournader)' + + import sys ++import itertools + + from fontTools import ttLib + +@@ -53,8 +54,9 @@ def add_pua_cmap(source_file, target_file): + """Add PUA characters to the cmap of the first font and save as second.""" + font = ttLib.TTFont(source_file) + cmap = font_data.get_cmap(font) +- for pua, (ch1, ch2) in (list(add_emoji_gsub.EMOJI_KEYCAPS.items()) +- + list(add_emoji_gsub.EMOJI_FLAGS.items())): ++ for pua, (ch1, ch2) in itertools.chain( ++ add_emoji_gsub.EMOJI_KEYCAPS.items(), add_emoji_gsub.EMOJI_FLAGS.items() ++ ): + if pua not in cmap: + glyph_name = get_glyph_name_from_gsub([ch1, ch2], font) + if glyph_name is not None: diff -Nru fonts-noto-color-emoji-0~20180810/debian/patches/py3-06-60161a370b9943af45628663abf552f93ed256d6.patch fonts-noto-color-emoji-0~20180810/debian/patches/py3-06-60161a370b9943af45628663abf552f93ed256d6.patch --- fonts-noto-color-emoji-0~20180810/debian/patches/py3-06-60161a370b9943af45628663abf552f93ed256d6.patch 1970-01-01 00:00:00.000000000 +0000 +++ fonts-noto-color-emoji-0~20180810/debian/patches/py3-06-60161a370b9943af45628663abf552f93ed256d6.patch 2019-12-11 02:35:59.000000000 +0000 @@ -0,0 +1,153 @@ +commit 60161a370b9943af45628663abf552f93ed256d6 +Author: Cosimo Lupo <[email protected]> +Date: Mon Oct 21 16:17:16 2019 +0100 + + [emoji_builder|png] fix bytes vs str issues in py2.py3 + +diff --git a/third_party/color_emoji/emoji_builder.py b/third_party/color_emoji/emoji_builder.py +index 7f17c62f..61a3a392 100644 +--- a/third_party/color_emoji/emoji_builder.py ++++ b/third_party/color_emoji/emoji_builder.py +@@ -26,6 +26,12 @@ from os import path + + from nototools import font_data + ++ ++try: ++ unichr # py2 ++except NameError: ++ unichr = chr # py3 ++ + def get_glyph_name_from_gsub (string, font, cmap_dict): + ligatures = font['GSUB'].table.LookupList.Lookup[0].SubTable[0].ligatures + first_glyph = cmap_dict[ord (string[0])] +@@ -179,10 +185,7 @@ class CBDT: + self.write (pixel) + offset += stride + +- png_allowed_chunks = [ +- "IHDR", "PLTE", "tRNS", "sRGB", "IDAT", "IEND", # Python2 +- b"IHDR", b"PLTE", b"tRNS", b"sRGB", b"IDAT", b"IEND", # Python3 +- ] ++ png_allowed_chunks = [b"IHDR", b"PLTE", b"tRNS", b"sRGB", b"IDAT", b"IEND"] + + def write_format17 (self, png): + self.write_format17or18(png, False) +@@ -444,10 +447,7 @@ By default they are dropped. + + def add_font_table (font, tag, data): + tab = ttLib.tables.DefaultTable.DefaultTable (tag) +- if sys.version_info >= (3, 0, 0): +- tab.data = data +- else: +- tab.data = str(data) ++ tab.data = data + font[tag] = tab + + def drop_outline_tables (font): +@@ -498,19 +498,13 @@ By default they are dropped. + if "_" in codes: + pieces = codes.split ("_") + cps = [int(code, 16) for code in pieces] +- if sys.version_info >= (3, 0, 0): +- uchars = "".join ([chr(cp) for cp in cps if not is_vs(cp)]) +- else: +- uchars = "".join ([unichr(cp) for cp in cps if not is_vs(cp)]) ++ uchars = "".join (unichr(cp) for cp in cps if not is_vs(cp)) + else: + cp = int(codes, 16) + if is_vs(cp): + print("ignoring unexpected vs input %04x" % cp) + continue +- if sys.version_info >= (3, 0, 0): +- uchars = chr(cp) +- else: +- uchars = unichr(cp) ++ uchars = unichr(cp) + img_files[uchars] = img_file + if not img_files: + raise Exception ("No image files found in '%s'." % glb) +diff --git a/third_party/color_emoji/png.py b/third_party/color_emoji/png.py +index f5d4c2d5..6e74500f 100644 +--- a/third_party/color_emoji/png.py ++++ b/third_party/color_emoji/png.py +@@ -19,10 +19,13 @@ + + import struct + import sys +-if sys.version_info >= (3,0,0): # Python3 +- from io import StringIO +-else: +- from StringIO import StringIO ++from io import BytesIO ++ ++ ++try: ++ basestring # py2 ++except NameError: ++ basestring = str # py3 + + + class PNG: +@@ -31,7 +34,7 @@ class PNG: + + def __init__ (self, f): + +- if (isinstance(f, str) or isinstance(f, type(u''))): ++ if isinstance(f, basestring): + f = open (f, 'rb') + + self.f = f +@@ -48,10 +51,7 @@ class PNG: + + def data (self): + self.seek (0) +- if sys.version_info >= (3,0,0): # Python3 +- return bytearray (self.f.read (), 'iso-8859-1') +- else: +- return bytearray (self.f.read ()) ++ return bytearray (self.f.read ()) + + class BadSignature (Exception): pass + class BadChunk (Exception): pass +@@ -76,7 +76,7 @@ class PNG: + + def read_IHDR (self): + (chunk_type, chunk_data, crc) = self.read_chunk () +- if chunk_type not in ("IHDR", b"IHDR"): ++ if chunk_type != b"IHDR": + raise PNG.BadChunk + # Width: 4 bytes + # Height: 4 bytes +@@ -102,24 +102,15 @@ class PNG: + + def filter_chunks (self, chunks): + self.seek (0); +- out = StringIO () +- if sys.version_info >= (3,0,0): # Python3 +- out.write (self.read_signature ().decode('iso-8859-1')) +- else: +- out.write (self.read_signature ()) ++ out = BytesIO () ++ out.write (self.read_signature ()) + while True: + chunk_type, chunk_data, crc = self.read_chunk () + if chunk_type in chunks: +- if sys.version_info >= (3,0,0): # Python3 +- out.write (struct.pack (">I", len (chunk_data)).decode('iso-8859-1')) +- out.write (chunk_type.decode('iso-8859-1')) +- out.write (chunk_data.decode('iso-8859-1')) +- out.write (crc.decode('iso-8859-1')) +- else: +- out.write (struct.pack (">I", len (chunk_data))) +- out.write (chunk_type) +- out.write (chunk_data) +- out.write (crc) +- if chunk_type in ("IEND", b"IEND"): ++ out.write (struct.pack (">I", len (chunk_data))) ++ out.write (chunk_type) ++ out.write (chunk_data) ++ out.write (crc) ++ if chunk_type == b"IEND": + break + return PNG (out) diff -Nru fonts-noto-color-emoji-0~20180810/debian/patches/series fonts-noto-color-emoji-0~20180810/debian/patches/series --- fonts-noto-color-emoji-0~20180810/debian/patches/series 2018-08-21 19:26:49.000000000 +0000 +++ fonts-noto-color-emoji-0~20180810/debian/patches/series 2019-12-11 02:52:54.000000000 +0000 @@ -1,2 +1,7 @@ add_vs_cmap.patch build-all-flags.patch +py3-01-a9ca546689d384b0ca73ad2a476891c3caaedc20.patch +py3-02-188ffcf08cfa6cabdfcf5dc2723154574d2c66cf.patch +py3-04-3d5ac2aea9d6acfa084048db6937a873676378b3.patch +py3-05-03e6d6e39cc3694a4157b48e3afe76cfa8c85dd2.patch +py3-06-60161a370b9943af45628663abf552f93ed256d6.patch diff -Nru fonts-noto-color-emoji-0~20180810/debian/.pc/.quilt_patches fonts-noto-color-emoji-0~20180810/debian/.pc/.quilt_patches --- fonts-noto-color-emoji-0~20180810/debian/.pc/.quilt_patches 1970-01-01 00:00:00.000000000 +0000 +++ fonts-noto-color-emoji-0~20180810/debian/.pc/.quilt_patches 2019-12-11 02:48:19.000000000 +0000 @@ -0,0 +1 @@ +patches diff -Nru fonts-noto-color-emoji-0~20180810/debian/.pc/.quilt_series fonts-noto-color-emoji-0~20180810/debian/.pc/.quilt_series --- fonts-noto-color-emoji-0~20180810/debian/.pc/.quilt_series 1970-01-01 00:00:00.000000000 +0000 +++ fonts-noto-color-emoji-0~20180810/debian/.pc/.quilt_series 2019-12-11 02:48:19.000000000 +0000 @@ -0,0 +1 @@ +series diff -Nru fonts-noto-color-emoji-0~20180810/debian/.pc/.version fonts-noto-color-emoji-0~20180810/debian/.pc/.version --- fonts-noto-color-emoji-0~20180810/debian/.pc/.version 1970-01-01 00:00:00.000000000 +0000 +++ fonts-noto-color-emoji-0~20180810/debian/.pc/.version 2019-12-11 02:48:19.000000000 +0000 @@ -0,0 +1 @@ +2 diff -Nru fonts-noto-color-emoji-0~20180810/debian/rules fonts-noto-color-emoji-0~20180810/debian/rules --- fonts-noto-color-emoji-0~20180810/debian/rules 2018-08-21 19:26:49.000000000 +0000 +++ fonts-noto-color-emoji-0~20180810/debian/rules 2019-12-11 02:56:18.000000000 +0000 @@ -12,3 +12,4 @@ override_dh_clean: dh_clean rm -f *pyc + rm -rf __pycache__

