Skip to content

Commit

Permalink
Merge pull request #749 from matthijskooijman/small-fixes
Browse files Browse the repository at this point in the history
A few small fixes
  • Loading branch information
matthijskooijman committed Dec 27, 2023
2 parents 9eb80bc + 685dc5f commit 81be67e
Show file tree
Hide file tree
Showing 14 changed files with 45 additions and 56 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/testing.yml
Original file line number Diff line number Diff line change
Expand Up @@ -102,10 +102,10 @@ jobs:
flatpak install --user -y flathub org.gnome.Platform//45 org.gnome.Sdk//45
- name: Build application
run: |
flatpak-builder --repo=build/flatpak/repo build/flatpak/tmp org.gnome.Hamster.yml
flatpak-builder --repo=build/flatpak/repo build/flatpak/tmp data/org.gnome.Hamster.flatpak.yml
- name: Run tests inside sandbox
run: |
dbus-launch flatpak-builder --run build/flatpak/tmp org.gnome.Hamster.yml python3 -m unittest
dbus-launch flatpak-builder --run build/flatpak/tmp data/org.gnome.Hamster.flatpak.yml python3 -m unittest
- name: Export bundle and try to install it
run: |
mkdir -p dist
Expand Down
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -175,7 +175,7 @@ GNOME SDK beforehand (an error will notify you about it, if needed). Execute:

```bash
flatpak-builder --force-clean --user --install \
build/flatpak org.gnome.Hamster.yml
build/flatpak data/org.gnome.Hamster.flatpak.yml
```

This creates a temporary flatpack build folder in the ``build/flatpak``
Expand Down Expand Up @@ -247,7 +247,7 @@ run:
To run the tests inside the flatpak, use:

```bash
flatpak-builder --run build/flatpak org.gnome.Hamster.yml \
flatpak-builder --run build/flatpak data/org.gnome.Hamster.flatpak.yml \
python3 -m unittest
```

Expand Down
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ modules:
- "./waf install"
sources:
- type: dir
path: "."
path: ".."
finish-args:
- "--socket=wayland"
- "--socket=fallback-x11"
Expand Down
6 changes: 5 additions & 1 deletion data/org.gnome.Hamster.metainfo.xml.in
Original file line number Diff line number Diff line change
Expand Up @@ -35,12 +35,16 @@
<screenshots>
<screenshot type="default">
<caption>The overview window</caption>
<image>https://raw.githubusercontent.com/projecthamster/hamster/master/screenshot.png</image>
<image>https://raw.githubusercontent.com/projecthamster/hamster/master/data/screenshots/overview.png</image>
</screenshot>
<screenshot>
<caption>The overview window with statistics</caption>
<image>https://raw.githubusercontent.com/projecthamster/hamster/master/data/screenshots/overview2.png</image>
</screenshot>
<screenshot>
<caption>The editor window</caption>
<image>https://raw.githubusercontent.com/projecthamster/hamster/master/data/screenshots/editor.png</image>
</screenshot>
</screenshots>
​<translation type="gettext">hamster</translation>
<url type="homepage">https://github.com/projecthamster/hamster/wiki</url>
Expand Down
File renamed without changes.
File renamed without changes
27 changes: 23 additions & 4 deletions data/wscript
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# This file is meant to be included in the root wscript,
# through the recurse("data") command.
# An advantage of keeping it there
# instead of blending it in the root wscript build()
# instead of blending it in the root wscript build()
# is that the files are looked for in the same folder
# (no need to prepend data/ everywhere)

Expand Down Expand Up @@ -30,15 +30,15 @@ def build(ctx):
dict = ctx.env,
install_path = "${DATADIR}/applications"
)

start_dir = ctx.path.find_dir('.')

# glade builder files
ctx.install_files('${DATADIR}/hamster', start_dir.ant_glob('*.ui'))
# default files
ctx.install_files('${DATADIR}/hamster', 'hamster.db')
ctx.install_files('${DATADIR}/hamster', 'report_template.html')

# icons
ctx.install_files('${DATADIR}/hamster/art', start_dir.ant_glob('art/*.png'))
ctx.install_files('${DATADIR}/icons/hicolor/16x16/apps', 'art/16x16/org.gnome.Hamster.GUI.png')
Expand All @@ -51,6 +51,25 @@ def build(ctx):
if not ctx.env.skip_icon_cache_update:
ctx.add_post_fun(update_icon_cache)

# dbus service files
ctx(features="subst",
source= "org.gnome.Hamster.service.in",
target= "org.gnome.Hamster.service",
install_path="${DATADIR}/dbus-1/services",
)

ctx(features="subst",
source= "org.gnome.Hamster.GUI.service.in",
target= "org.gnome.Hamster.GUI.service",
install_path="${DATADIR}/dbus-1/services",
)

ctx(features="subst",
source= "org.gnome.Hamster.WindowServer.service.in",
target= "org.gnome.Hamster.WindowServer.service",
install_path="${DATADIR}/dbus-1/services",
)


