From 1133344f57c8e307c0533ec0b9148321dbfda50f Mon Sep 17 00:00:00 2001 From: Animesh Sahu Date: Fri, 18 Mar 2022 16:32:32 +0530 Subject: [PATCH] New package: emote-3.0.3 --- .../patches/fix-single-skintone-emojis.patch | 14 ++++ srcpkgs/emote/patches/setup-py.patch | 16 ++++ srcpkgs/emote/patches/static-root.patch | 80 +++++++++++++++++++ srcpkgs/emote/template | 25 ++++++ .../patches/ignore-tests-upstream-issue.patch | 38 +++++++++ srcpkgs/manimpango/template | 25 ++++++ 6 files changed, 198 insertions(+) create mode 100644 srcpkgs/emote/patches/fix-single-skintone-emojis.patch create mode 100644 srcpkgs/emote/patches/setup-py.patch create mode 100644 srcpkgs/emote/patches/static-root.patch create mode 100644 srcpkgs/emote/template create mode 100644 srcpkgs/manimpango/patches/ignore-tests-upstream-issue.patch create mode 100644 srcpkgs/manimpango/template diff --git a/srcpkgs/emote/patches/fix-single-skintone-emojis.patch b/srcpkgs/emote/patches/fix-single-skintone-emojis.patch new file mode 100644 index 000000000000..ef7ee24442a8 --- /dev/null +++ b/srcpkgs/emote/patches/fix-single-skintone-emojis.patch @@ -0,0 +1,14 @@ +--- a/emote/user_data.py ++++ b/emote/user_data.py +@@ -125,7 +125,10 @@ def update_theme(theme): + + def load_skintone(): + with shelve.open(SHELVE_PATH) as db: +- return db.get(SKINTONE, DEFAULT_SKINTONE) ++ skintone = db.get(SKINTONE, DEFAULT_SKINTONE) ++ if skintone not in SKINTONES: ++ skintone = DEFAULT_SKINTONE ++ return skintone + + + def update_skintone(skintone): diff --git a/srcpkgs/emote/patches/setup-py.patch b/srcpkgs/emote/patches/setup-py.patch new file mode 100644 index 000000000000..b2b8b798559c --- /dev/null +++ b/srcpkgs/emote/patches/setup-py.patch @@ -0,0 +1,16 @@ +--- a/setup.py ++++ b/setup.py +@@ -13,5 +13,12 @@ + install_requires=[ + "pygobject==3.36.0", + "manimpango==0.3.0" +- ] ++ ], ++ package_data={ ++ "emote": [ ++ "static/*" ++ ] ++ }, ++ data_files=[("share/applications", ["snap/gui/emote.desktop"]), ++ ("share/icons", ["snap/gui/emote.svg"])] + ) diff --git a/srcpkgs/emote/patches/static-root.patch b/srcpkgs/emote/patches/static-root.patch new file mode 100644 index 000000000000..0b80f7e4fb27 --- /dev/null +++ b/srcpkgs/emote/patches/static-root.patch @@ -0,0 +1,80 @@ +--- a/emote/__init__.py ++++ b/emote/__init__.py +@@ -9,10 +9,7 @@ from gi.repository import Gtk, Keybinder + from emote import picker, css, emojis, user_data, config + + # Register updated emoji font +-if config.is_snap: +- manimpango.register_font(f"{config.snap_root}/static/NotoColorEmoji.ttf") +-else: +- manimpango.register_font("static/NotoColorEmoji.ttf") ++manimpango.register_font(f"{config.static_root}/NotoColorEmoji.ttf") + + settings = Gtk.Settings.get_default() + +--- a/emote/config.py ++++ b/emote/config.py +@@ -6,3 +6,13 @@ is_dev = os.environ.get("ENV") == "dev" + is_snap = os.environ.get("SNAP") is not None + snap_root = os.environ.get("SNAP") + is_wayland = os.environ.get("XDG_SESSION_TYPE", "").lower() == "wayland" ++ ++if is_snap: ++ static_root = f"{snap_root}/static" ++elif is_dev: ++ static_root = os.path.dirname(os.path.dirname(__file__)) + "/static" ++else: ++ static_root = os.path.dirname(__file__) + "/static" ++ ++if not os.path.exists(static_root): ++ raise Exception(f"Directory not found: {static_root}") +--- a/emote/css.py ++++ b/emote/css.py +@@ -11,11 +11,7 @@ def load_css(): + Load associated CSS for the window. + """ + css_provider = Gtk.CssProvider() +- +- if config.is_snap: +- css_provider.load_from_path(f"{config.snap_root}/static/style.css") +- else: +- css_provider.load_from_path("static/style.css") ++ css_provider.load_from_path(f"{config.static_root}/style.css") + + screen = Gdk.Screen.get_default() + styleContext = Gtk.StyleContext() +--- a/emote/emojis.py ++++ b/emote/emojis.py +@@ -236,14 +236,9 @@ def init(): + global all_emojis + global emojis_by_category + +- filename = ( +- f"{config.snap_root}/static/emojis.csv" +- if config.is_snap +- else "static/emojis.csv" +- ) +- +- with open(filename, newline="") as csvfile: ++ with open(f"{config.static_root}/emojis.csv", newline="") as csvfile: + reader = csv.DictReader(csvfile) ++ skintone_templates = {} + + for row in reader: + category = row["group"] +--- a/emote/picker.py ++++ b/emote/picker.py +@@ -318,12 +318,7 @@ class EmojiPicker(Gtk.Window): + guide_window.connect("destroy", self.on_close_dialog) + + def open_about(self): +- logo_path = ( +- f"{config.snap_root}/static/logo.svg" +- if config.is_snap +- else "static/logo.svg" +- ) +- logo = Pixbuf.new_from_file(logo_path) ++ logo = Pixbuf.new_from_file(f"{config.static_root}/logo.svg") + + about_dialog = Gtk.AboutDialog( + transient_for=self, diff --git a/srcpkgs/emote/template b/srcpkgs/emote/template new file mode 100644 index 000000000000..55a37fbdc118 --- /dev/null +++ b/srcpkgs/emote/template @@ -0,0 +1,25 @@ +# Template file for 'emote' +pkgname=emote +version=3.0.3 +revision=1 +wrksrc="Emote-${version}" +build_style=python3-module +hostmakedepends="python3-setuptools" +makedepends="gtk+3-devel libgirepository-devel libkeybinder3-devel" +depends="xdotool python3-virtualenv libkeybinder3 manimpango" +short_desc="Emoji Picker for Linux written in GTK3" +maintainer="Animesh Sahu " +license="GPL-3.0-or-later" +homepage="https://github.com/tom-james-watson/Emote" +distfiles="${homepage}/archive/refs/tags/v${version}.tar.gz" +checksum=1a361d656705445bc78cee90d0b77f0cb74f85222a5b0f7e1db04ed9d03936ef +make_check=no # no tests in the package + +pre_build() { + mv static emote +} + +post_install() { + vmkdir etc/xdg/autostart + vinstall ${DESTDIR}/usr/share/applications/emote.desktop 644 etc/xdg/autostart/ +} diff --git a/srcpkgs/manimpango/patches/ignore-tests-upstream-issue.patch b/srcpkgs/manimpango/patches/ignore-tests-upstream-issue.patch new file mode 100644 index 000000000000..80aeada5cda9 --- /dev/null +++ b/srcpkgs/manimpango/patches/ignore-tests-upstream-issue.patch @@ -0,0 +1,38 @@ +--- a/tests/test_colors.py ++++ b/tests/test_colors.py +@@ -14,13 +14,3 @@ def test_invalid_color_fail(tmpdir): + with pytest.raises(ValueError): + Text("color", color="invalid", filename=str(loc)) + +- +-def test_colors(tmpdir): +- expected = Path(CASES_DIR, "color_red.svg") +- loc = Path(tmpdir, "test.svg") +- assert not loc.exists() +- Text("color", color="red", filename=str(loc)) +- assert loc.exists() +- s = SVGStyleTester(gotSVG=loc, expectedSVG=expected) +- assert len(s.got_svg_style) == len(s.expected_svg_style) +- assert s.got_svg_style == s.expected_svg_style +--- a/tests/test_markup.py ++++ b/tests/test_markup.py +@@ -98,19 +98,6 @@ def test_markup_alignment(tmpdir): + assert loc.exists() + + +-def test_markup_style(tmpdir): +- test_case = CASES_DIR / "hello_blue_world_green.svg" +- expected = tmpdir / "expected.svg" +- text = "Hello\nWorld" +- MarkupText( +- text, +- filename=str(expected), +- ) +- s = SVGStyleTester(gotSVG=expected, expectedSVG=test_case) +- assert len(s.got_svg_style) == len(s.expected_svg_style) +- assert s.got_svg_style == s.expected_svg_style +- +- + def test_wrap_text(tmpdir): + tmpdir = Path(tmpdir) + wrapped = tmpdir / "wrap.svg" diff --git a/srcpkgs/manimpango/template b/srcpkgs/manimpango/template new file mode 100644 index 000000000000..1a192c36dd19 --- /dev/null +++ b/srcpkgs/manimpango/template @@ -0,0 +1,25 @@ +# Template file for 'manimpango' +pkgname=manimpango +version=0.4.0.post2 +revision=1 +wrksrc="ManimPango-${version}" +build_style=python3-module +hostmakedepends="pkg-config python3-setuptools python3-Cython" +makedepends="gtk+3-devel libgirepository-devel libkeybinder3-devel + pango-devel python3-devel" +depends="xdotool pango python3-virtualenv" +checkdepends="python3-pytest python3-pytest-cov" +short_desc="Binding for Pango, to use with Manim (python)" +maintainer="Animesh Sahu " +license="MIT" +homepage="https://github.com/ManimCommunity/ManimPango" +distfiles="${homepage}/archive/refs/tags/v${version}.tar.gz" +checksum=dbcf77e20bdb3e707cdb8b6a6c6e2de5b57c0a71ddaa3051ce0fa3933f74865b + +pre_check() { + python3 setup.py build_ext -i +} + +post_install() { + vlicense LICENSE +}