diff --git a/README.md b/README.md index f67ee8703..6548c5b6a 100644 --- a/README.md +++ b/README.md @@ -104,7 +104,7 @@ commands). Older versions are not supported. ###### Ubuntu (tested in 19.04 and 18.04) ```bash -sudo apt install gettext intltool python3-gi python3-cairo python3-gi-cairo python3-distutils python3-dbus python3-xdg libglib2.0-dev libglib2.0-bin gir1.2-gtk-3.0 gtk-update-icon-cache +sudo apt install gettext intltool python3-gi python3-cairo python3-gi-cairo python3-distutils python3-dbus libglib2.0-dev libglib2.0-bin gir1.2-gtk-3.0 gtk-update-icon-cache # and for documentation sudo apt install itstool yelp ``` @@ -113,7 +113,7 @@ sudo apt install itstool yelp Leap-15.0 and Leap-15.1: ```bash -sudo zypper install intltool python3-pyxdg python3-cairo python3-gobject-Gdk +sudo zypper install intltool python3-cairo python3-gobject-Gdk sudo zypper install itstool yelp ``` diff --git a/org.gnome.Hamster.yml b/org.gnome.Hamster.yml index af20f442e..5f8dc0f49 100644 --- a/org.gnome.Hamster.yml +++ b/org.gnome.Hamster.yml @@ -19,14 +19,11 @@ modules: - setuptools.pth build-commands: - pip3 install --no-index --find-links="file://${PWD}" --prefix=${FLATPAK_DEST} - dbus-python pyxdg + dbus-python sources: - type: file url: https://dbus.freedesktop.org/releases/dbus-python/dbus-python-1.2.18.tar.gz sha256: 92bdd1e68b45596c833307a5ff4b217ee6929a1502f5341bae28fd120acf7260 - - type: file - url: https://files.pythonhosted.org/packages/ea/13/de39ddf4f9f9cea0c7684cd54a50d79c97ea99c9f6aed798fd13d0bd4609/pyxdg-0.27-py2.py3-none-any.whl - sha256: 2d6701ab7c74bbab8caa6a95e0a0a129b1643cf6c298bf7c569adec06d0709a0 - name: hamster buildsystem: simple builddir: true diff --git a/src/hamster/lib/configuration.py b/src/hamster/lib/configuration.py index 24b42c668..d2ba189c4 100644 --- a/src/hamster/lib/configuration.py +++ b/src/hamster/lib/configuration.py @@ -26,7 +26,6 @@ import os from hamster.client import Storage -from xdg.BaseDirectory import xdg_data_home from gi.repository import Gdk as gdk from gi.repository import Gio as gio @@ -122,7 +121,7 @@ def __init__(self): self.data_dir = os.path.realpath(self.data_dir) self.storage = Storage() - self.home_data_dir = os.path.realpath(os.path.join(xdg_data_home, "hamster")) + self.home_data_dir = os.path.realpath(os.path.join(glib.get_user_data_dir(), "hamster")) runtime = RuntimeStore() diff --git a/src/hamster/storage/db.py b/src/hamster/storage/db.py index 468a95f9e..49edd2fc2 100644 --- a/src/hamster/storage/db.py +++ b/src/hamster/storage/db.py @@ -102,14 +102,9 @@ def on_db_file_change(monitor, gio_file, event_uri, event): self.run_fixtures() def __init_db_file(self, database_dir): + from gi.repository import GLib + xdg_data_home = GLib.get_user_data_dir() if not database_dir: - try: - from xdg.BaseDirectory import xdg_data_home - except ImportError: - xdg_data_home = os.environ.get('XDG_DATA_HOME') - if not xdg_data_home: - xdg_data_home = os.path.join(os.path.expanduser('~'), '.local', 'share') - logger.warning("No xdg_data_home - assuming ~/.local/share") database_dir = os.path.join(xdg_data_home, 'hamster') if not os.path.exists(database_dir):