Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improved development experience using meson devenv #296

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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_BUILD_DIR', meson.current_build_dir())
tuhi_devenv.set('PYTHONPATH', meson.current_source_dir())
meson.add_devenv(tuhi_devenv)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

alrighty, this needs a version check please - our CI pulls down 0.53 and devenv was added in 0.58.

ideally we should modify the CI so it also tests against current meson from pip but... who's got the time for that...

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ideally we should modify the CI so it also tests against current meson from pip but... who's got the time for that...

any problem with bumping ubuntu from 20.04lts to 22.04lts?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

bumping the CI is fine and easy enough but I suspect we have quite a few users that will stay on 20.04 for quite a while. Better to put the version check in.

Comment on lines +179 to +183
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
tuhi_devenv = environment()
tuhi_devenv.set('TUHI_DEVEL_BUILD_DIR', meson.current_build_dir())
tuhi_devenv.set('PYTHONPATH', meson.current_source_dir())
meson.add_devenv(tuhi_devenv)
if meson.version().version_compare('>= 0.58')
tuhi_devenv = environment()
tuhi_devenv.set('TUHI_DEVEL_BUILD_DIR', meson.current_build_dir())
tuhi_devenv.set('PYTHONPATH', meson.current_source_dir())
meson.add_devenv(tuhi_devenv)
endif

15 changes: 12 additions & 3 deletions tuhi-gui.in
Original file line number Diff line number Diff line change
Expand Up @@ -17,16 +17,25 @@ from gi.repository import Gio


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

resource = Gio.resource_load(os.fspath(resource_path))
Gio.Resource._register(resource)


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

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

from tuhi.gui.application import main
main(sys.argv)
5 changes: 3 additions & 2 deletions tuhi.in
Original file line number Diff line number Diff line change
Expand Up @@ -11,13 +11,14 @@
# 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')
tuhi_server = Path(os.environ.get("TUHI_DEVEL_BUILD_DIR", "@libexecdir@"), 'tuhi-server')
tuhi_gui = Path(os.environ.get("TUHI_DEVEL_BUILD_DIR", "@libexecdir@"), 'tuhi-gui')


@devel@ # NOQA
Expand Down