Skip to content

Commit

Permalink
Install python sources using meson build
Browse files Browse the repository at this point in the history
- Setup meson to install python sources
  during python and meson builds
- Install executable binary using meson
  and avoid using python builds for now
- Remove unnecessary python packaging files
  • Loading branch information
hsbasu committed Oct 19, 2024
1 parent 794148d commit 6e6c092
Show file tree
Hide file tree
Showing 7 changed files with 66 additions and 68 deletions.
1 change: 1 addition & 0 deletions MANIFEST.in
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
include debian/changelog
global-exclude *.py[cod]
graft data*
include src/leaptime-manager.in
graft src/LeapTimeManager/ui*
2 changes: 2 additions & 0 deletions meson.build
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,8 @@ prefix = get_option('prefix')
bindir = get_option('bindir')
datadir = get_option('datadir')

subdir('src')

gnome.post_install(
glib_compile_schemas: true,
gtk_update_icon_cache: true,
Expand Down
68 changes: 0 additions & 68 deletions setup.py

This file was deleted.

1 change: 1 addition & 0 deletions src/LeaptimeManager/VERSION.in
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
@version@
34 changes: 34 additions & 0 deletions src/LeaptimeManager/meson.build
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
python_sources = [
'about_window.py',
'appBackup.py',
'common.py',
'dataBackup.py',
'database_rw.py',
'dialogs.py',
'gui.py',
'__init__.py',
'logger.py',
'main.py',
]

version_file = configure_file(
input: 'VERSION.in',
output: 'VERSION',
configuration: {
'version': meson.project_version(),
}
)

python.install_sources(
python_sources, version_file,
subdir: 'LeaptimeManager',
preserve_path: true,
)

# Install assets like ui and icons
ui = files('ui/app_backup.ui', 'ui/logger.ui', 'ui/MainWindow.ui', 'ui/user_data.ui')

install_data(
ui,
install_dir: join_paths(pysrcinstalldir, 'LeaptimeManager', 'ui')
)
11 changes: 11 additions & 0 deletions src/leaptime-manager.in
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
#!@PYTHON@
# -*- coding: utf-8 -*-
import re
import sys

sys.path.insert(1, '@pkgdatadir@')

from LeaptimeManager.main import start_LTMCli
if __name__ == '__main__':
sys.argv[0] = re.sub(r'(-script\.pyw|\.exe)?$', '', sys.argv[0])
sys.exit(start_LTMCli())
17 changes: 17 additions & 0 deletions src/meson.build
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
pysrcinstalldir = python.get_install_dir() # python.get_path('platlib')
message(f'Python dir: @pysrcinstalldir@')

conf = configuration_data()
conf.set('PYTHON', python.full_path())
conf.set('pkgdatadir', pysrcinstalldir)

configure_file(
input: 'leaptime-manager.in',
output: 'leaptime-manager',
configuration: conf,
install: true,
install_dir: bindir,
install_mode: 'rwxr-xr-x'
)

subdir('LeaptimeManager')

0 comments on commit 6e6c092

Please sign in to comment.