# icon cache update
def update_icon_cache(ctx):
Expand Down
3 changes: 1 addition & 2 deletions src/hamster/.gitignore
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
*.pyc
defs.py


.flatpak-builder
11 changes: 0 additions & 11 deletions src/hamster/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@
import sys

from calendar import timegm
from distutils.version import LooseVersion
from gi.repository import GObject as gobject
from textwrap import dedent

Expand All @@ -42,16 +41,6 @@
from hamster.lib import datetime as dt


# bug fixed in dbus-python 1.2.14 (released on 2019-11-25)
assert not (
sys.version_info >= (3, 8)
and LooseVersion(dbus.__version__) < LooseVersion("1.2.14")
), """python3.8 changed str(<dbus integers>).
That broke hamster (https://github.com/projecthamster/hamster/issues/477).
Please upgrade to dbus-python >= 1.2.14.
"""


class Storage(gobject.GObject):
"""Hamster client class, communicating to hamster storage daemon via d-bus.
Subscribe to the `tags-changed`, `facts-changed` and `activities-changed`
Expand Down
3 changes: 0 additions & 3 deletions src/hamster/defs.py.in
Original file line number Diff line number Diff line change
@@ -1,5 +1,2 @@
DATA_DIR = "@DATADIR@"
LIB_DIR = "@LIBDIR@"
VERSION = "@VERSION@"
PACKAGE = "@PACKAGE@"
PYTHONDIR = "@PYTHONDIR@"
4 changes: 2 additions & 2 deletions src/hamster/version.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,11 +19,11 @@ def get_uninstalled_version():
if rc == 0:
import re
# Strip "v" prefix that is used in git tags
return re.sub(r'^v', '', output)
return re.sub(r'^v', '', output.strip())
else:
from pathlib import Path
with open(Path(__file__).parent / 'VERSION', 'r') as f:
return f.read()
return f.read().strip()

def get_version():
"""
Expand Down
37 changes: 9 additions & 28 deletions wscript
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import subprocess
from waflib import Utils

# Reuse code from hamster to figure out the version number to use
process = subprocess.run(["python3", "src/hamster/version.py"], check=True, stdout=subprocess.PIPE, text=True)
process = subprocess.run(["python3", "src/hamster/version.py"], check=True, stdout=subprocess.PIPE, encoding='UTF-8')
VERSION = process.stdout
APPNAME = 'hamster'

Expand All @@ -22,23 +22,23 @@ def options(ctx):
# hence need to replace the whole option
ctx.parser.remove_option('--prefix')
default_prefix = '/usr'

ctx.add_option('--prefix', dest='prefix', default=default_prefix,
help='installation prefix [default: {}]'.format(default_prefix))

ctx.add_option('--skip-gsettings', dest='skip_gsettings', action='store_true',
help='skip gsettings schemas build and installation (for packagers)')

ctx.add_option('--skip-icon-cache-update', dest='skip_icon_cache_update', action='store_true',
help='skip icon cache update (for packagers)')


def configure(ctx):
ctx.load('gnu_dirs') # for DATADIR

if not ctx.options.skip_gsettings:
ctx.load('glib2') # for GSettings support

ctx.load('python')
ctx.check_python_version(minver=(3,4,0))

Expand All @@ -49,10 +49,9 @@ def configure(ctx):

ctx.env.VERSION = VERSION
ctx.env.GETTEXT_PACKAGE = "hamster"
ctx.env.PACKAGE = "hamster"


ctx.recurse("help")

# options are tied to a specific ./waf invocation (one terminal line),
# and woud have to be given again at any other ./waf invocation
# that is trouble when one wants to ./waf uninstall much later;
Expand All @@ -62,7 +61,7 @@ def configure(ctx):
for name in ('prefix', 'skip_gsettings', 'skip_icon_cache_update'):
value = getattr(ctx.options, name)
setattr(ctx.env, name, value)


def build(ctx):
ctx.install_as('${LIBEXECDIR}/hamster/hamster-service', "src/hamster-service.py", chmod=Utils.O755)
Expand All @@ -85,23 +84,5 @@ def build(ctx):
install_path="${PYTHONDIR}/hamster"
)

ctx(features="subst",
source= "org.gnome.Hamster.service.in",
target= "org.gnome.Hamster.service",
install_path="${DATADIR}/dbus-1/services",
)

ctx(features="subst",
source= "org.gnome.Hamster.GUI.service.in",
target= "org.gnome.Hamster.GUI.service",
install_path="${DATADIR}/dbus-1/services",
)

ctx(features="subst",
source= "org.gnome.Hamster.WindowServer.service.in",
target= "org.gnome.Hamster.WindowServer.service",
install_path="${DATADIR}/dbus-1/services",
)

# look for wscript into further directories
ctx.recurse("po data help")

0 comments on commit 81be67e

Please sign in to comment.