diff --git a/.github/workflows/testing.yml b/.github/workflows/testing.yml index 7eac188e6..e41475317 100644 --- a/.github/workflows/testing.yml +++ b/.github/workflows/testing.yml @@ -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 diff --git a/README.md b/README.md index 91b671007..b3c116d37 100644 --- a/README.md +++ b/README.md @@ -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`` @@ -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 ``` diff --git a/org.gnome.Hamster.GUI.service.in b/data/org.gnome.Hamster.GUI.service.in similarity index 100% rename from org.gnome.Hamster.GUI.service.in rename to data/org.gnome.Hamster.GUI.service.in diff --git a/org.gnome.Hamster.WindowServer.service.in b/data/org.gnome.Hamster.WindowServer.service.in similarity index 100% rename from org.gnome.Hamster.WindowServer.service.in rename to data/org.gnome.Hamster.WindowServer.service.in diff --git a/org.gnome.Hamster.yml b/data/org.gnome.Hamster.flatpak.yml similarity index 98% rename from org.gnome.Hamster.yml rename to data/org.gnome.Hamster.flatpak.yml index 47c285eda..7539591fc 100644 --- a/org.gnome.Hamster.yml +++ b/data/org.gnome.Hamster.flatpak.yml @@ -34,7 +34,7 @@ modules: - "./waf install" sources: - type: dir - path: "." + path: ".." finish-args: - "--socket=wayland" - "--socket=fallback-x11" diff --git a/data/org.gnome.Hamster.metainfo.xml.in b/data/org.gnome.Hamster.metainfo.xml.in index 81e3000c9..f7e790278 100644 --- a/data/org.gnome.Hamster.metainfo.xml.in +++ b/data/org.gnome.Hamster.metainfo.xml.in @@ -35,12 +35,16 @@ The overview window - https://raw.githubusercontent.com/projecthamster/hamster/master/screenshot.png + https://raw.githubusercontent.com/projecthamster/hamster/master/data/screenshots/overview.png The overview window with statistics https://raw.githubusercontent.com/projecthamster/hamster/master/data/screenshots/overview2.png + + The editor window + https://raw.githubusercontent.com/projecthamster/hamster/master/data/screenshots/editor.png + hamster https://github.com/projecthamster/hamster/wiki diff --git a/org.gnome.Hamster.service.in b/data/org.gnome.Hamster.service.in similarity index 100% rename from org.gnome.Hamster.service.in rename to data/org.gnome.Hamster.service.in diff --git a/screenshot.png b/data/screenshots/overview.png similarity index 100% rename from screenshot.png rename to data/screenshots/overview.png diff --git a/data/wscript b/data/wscript index e5a54fa5b..0db85cba1 100644 --- a/data/wscript +++ b/data/wscript @@ -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) @@ -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') @@ -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): diff --git a/src/hamster/.gitignore b/src/hamster/.gitignore index 414abbf74..a8213322e 100644 --- a/src/hamster/.gitignore +++ b/src/hamster/.gitignore @@ -1,4 +1,3 @@ *.pyc defs.py - - +.flatpak-builder diff --git a/src/hamster/client.py b/src/hamster/client.py index 8a0c297c3..ab3d3ba04 100644 --- a/src/hamster/client.py +++ b/src/hamster/client.py @@ -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 @@ -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(). - 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` diff --git a/src/hamster/defs.py.in b/src/hamster/defs.py.in index b87ff3695..c74866049 100644 --- a/src/hamster/defs.py.in +++ b/src/hamster/defs.py.in @@ -1,5 +1,2 @@ DATA_DIR = "@DATADIR@" -LIB_DIR = "@LIBDIR@" VERSION = "@VERSION@" -PACKAGE = "@PACKAGE@" -PYTHONDIR = "@PYTHONDIR@" diff --git a/src/hamster/version.py b/src/hamster/version.py index 1a3d8189b..5a064d887 100644 --- a/src/hamster/version.py +++ b/src/hamster/version.py @@ -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(): """ diff --git a/wscript b/wscript index cf89a7889..f5a7ac153 100644 --- a/wscript +++ b/wscript @@ -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' @@ -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)) @@ -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; @@ -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) @@ -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")