Skip to content

Commit

Permalink
Update debian packaging (#68)
Browse files Browse the repository at this point in the history
- Precompile gschema for other packaging
- Use dh-python to determine
  python depends
- Use namespace to find package files
- Use mamolinux repo for bugs
- Add python depends to setup.cfg
  • Loading branch information
hsbasu authored Oct 28, 2023
1 parent 104ecae commit fa7d511
Show file tree
Hide file tree
Showing 5 changed files with 38 additions and 22 deletions.
3 changes: 1 addition & 2 deletions .gitignore
100755 → 100644
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,5 @@ dist/*
# debian build files
.pybuild/*
usr/*
debian/python3-simple-pwgen/*
debian/simple-pwgen/*
debian/theme-manager/*
debian/*debhelper*
12 changes: 4 additions & 8 deletions debian/control
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,10 @@ Priority: optional
Maintainer: Himadri Sekhar Basu <[email protected]>
Build-Depends: debhelper-compat (= 13),
dh-python,
libglib2.0-bin,
python3-all,
python3-setuptools,
python3-sphinx,
python3-all
python3-sphinx
Standards-Version: 4.6.0
Homepage: https://hsbasu.github.io/theme-manager
#Vcs-Browser: https://salsa.debian.org/debian/theme-manager
Expand All @@ -16,13 +17,8 @@ Rules-Requires-Root: no

Package: theme-manager
Architecture: all
Depends: gobject-introspection,
gir1.2-gtk-3.0,
Depends: gir1.2-gtk-3.0,
gir1.2-appindicator3-0.1,
python3:any,
python3-configobj,
python3-gi,
python3-setproctitle,
python3-tldextract,
redshift,
${python3:Depends},
Expand Down
7 changes: 4 additions & 3 deletions debian/rules
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ export PYBUILD_NAME=theme-manager
export PYBUILD_INSTALL_ARGS_python3=--install-scripts=usr/bin

%:
dh ${@} --buildsystem=pybuild
dh ${@} --with=python3 --buildsystem=pybuild

# If you need to rebuild the Sphinx documentation
# Add sphinxdoc to the dh --with line
Expand All @@ -23,11 +23,12 @@ export PYBUILD_INSTALL_ARGS_python3=--install-scripts=usr/bin
# docs/ usr/share/man/man1 # Manpage generator

override_dh_install:
dh_install
rm -rf debian/theme-manager/usr/lib/python3.10/dist-packages/ThemeManager/__pycache__
dh_install -O--buildsystem=pybuild
rm -rf debian/theme-manager/usr/lib/python*/dist-packages/ThemeManager/__pycache__
install -D -m 0644 debian/theme-manager.1 debian/theme-manager/usr/share/man/man1/theme-manager.1
install -D -m 0644 data/org.mamolinux.theme-manager.gschema.xml.in debian/theme-manager/usr/share/glib-2.0/schemas/org.mamolinux.theme-manager.gschema.xml
install -D -m 0644 data/theme-manager-autostart.desktop.in debian/theme-manager/etc/xdg/autostart/theme-manager-autostart.desktop
rm -f debian/theme-manager/usr/share/glib-2.0/schemas/gschemas.compiled

override_dh_auto_install:
dh_auto_install --destdir=$(CURDIR)/$(DEB_SOURCE)
10 changes: 7 additions & 3 deletions setup.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,9 @@ author_email = [email protected]
description = Theme Manager
long_description = file: README.md
long_description_content_type = text/markdown
url = https://www.github.com/hsbasu/theme-manager
url = https://www.github.com/mamolinux/theme-manager
project_urls =
Bug Tracker = https://www.github.com/hsbasu/theme-manager/issues
Bug Tracker = https://www.github.com/mamolinux/theme-manager/issues
classifiers =
Development Status :: 5 - Production/Stable
Environment :: X11 Applications :: GTK
Expand All @@ -23,9 +23,13 @@ classifiers =
[options]
package_dir =
= src
packages = find:
packages = find_namespace:
python_requires = >=3.6
include_package_data = True
install_requires =
configobj
PyGObject
setproctitle

[options.package_data]
* = *VERSION, *ui
Expand Down
28 changes: 22 additions & 6 deletions setup.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import glob, os
import distutils.command.install_data

import glob

from distutils.log import info
from setuptools import setup
from subprocess import check_output

Expand All @@ -18,8 +19,23 @@
version = version.split('~')[0]
f.write("%s" % version)

setup(
data_files=[('share/applications', glob.glob("data/applications/*.desktop")),
('share/icons/hicolor/scalable/apps', glob.glob("data/icons/*")),
]
gschema_dir_suffix = 'share/glib-2.0/schemas'

class install_data(distutils.command.install_data.install_data):
def run(self):
# Python 3 'super' call.
super().run()

# Compile '*.gschema.xml' to update or create 'gschemas.compiled'.
info("compiling gsettings schemas")
# Use 'self.install_dir' to build the path, so that it works
# for both global and local '--user' installs.
gschema_dir = os.path.join(self.install_dir, gschema_dir_suffix)
self.spawn(["glib-compile-schemas", gschema_dir])

setup(data_files=[('share/applications', glob.glob("data/applications/*.desktop")),
('share/icons/hicolor/scalable/apps', glob.glob("data/icons/*")),
(gschema_dir_suffix, glob.glob("data/*.xml"))
],
cmdclass = {'install_data': install_data}
)

0 comments on commit fa7d511

Please sign in to comment.