Skip to content

Commit

Permalink
Improved development experience using meson devenv
Browse files Browse the repository at this point in the history
In order to test/debug tuhi, installing it won't be necessary anymore.
Instead, you can run tuhi within the meson devenv (invoke `meson devenv
-C <builddir>) to develop against it.
  • Loading branch information
sp1ritCS committed Oct 27, 2022
1 parent e44e982 commit 535f4c0
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 5 deletions.
5 changes: 5 additions & 0 deletions meson.build
Original file line number Diff line number Diff line change
Expand Up @@ -176,3 +176,8 @@ endif
configure_file(input: 'tools/tuhi-gui-flatpak.py',
output: 'tuhi-gui-flatpak.py',
copy: true)

tuhi_devenv = environment()
tuhi_devenv.set('TUHI_DEVEL', meson.current_build_dir())
tuhi_devenv.set('PYTHONPATH', meson.current_source_dir())
meson.add_devenv(tuhi_devenv)
13 changes: 10 additions & 3 deletions tuhi-gui.in
Original file line number Diff line number Diff line change
Expand Up @@ -17,16 +17,23 @@ from gi.repository import Gio


@devel@ # NOQA
resource = Gio.resource_load(os.fspath(Path('@pkgdatadir@', 'tuhi.gresource')))
if "TUHI_DEVEL" in os.environ:
resource = Gio.resource_load(os.fspath(Path(os.environ["TUHI_DEVEL"], 'data', 'tuhi.gresource')))
else:
resource = Gio.resource_load(os.fspath(Path('@pkgdatadir@', 'tuhi.gresource')))
Gio.Resource._register(resource)


if __name__ == "__main__":
import gettext
import locale

locale.bindtextdomain('tuhi', '@localedir@')
gettext.bindtextdomain('tuhi', '@localedir@')
if "TUHI_DEVEL" in os.environ:
locale.bindtextdomain('tuhi', Path(os.environ["TUHI_DEVEL"], "po"))
gettext.bindtextdomain('tuhi', Path(os.environ["TUHI_DEVEL"], "po"))
else:
locale.bindtextdomain('tuhi', '@localedir@')
gettext.bindtextdomain('tuhi', '@localedir@')

from tuhi.gui.application import main
main(sys.argv)
9 changes: 7 additions & 2 deletions tuhi.in
Original file line number Diff line number Diff line change
Expand Up @@ -11,13 +11,18 @@
# GNU General Public License for more details.
#

import os
import sys
import subprocess
from pathlib import Path
import argparse

tuhi_server = Path('@libexecdir@', 'tuhi-server')
tuhi_gui = Path('@libexecdir@', 'tuhi-gui')
if "TUHI_DEVEL" in os.environ:
tuhi_server = Path(os.environ["TUHI_DEVEL"], 'tuhi-server')
tuhi_gui = Path(os.environ["TUHI_DEVEL"], 'tuhi-gui')
else:
tuhi_server = Path('@libexecdir@', 'tuhi-server')
tuhi_gui = Path('@libexecdir@', 'tuhi-gui')


@devel@ # NOQA
Expand Down

0 comments on commit 535f4c0

Please sign in to comment.