From 77122cb8586f5cd68aec1430b140e2b9751152d8 Mon Sep 17 00:00:00 2001 From: aleksana Date: Sat, 4 May 2024 10:09:05 +0800 Subject: [PATCH] ascii-draw: 0.3.0 -> 0.3.2 --- .../as/ascii-draw/fix_palette_data_dir.patch | 38 ------------------- pkgs/by-name/as/ascii-draw/package.nix | 8 +--- 2 files changed, 2 insertions(+), 44 deletions(-) delete mode 100644 pkgs/by-name/as/ascii-draw/fix_palette_data_dir.patch diff --git a/pkgs/by-name/as/ascii-draw/fix_palette_data_dir.patch b/pkgs/by-name/as/ascii-draw/fix_palette_data_dir.patch deleted file mode 100644 index 64cf5af6d9b3..000000000000 --- a/pkgs/by-name/as/ascii-draw/fix_palette_data_dir.patch +++ /dev/null @@ -1,38 +0,0 @@ -diff --git a/src/window.py b/src/window.py -index adc6d6d..1cb6bec 100644 ---- a/src/window.py -+++ b/src/window.py -@@ -34,6 +34,15 @@ import unicodedata - import emoji - import os - -+def get_data_dir(): -+ xdg_data_home = os.environ.get('XDG_DATA_HOME') -+ if xdg_data_home and xdg_data_home.strip(): -+ data_dir = os.path.join(xdg_data_home, 'ascii-draw', 'data') -+ else: -+ home = os.path.expanduser("~") -+ data_dir = os.path.join(home, '.local', 'share', 'ascii-draw', 'data') -+ return data_dir -+ - @Gtk.Template(resource_path='/io/github/nokse22/asciidraw/ui/window.ui') - class AsciiDrawWindow(Adw.ApplicationWindow): - __gtype_name__ = 'AsciiDrawWindow' -@@ -266,7 +275,7 @@ class AsciiDrawWindow(Adw.ApplicationWindow): - - self.palettes = [] - -- directory_path = "/var/data/palettes" -+ directory_path = f"{get_data_dir()}/palettes" - os.makedirs(directory_path, exist_ok=True) - - for filename in os.listdir(directory_path): -@@ -316,7 +325,7 @@ class AsciiDrawWindow(Adw.ApplicationWindow): - self.char_carousel_go_next.set_sensitive(True) - - def save_new_palette(self, palette): -- with open(f"/var/data/palettes/{palette.name}.txt", 'w') as file: -+ with open(f"{get_data_dir()}/palettes/{palette.name}.txt", 'w') as file: - file.write(palette.chars) - - @Gtk.Template.Callback("char_pages_go_back") diff --git a/pkgs/by-name/as/ascii-draw/package.nix b/pkgs/by-name/as/ascii-draw/package.nix index 838eb0118371..801ec0da0d56 100644 --- a/pkgs/by-name/as/ascii-draw/package.nix +++ b/pkgs/by-name/as/ascii-draw/package.nix @@ -12,20 +12,16 @@ python3Packages.buildPythonApplication rec { pname = "ascii-draw"; - version = "0.3.0"; + version = "0.3.2"; pyproject = false; src = fetchFromGitHub { owner = "Nokse22"; repo = "ascii-draw"; rev = "v${version}"; - hash = "sha256-vI+j8OuQ3b6La0+7wWeoUtBal24dazlN/T0Bng5TgMo="; + hash = "sha256-opjYgLfHfKSbipB1HRxfBkgp+9c4yqIL1fiUOcFmCMc="; }; - # Temporary fix for autosaving to flatpak directory - # https://github.com/Nokse22/ascii-draw/issues/31 - patches = [ ./fix_palette_data_dir.patch ]; - nativeBuildInputs = [ meson ninja