Skip to content

Commit

Permalink
Remove pyxdg dependency
Browse files Browse the repository at this point in the history
  • Loading branch information
André Apitzsch authored and aquaherd committed Nov 14, 2023
1 parent 5eee453 commit c5c6d44
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 15 deletions.
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
```
Expand All @@ -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
```

Expand Down
5 changes: 1 addition & 4 deletions org.gnome.Hamster.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
3 changes: 1 addition & 2 deletions src/hamster/lib/configuration.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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()
Expand Down
9 changes: 2 additions & 7 deletions src/hamster/storage/db.py
Original file line number Diff line number Diff line change
Expand Up @@ -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):
Expand Down

0 comments on commit c5c6d44

Please sign in to comment.