From 195fa44adf19ddfa635edc9f1db8f781a87247a5 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 | 24 ++++++ srcpkgs/manimpango/template | 16 ++++ 5 files changed, 150 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/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..88a82f37a519 --- /dev/null +++ b/srcpkgs/emote/template @@ -0,0 +1,24 @@ +# 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 + +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/template b/srcpkgs/manimpango/template new file mode 100644 index 000000000000..9b1b20835194 --- /dev/null +++ b/srcpkgs/manimpango/template @@ -0,0 +1,16 @@ +# 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" +short_desc="Emoji Picker for Linux written in GTK3" +maintainer="Animesh Sahu " +license="MIT" +homepage="https://github.com/ManimCommunity/ManimPango" +distfiles="${homepage}/archive/refs/tags/v${version}.tar.gz" +checksum=dbcf77e20bdb3e707cdb8b6a6c6e2de5b57c0a71ddaa3051ce0fa3933f74865b