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

kde-neon-6: Fix long standing theming issues with Qt snaps. #4884

Merged
55 changes: 40 additions & 15 deletions snapcraft/extensions/kde_neon_6.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@
# along with this program. If not, see <http://www.gnu.org/licenses/>.

"""Generic KDE NEON extension to support core22 and onwards."""

import dataclasses
import functools
import re
Expand Down Expand Up @@ -51,6 +50,8 @@ class KDENeon6(Extension):
It configures each application with the following plugs:

\b
- Common GTK themes.
- Common Qt themes.
- Common Icon Themes.
- Common Sound Themes.
- The Qt6 and KDE Frameworks 6 runtime libraries and utilities.
Expand Down Expand Up @@ -151,16 +152,51 @@ def get_root_snippet(self) -> Dict[str, Any]:
"compression": "lzo",
"plugs": {
"desktop": {"mount-host-font-cache": False},
"gtk-2-themes": {
"interface": "content",
"target": "$SNAP/data-dir/themes",
"default-provider": "gtk-common-themes",
},
"kde-gtk2-themes": {
"interface": "content",
"target": "$SNAP/data-dir/themes",
"default-provider": "qt-common-themes",
},
"kde-gtk3-themes": {
"interface": "content",
"target": "$SNAP/data-dir/themes",
"default-provider": "qt-common-themes",
},
"gtk-3-themes": {
"interface": "content",
"target": "$SNAP/data-dir/themes",
"default-provider": "gtk-common-themes",
},
"qt-icon-themes": {
"interface": "content",
"target": "$SNAP/data-dir/icons",
"default-provider": "qt-common-themes",
},
"icon-themes": {
"interface": "content",
"target": "$SNAP/data-dir/icons",
"default-provider": "gtk-common-themes",
},
"qt-sound-themes": {
"interface": "content",
"target": "$SNAP/data-dir/sounds",
"default-provider": "qt-common-themes",
},
"sound-themes": {
"interface": "content",
"target": "$SNAP/data-dir/sounds",
"default-provider": "gtk-common-themes",
},
"qt-6-themes": {
"interface": "content",
"target": "$SNAP/kf6",
"default-provider": "qt-common-themes",
},
platform_kf6_snap: {
"content": content_kf6_snap,
"interface": "content",
Expand Down Expand Up @@ -223,23 +259,12 @@ def get_part_snippet(self, *, plugin_name: str) -> Dict[str, Any]:
"LD_LIBRARY_PATH": prepend_to_env(
"LD_LIBRARY_PATH",
[
# Qt6 arch specific libs
f"/snap/{qt6_sdk_snap}/current/usr/lib/"
"${CRAFT_ARCH_TRIPLET_BUILD_FOR}",
# Qt6 libs
f"/snap/{qt6_sdk_snap}/current/usr/lib",
# kf6 arch specific libs
f"${{CRAFT_ARCH_TRIPLET_BUILD_FOR}}",
f"/snap/{kf6_sdk_snap}/current/usr/lib/"
"${CRAFT_ARCH_TRIPLET_BUILD_FOR}",
# blas
f"/snap/{kf6_sdk_snap}/current/usr/lib/"
"${CRAFT_ARCH_TRIPLET_BUILD_FOR}/blas",
# lapack
f"/snap/{kf6_sdk_snap}/current/usr/lib/"
"${CRAFT_ARCH_TRIPLET_BUILD_FOR}/lapack",
# kf6 libs
f"${{CRAFT_ARCH_TRIPLET_BUILD_FOR}}",
f"/snap/{qt6_sdk_snap}/current/usr/lib",
f"/snap/{kf6_sdk_snap}/current/usr/lib",
# Staged libs
"$CRAFT_STAGE/usr/lib/${CRAFT_ARCH_TRIPLET_BUILD_FOR}",
"$CRAFT_STAGE/usr/lib",
"$CRAFT_STAGE/lib/",
Expand Down
80 changes: 72 additions & 8 deletions tests/unit/extensions/test_kde_neon_6.py
Original file line number Diff line number Diff line change
Expand Up @@ -121,16 +121,51 @@ def test_get_root_snippet(kde_neon_6_extension):
},
"plugs": {
"desktop": {"mount-host-font-cache": False},
"gtk-2-themes": {
"interface": "content",
"target": "$SNAP/data-dir/themes",
"default-provider": "gtk-common-themes",
},
"kde-gtk2-themes": {
"interface": "content",
"target": "$SNAP/data-dir/themes",
"default-provider": "qt-common-themes",
},
"kde-gtk3-themes": {
"interface": "content",
"target": "$SNAP/data-dir/themes",
"default-provider": "qt-common-themes",
},
"gtk-3-themes": {
"interface": "content",
"target": "$SNAP/data-dir/themes",
"default-provider": "gtk-common-themes",
},
"qt-icon-themes": {
"interface": "content",
"target": "$SNAP/data-dir/icons",
"default-provider": "qt-common-themes",
},
"icon-themes": {
"interface": "content",
"target": "$SNAP/data-dir/icons",
"default-provider": "gtk-common-themes",
},
"qt-sound-themes": {
"interface": "content",
"target": "$SNAP/data-dir/sounds",
"default-provider": "qt-common-themes",
},
"sound-themes": {
"interface": "content",
"target": "$SNAP/data-dir/sounds",
"default-provider": "gtk-common-themes",
},
"qt-6-themes": {
"interface": "content",
"target": "$SNAP/kf6",
"default-provider": "qt-common-themes",
},
"kf6-core22": {
"content": "kf6-core22-all",
"interface": "content",
Expand Down Expand Up @@ -158,16 +193,51 @@ def test_get_root_snippet_with_external_sdk(kde_neon_6_extension_with_build_snap
},
"plugs": {
"desktop": {"mount-host-font-cache": False},
"gtk-2-themes": {
"interface": "content",
"target": "$SNAP/data-dir/themes",
"default-provider": "gtk-common-themes",
},
"kde-gtk2-themes": {
"interface": "content",
"target": "$SNAP/data-dir/themes",
"default-provider": "qt-common-themes",
},
"kde-gtk3-themes": {
"interface": "content",
"target": "$SNAP/data-dir/themes",
"default-provider": "qt-common-themes",
},
"gtk-3-themes": {
"interface": "content",
"target": "$SNAP/data-dir/themes",
"default-provider": "gtk-common-themes",
},
"qt-icon-themes": {
"interface": "content",
"target": "$SNAP/data-dir/icons",
"default-provider": "qt-common-themes",
},
"icon-themes": {
"interface": "content",
"target": "$SNAP/data-dir/icons",
"default-provider": "gtk-common-themes",
},
"qt-sound-themes": {
"interface": "content",
"target": "$SNAP/data-dir/sounds",
"default-provider": "qt-common-themes",
},
"sound-themes": {
"interface": "content",
"target": "$SNAP/data-dir/sounds",
"default-provider": "gtk-common-themes",
},
"qt-6-themes": {
"interface": "content",
"target": "$SNAP/kf6",
"default-provider": "qt-common-themes",
},
"kf6-core22": {
"content": "kf6-core22-all",
"interface": "content",
Expand Down Expand Up @@ -221,12 +291,8 @@ def assert_get_part_snippet(kde_neon_6_instance):
{
"LD_LIBRARY_PATH": (
"/snap/kde-qt6-core22-sdk/current/usr/lib/${CRAFT_ARCH_TRIPLET_BUILD_FOR}:"
"/snap/kde-qt6-core22-sdk/current/usr/lib:"
"/snap/kf6-core22-sdk/current/usr/lib/${CRAFT_ARCH_TRIPLET_BUILD_FOR}:"
"/snap/kf6-core22-sdk/current/usr/lib/${CRAFT_ARCH_TRIPLET_BUILD_FOR}"
ScarlettGatelyMoore marked this conversation as resolved.
Show resolved Hide resolved
"/blas:"
"/snap/kf6-core22-sdk/current/usr/lib/${CRAFT_ARCH_TRIPLET_BUILD_FOR}"
"/lapack:"
"/snap/kde-qt6-core22-sdk/current/usr/lib:"
"/snap/kf6-core22-sdk/current/usr/lib:"
"$CRAFT_STAGE/usr/lib/${CRAFT_ARCH_TRIPLET_BUILD_FOR}:"
"$CRAFT_STAGE/usr/lib:"
Expand Down Expand Up @@ -287,10 +353,8 @@ def test_get_part_snippet_with_external_sdk(kde_neon_6_extension_with_build_snap
{
"LD_LIBRARY_PATH": (
"/snap/kde-qt6-core22-sdk/current/usr/lib/${CRAFT_ARCH_TRIPLET_BUILD_FOR}:"
"/snap/kde-qt6-core22-sdk/current/usr/lib:"
"/snap/kf6-core22-sdk/current/usr/lib/${CRAFT_ARCH_TRIPLET_BUILD_FOR}:"
"/snap/kf6-core22-sdk/current/usr/lib/${CRAFT_ARCH_TRIPLET_BUILD_FOR}/blas:"
"/snap/kf6-core22-sdk/current/usr/lib/${CRAFT_ARCH_TRIPLET_BUILD_FOR}/lapack:"
"/snap/kde-qt6-core22-sdk/current/usr/lib:"
"/snap/kf6-core22-sdk/current/usr/lib:"
"$CRAFT_STAGE/usr/lib/${CRAFT_ARCH_TRIPLET_BUILD_FOR}:"
"$CRAFT_STAGE/usr/lib:"
Expand Down
Loading