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 18, 2024
1 parent abc6a79 commit bfc4210
Show file tree
Hide file tree
Showing 8 changed files with 67 additions and 111 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/battery-monitor.in
graft src/ThemeManager/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
50 changes: 0 additions & 50 deletions setup.cfg

This file was deleted.

61 changes: 0 additions & 61 deletions setup.py

This file was deleted.

1 change: 1 addition & 0 deletions src/ThemeManager/VERSION.in
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
@version@
35 changes: 35 additions & 0 deletions src/ThemeManager/meson.build
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
python_sources = [
'about_window.py',
'common.py',
'DesktopTheme.py',
'gui.py',
'indicator.py',
'__init__.py',
'logger.py',
'LoginTheme.py',
'main.py',
'time_chooser.py',
'tm_daemon.py',
]

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

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

# Install assets like ui and icons
ui = files('ui/theme-manager.ui', 'ui/logger.ui')

install_data(
ui,
install_dir: join_paths(pysrcinstalldir, 'ThemeManager', 'ui')
)
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: 'theme-manager.in',
output: 'theme-manager',
configuration: conf,
install: true,
install_dir: bindir,
install_mode: 'rwxr-xr-x'
)

subdir('ThemeManager')
11 changes: 11 additions & 0 deletions src/theme-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 ThemeManager.main import start_TM
if __name__ == '__main__':
sys.argv[0] = re.sub(r'(-script\.pyw|\.exe)?$', '', sys.argv[0])
sys.exit(start_TM())

0 comments on commit bfc4210

Please sign in to comment.