From eb33e30d36924a52c9a178d988be996d1ef8592a Mon Sep 17 00:00:00 2001 From: Scarlett Moore Date: Fri, 20 Jan 2023 10:54:00 -0700 Subject: [PATCH 01/50] Add kde-neon extension support for core22. --- snapcraft/extensions/kde-neon.py | 237 +++++++++++++++ snapcraft/extensions/registry.py | 2 + tests/spread/extensions/kde-neon/task.yaml | 11 +- tests/unit/commands/test_list_extensions.py | 4 +- tests/unit/extensions/test_kde-neon.py | 309 ++++++++++++++++++++ tests/unit/extensions/test_registry.py | 1 + 6 files changed, 559 insertions(+), 5 deletions(-) create mode 100644 snapcraft/extensions/kde-neon.py create mode 100644 tests/unit/extensions/test_kde-neon.py diff --git a/snapcraft/extensions/kde-neon.py b/snapcraft/extensions/kde-neon.py new file mode 100644 index 0000000000..2426ec49fd --- /dev/null +++ b/snapcraft/extensions/kde-neon.py @@ -0,0 +1,237 @@ +# -*- Mode:Python; indent-tabs-mode:nil; tab-width:4 -*- +# +# Copyright 2022 Canonical Ltd. +# 2023 Scarlett Moore +# +# This program is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License version 3 as +# published by the Free Software Foundation. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program. If not, see . + +"""Generic KDE NEON extension to support core22 and onwards.""" +import dataclasses +import functools +import re +from typing import Any, Dict, List, Optional, Tuple + +from overrides import overrides + +from .extension import Extension, get_extensions_data_dir, prepend_to_env + +_SDK_SNAP = {"core22": "kde-frameworks-5-102-qt-5-15-8-core22-sd"} +_ExtensionInfo = namedtuple("ExtensionInfo", "cmake_args content provider build_snaps") + +_Info = dict( + core22=_ExtensionInfo( + cmake_args="-DCMAKE_FIND_ROOT_PATH=/snap/kde-frameworks-5-102-qt-5-15-8-core22-sd/current", + content="kde-frameworks-5-102-qt-5-15-8-core22-all", + provider="kde-frameworks-5-102-qt-5-15-8-core22", + build_snaps=["kde-frameworks-5-102-qt-5-15-8-core22-sd/latest/stable"], + ), +) + +@dataclasses.dataclass +class KDESnaps: + """A structure of KDE related snaps.""" + + sdk: str + content: str + builtin: bool = True + + +class KDENEON(Extension): + """The KDE Neon extension. + + This extension makes it easy to assemble KDE based applications + using the Neon stack. + + It configures each application with the following plugs: + + \b + - Common Icon Themes. + - Common Sound Themes. + - The Qt5 and KDE Frameworks runtime libraries and utilities. + + For easier desktop integration, it also configures each application + entry with these additional plugs: + + \b + - desktop (https://snapcraft.io/docs/desktop-interface) + - desktop-legacy (https://snapcraft.io/docs/desktop-legacy-interface) + - opengl (https://snapcraft.io/docs/opengl-interface) + - wayland (https://snapcraft.io/docs/wayland-interface) + - x11 (https://snapcraft.io/docs/x11-interface) + """ + + @staticmethod + @overrides + def get_supported_bases() -> Tuple[str, ...]: + return ("core22",) + + @staticmethod + @overrides + def get_supported_confinement() -> Tuple[str, ...]: + return "strict", "devmode" + + @staticmethod + @overrides + def is_experimental(base: Optional[str]) -> bool: + return False + + @overrides + def get_app_snippet(self) -> Dict[str, Any]: + return { + "command-chain": ["snap/command-chain/desktop-launch"], + "plugs": [ + "desktop", + "desktop-legacy", + "opengl", + "wayland", + "x11" + ], + } + + @functools.cached_property + def kde_snaps(self) -> KDESnaps: + """Return the KDE related snaps to use to construct the environment.""" + base = self.yaml_data["base"] + info = _Info[yaml_data[base]] + sdk_snap = _SDK_SNAP[base] + + build_snaps: info.build_snaps + content = info.content + return KDESnaps(sdk=sdk_snap, content=content, builtin=False) + + @overrides + def get_root_snippet(self) -> Dict[str, Any]: + platform_snap = self.kde_snaps.content + + return { + "assumes": ["snapd2.43"], # for 'snapctl is-connected' + "compression": "lzo", + "plugs": { + "desktop": {"mount-host-font-cache": False}, + "icon-themes": { + "interface": "content", + "target": "$SNAP/data-dir/icons", + "default-provider": "gtk-common-themes", + }, + "sound-themes": { + "interface": "content", + "target": "$SNAP/data-dir/sounds", + "default-provider": "gtk-common-themes", + }, + info.provider: { + "content": info.content, + "interface": "content", + "default-provider": info.provider, + "target": "$SNAP/kf5", + }, + }, + "environment": {"SNAP_DESKTOP_RUNTIME": "$SNAP/kf5"}, + "hooks": { + "configure": { + "plugs": ["desktop"], + "command-chain": ["snap/command-chain/hooks-configure-desktop"], + } + }, + "layout": {"/usr/share/X11": {"symlink": "$SNAP/kf5/usr/share/X11"}}, + } + @overrides + def get_part_snippet(self) -> Dict[str, Any]: + sdk_snap = self.kde_snaps.sdk + + return { + "build-environment": [ + { + "PATH": prepend_to_env( + "PATH", [f"/snap/{sdk_snap}/current/usr/bin"] + ), + }, + { + "XDG_DATA_DIRS": prepend_to_env( + "XDG_DATA_DIRS", + [ + f"$SNAPCRAFT_STAGE/usr/share:/snap/{sdk_snap}/current/usr/share", + "/usr/share", + ], + ), + }, + { + "LD_LIBRARY_PATH": prepend_to_env( + "LD_LIBRARY_PATH", + [ + f"/snap/{sdk_snap}/current/lib/$CRAFT_ARCH_TRIPLET", + f"/snap/{sdk_snap}/current/usr/lib/$CRAFT_ARCH_TRIPLET", + f"/snap/{sdk_snap}/current/usr/lib", + f"/snap/{sdk_snap}/current/usr/lib/vala-current", + f"/snap/{sdk_snap}/current/usr/lib/$CRAFT_ARCH_TRIPLET/pulseaudio", + ], + ), + }, + { + "PKG_CONFIG_PATH": prepend_to_env( + "PKG_CONFIG_PATH", + [ + f"/snap/{sdk_snap}/current/usr/lib/$CRAFT_ARCH_TRIPLET/pkgconfig", + f"/snap/{sdk_snap}/current/usr/lib/pkgconfig", + f"/snap/{sdk_snap}/current/usr/share/pkgconfig", + ], + ), + }, + { + "GETTEXTDATADIRS": prepend_to_env( + "GETTEXTDATADIRS", + [ + f"/snap/{sdk_snap}/current/usr/share/gettext-current", + ], + ), + }, + { + "ACLOCAL_PATH": prepend_to_env( + "ACLOCAL_PATH", + [ + f"/snap/{sdk_snap}/current/usr/share/aclocal", + ], + ), + }, + { + "PYTHONPATH": prepend_to_env( + "PYTHONPATH", + [ + f"/snap/{sdk_snap}/current/usr/lib/python3.10", + f"/snap/{sdk_snap}/current/usr/lib/python3/dist-packages", + f"/snap/{sdk_snap}/current/usr/lib/$CRAFT_ARCH_TRIPLET" + "/gobject-introspection", + ], + ), + }, + { + if info.cmake_args is not None: + "SNAPCRAFT_CMAKE_ARGS": prepend_to_env( + "SNAPCRAFT_CMAKE_ARGS", + [info.cmake_args], + ), + }, + ], + } + + @overrides + def get_parts_snippet(self) -> Dict[str, Any]: + return { + "kde-neon-extension": { + "source": "$SNAPCRAFT_EXTENSIONS_DIR/desktop", + "source-subdir": "kde-neon", + "plugin": "make", + "make-parameters": [f"PLATFORM_PLUG={info.provider}"], + "build-packages": ["g++"], + "build-snaps": info.build_snaps, + } + } diff --git a/snapcraft/extensions/registry.py b/snapcraft/extensions/registry.py index 425fc17154..603573d089 100644 --- a/snapcraft/extensions/registry.py +++ b/snapcraft/extensions/registry.py @@ -22,6 +22,7 @@ from .gnome import GNOME from .ros2_humble import ROS2HumbleExtension +from .kde-neon import KDENEON if TYPE_CHECKING: from .extension import Extension @@ -31,6 +32,7 @@ _EXTENSIONS: Dict[str, "ExtensionType"] = { "gnome": GNOME, "ros2-humble": ROS2HumbleExtension, + "kde-neon": KDENEON, } diff --git a/tests/spread/extensions/kde-neon/task.yaml b/tests/spread/extensions/kde-neon/task.yaml index bf61ae3abd..74a9182142 100644 --- a/tests/spread/extensions/kde-neon/task.yaml +++ b/tests/spread/extensions/kde-neon/task.yaml @@ -4,12 +4,12 @@ summary: Build and run a basic kde snap using extensions # available on a subset of all the architectures this testbed # can run on. systems: - - ubuntu-18.04 - - ubuntu-18.04-64 - - ubuntu-18.04-amd64 - ubuntu-20.04 - ubuntu-20.04-64 - ubuntu-20.04-amd64 + - ubuntu-22.04 + - ubunut-22.04-64 + - ubuntu-22.04-amd64 environment: SNAP_DIR: ../snaps/neon-hello @@ -37,6 +37,7 @@ execute: | cd "$SNAP_DIR" output="$(snapcraft)" snap install neon-hello_*.snap --dangerous + snap connect neon-hello:kde-frameworks-5-102-qt-5-15-8-core22 kde-frameworks-5-102-qt-5-15-8-core22 [ "$(neon-hello)" = "hello world" ] @@ -47,6 +48,10 @@ execute: | [ -f "$snap_user_data/.last_revision" ] [ "$(cat "$snap_user_data/.last_revision")" = "SNAP_DESKTOP_LAST_REVISION=x1" ] + # Verify content snap was installed for dependency checks. + snap list kde-frameworks-5-102-qt-5-15-8-core22 + snap list gtk-common-themes + # Verify all dependencies were found. if echo "$output" | grep -q "part is missing libraries"; then echo "failed to find content snaps' libraries" diff --git a/tests/unit/commands/test_list_extensions.py b/tests/unit/commands/test_list_extensions.py index 95417e0715..731f5db850 100644 --- a/tests/unit/commands/test_list_extensions.py +++ b/tests/unit/commands/test_list_extensions.py @@ -41,7 +41,7 @@ def test_command(emitter, command): gnome-3-28 core18 gnome-3-34 core18 gnome-3-38 core20 - kde-neon core18, core20 + kde-neon core18, core20, core22 ros1-noetic core20 ros2-foxy core20 ros2-humble core22""" @@ -67,7 +67,7 @@ def test_command_extension_dups(emitter, command): gnome-3-28 core18 gnome-3-34 core18 gnome-3-38 core20 - kde-neon core18, core20 + kde-neon core18, core20, core22 ros1-noetic core20 ros2-foxy core20 ros2-humble core22""" diff --git a/tests/unit/extensions/test_kde-neon.py b/tests/unit/extensions/test_kde-neon.py new file mode 100644 index 0000000000..c00d83f9e8 --- /dev/null +++ b/tests/unit/extensions/test_kde-neon.py @@ -0,0 +1,309 @@ +# -*- Mode:Python; indent-tabs-mode:nil; tab-width:4 -*- +# +# Copyright 2022 Canonical Ltd. +# +# This program is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License version 3 as +# published by the Free Software Foundation. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program. If not, see . + +import pytest + +from snapcraft.extensions import kde-neon +from snapcraft.extensions.extension import get_extensions_data_dir + +############ +# Fixtures # +############ + + +@pytest.fixture +def kde-neon_extension(): + return kde-neon.KDENEON( + yaml_data={"base": "core22", "parts": {}}, arch="amd64", target_arch="amd64" + ) + + +@pytest.fixture +def kde-neon_extension_with_build_snap(): + return gnome.GNOME( + yaml_data={ + "base": "core22", + "parts": {"part1": {"build-snaps": ["kde-frameworks-5-102-qt-5-15-8-core22-sd/latest/stable"]}}, + }, + arch="amd64", + target_arch="amd64", + ) + + +@pytest.fixture +def kde-neon_extension_with_default_build_snap_from_latest_edge(): + return kde-neon.KDENEON( + yaml_data={ + "base": "core22", + "parts": {"part1": {"build-snaps": ["kde-frameworks-5-102-qt-5-15-8-core22-sd/latest/edge"]}}, + }, + arch="amd64", + target_arch="amd64", + ) + + +################### +# GNOME Extension # +################### + + +def test_get_supported_bases(kde-neon_extension): + assert kde-neon_extension.get_supported_bases() == ("core22",) + + +def test_get_supported_confinement(kde-neon_extension): + assert kde-neon_extension.get_supported_confinement() == ("strict", "devmode") + + +def test_is_experimental(): + assert kde-neon.KDENEON.is_experimental(base="core22") is False + + +def test_get_app_snippet(kde-neon_extension): + assert kde-neon_extension.get_app_snippet() == { + "command-chain": ["snap/command-chain/desktop-launch"], + "plugs": ["desktop", + "desktop-legacy", + "opengl", + "wayland", + "x11"], + } + + +def test_get_root_snippet(kde-neon_extension): + assert kde-neon_extension.get_root_snippet() == { + "assumes": ["snapd2.43"], + "environment": {"SNAP_DESKTOP_RUNTIME": "$SNAP/kf5"}, + "hooks": { + "configure": { + "plugs": ["desktop"], + "command-chain": ["snap/command-chain/hooks-configure-desktop"], + } + }, + "layout": {"/usr/share/X11": {"symlink": "$SNAP/kf5/usr/share/X11"}}, + "plugs": { + "desktop": {"mount-host-font-cache": False}, + "icon-themes": { + "interface": "content", + "target": "$SNAP/data-dir/icons", + "default-provider": "gtk-common-themes", + }, + "sound-themes": { + "interface": "content", + "target": "$SNAP/data-dir/sounds", + "default-provider": "gtk-common-themes", + }, + "kde-frameworks-5-102-qt-5-15-8-core22": { + "content": "kde-frameworks-5-102-qt-5-15-8-core22-all", + "interface": "content", + "default-provider": "kde-frameworks-5-102-qt-5-15-8-core22", + "target": "$SNAP/kf5", + }, + }, + } + + +def test_get_root_snippet_with_external_sdk(kde-neon_extension_with_build_snap): + assert kde-neon_extension_with_build_snap.get_root_snippet() == { + "assumes": ["snapd2.43"], + "environment": {"SNAP_DESKTOP_RUNTIME": "$SNAP/kf5"}, + "hooks": { + "configure": { + "plugs": ["desktop"], + "command-chain": ["snap/command-chain/hooks-configure-desktop"], + } + }, + "layout": {"/usr/share/X11": {"symlink": "$SNAP/kf5/usr/share/X11"}}, + "plugs": { + "desktop": {"mount-host-font-cache": False}, + "icon-themes": { + "interface": "content", + "target": "$SNAP/data-dir/icons", + "default-provider": "gtk-common-themes", + }, + "sound-themes": { + "interface": "content", + "target": "$SNAP/data-dir/sounds", + "default-provider": "gtk-common-themes", + }, + "kde-frameworks-5-102-qt-5-15-8-core22": { + "content": "kde-frameworks-5-102-qt-5-15-8-core22-all", + "interface": "content", + "default-provider": "kde-frameworks-5-102-qt-5-15-8-core22", + "target": "$SNAP/kf5", + }, + }, + } + + +class TestGetPartSnippet: + """Tests for KDENEON.get_part_snippet when using the default sdk snap name.""" + + def test_get_part_snippet(self, kde-neon_extension): + self.assert_get_part_snippet(kde-neon_extension) + + def test_get_part_snippet_latest_edge( + self, kde-neon_extension_with_default_build_snap_from_latest_edge + ): + self.assert_get_part_snippet( + kde-neon_extension_with_default_build_snap_from_latest_edge + ) + + @staticmethod + def assert_get_part_snippet(kde-neon_instance): + assert kde-neon_instance.get_part_snippet() == { + "build-environment": [ + { + "PATH": prepend_to_env( + "PATH", [f"/snap/kde-frameworks-5-102-qt-5-15-8-core22-sd/current/usr/bin"] + ), + }, + { + "XDG_DATA_DIRS": prepend_to_env( + "XDG_DATA_DIRS", + [ + f"$SNAPCRAFT_STAGE/usr/share:/snap/kde-frameworks-5-102-qt-5-15-8-core22-sd/current/usr/share", + "/usr/share", + ], + ), + }, + { + "LD_LIBRARY_PATH": prepend_to_env( + "LD_LIBRARY_PATH", + [ + f"/snap/kde-frameworks-5-102-qt-5-15-8-core22-sd/current/lib/$CRAFT_ARCH_TRIPLET", + f"/snap/kde-frameworks-5-102-qt-5-15-8-core22-sd/current/usr/lib/$CRAFT_ARCH_TRIPLET", + f"/snap/kde-frameworks-5-102-qt-5-15-8-core22-sd/current/usr/lib", + f"/snap/kde-frameworks-5-102-qt-5-15-8-core22-sd/current/usr/lib/vala-current", + f"/snap/kde-frameworks-5-102-qt-5-15-8-core22-sd/current/usr/lib/$CRAFT_ARCH_TRIPLET/pulseaudio", + ], + ), + }, + { + "PKG_CONFIG_PATH": prepend_to_env( + "PKG_CONFIG_PATH", + [ + f"/snap/kde-frameworks-5-102-qt-5-15-8-core22-sd/current/usr/lib/$CRAFT_ARCH_TRIPLET/pkgconfig", + f"/snap/kde-frameworks-5-102-qt-5-15-8-core22-sd/current/usr/lib/pkgconfig", + f"/snap/kde-frameworks-5-102-qt-5-15-8-core22-sd/current/usr/share/pkgconfig", + ], + ), + }, + { + "GETTEXTDATADIRS": prepend_to_env( + "GETTEXTDATADIRS", + [ + f"/snap/kde-frameworks-5-102-qt-5-15-8-core22-sd/current/usr/share/gettext-current", + ], + ), + }, + { + "ACLOCAL_PATH": prepend_to_env( + "ACLOCAL_PATH", + [ + f"/snap/kde-frameworks-5-102-qt-5-15-8-core22-sd/current/usr/share/aclocal", + ], + ), + }, + { + "PYTHONPATH": prepend_to_env( + "PYTHONPATH", + [ + f"/snap/kde-frameworks-5-102-qt-5-15-8-core22-sd/current/usr/lib/python3.10", + f"/snap/kde-frameworks-5-102-qt-5-15-8-core22-sd/current/usr/lib/python3/dist-packages", + f"/snap/kde-frameworks-5-102-qt-5-15-8-core22-sd/current/usr/lib/$CRAFT_ARCH_TRIPLET" + "/gobject-introspection", + ], + ), + }, + { + "SNAPCRAFT_CMAKE_ARGS": prepend_to_env( + "SNAPCRAFT_CMAKE_ARGS", + ["-DCMAKE_FIND_ROOT_PATH=/snap/kde-frameworks-5-102-qt-5-15-8-core22-sd/current"], + ), + }, + ], + } + + +def test_get_part_snippet_with_external_sdk(kde-neon_extension_with_build_snap): + assert kde-neon_extension_with_build_snap.get_part_snippet() == { + "build-environment": [ + {"PATH": "/snap/kde-frameworks-5-102-qt-5-15-8-core22-sd/current/usr/bin${PATH:+:$PATH}"}, + { + "XDG_DATA_DIRS": ( + "$SNAPCRAFT_STAGE/usr/share:/snap/kde-frameworks-5-102-qt-5-15-8-core22-sd" + "/current/usr/share:/usr/share${XDG_DATA_DIRS:+:$XDG_DATA_DIRS}" + ) + }, + { + "LD_LIBRARY_PATH": ":".join( + [ + "/snap/kde-frameworks-5-102-qt-5-15-8-core22-sd/current/lib/$CRAFT_ARCH_TRIPLET", + "/snap/kde-frameworks-5-102-qt-5-15-8-core22-sd/current/usr/lib/$CRAFT_ARCH_TRIPLET", + "/snap/kde-frameworks-5-102-qt-5-15-8-core22-sd/current/usr/lib", + "/snap/kde-frameworks-5-102-qt-5-15-8-core22-sd/current/usr/lib/vala-current", + "/snap/kde-frameworks-5-102-qt-5-15-8-core22-sd/current/usr/lib/$CRAFT_ARCH_TRIPLET/pulseaudio", + ] + ) + + "${LD_LIBRARY_PATH:+:$LD_LIBRARY_PATH}" + }, + { + "PKG_CONFIG_PATH": ( + "/snap/kde-frameworks-5-102-qt-5-15-8-core22-sd/current/usr/lib/$CRAFT_ARCH_TRIPLET/pkgconfig:" + "/snap/kde-frameworks-5-102-qt-5-15-8-core22-sd/current/usr/lib/pkgconfig:" + "/snap/kde-frameworks-5-102-qt-5-15-8-core22-sd/current/usr/share/pkgconfig" + "${PKG_CONFIG_PATH:+:$PKG_CONFIG_PATH}" + ) + }, + { + "GETTEXTDATADIRS": ( + "/snap/kde-frameworks-5-102-qt-5-15-8-core22-sd/current/usr/share/gettext-current" + "${GETTEXTDATADIRS:+:$GETTEXTDATADIRS}" + ) + }, + { + "ACLOCAL_PATH": ( + "/snap/kde-frameworks-5-102-qt-5-15-8-core22-sd/current/usr/share/aclocal" + "${ACLOCAL_PATH:+:$ACLOCAL_PATH}" + ) + }, + { + "PYTHONPATH": ":".join( + [ + "/snap/kde-frameworks-5-102-qt-5-15-8-core22-sd/current/usr/lib/python3.10", + "/snap/kde-frameworks-5-102-qt-5-15-8-core22-sd/current/usr/lib/python3/dist-packages", + "/snap/kde-frameworks-5-102-qt-5-15-8-core22-sd/current/usr/lib/$CRAFT_ARCH_TRIPLET" + "/gobject-introspection", + ] + ) + + "${PYTHONPATH:+:$PYTHONPATH}" + }, + ] + } + + +def test_get_parts_snippet(kde-neon_extension): + assert kde-neon_extension.get_parts_snippet() == { + "kde-neon-extension": { + "source": "$SNAPCRAFT_EXTENSIONS_DIR/desktop", + "source-subdir": "kde-neon", + "plugin": "make", + "make-parameters": [f"PLATFORM_PLUG={"kde-frameworks-5-102-qt-5-15-8-core22"}"], + "build-packages": ["g++"], + "build-snaps": "kde-frameworks-5-102-qt-5-15-8-core22-sd/latest/stable", + } + } diff --git a/tests/unit/extensions/test_registry.py b/tests/unit/extensions/test_registry.py index d4f2accf5b..4d082d2ab0 100644 --- a/tests/unit/extensions/test_registry.py +++ b/tests/unit/extensions/test_registry.py @@ -26,6 +26,7 @@ def test_get_extension_names(): assert extensions.get_extension_names() == [ "gnome", "ros2-humble", + "kde-neon" "fake-extension-experimental", "fake-extension-extra", "fake-extension", From 0934eb5150fb157c7d97f261febb385aa0754cb7 Mon Sep 17 00:00:00 2001 From: Scarlett Moore Date: Wed, 25 Jan 2023 08:34:36 -0700 Subject: [PATCH 02/50] Rename extension filename, convert tuples to dataclass, use match to capture sdk snaps. --- .../extensions/{kde-neon.py => kde_neon.py} | 77 +++++++++++++------ 1 file changed, 53 insertions(+), 24 deletions(-) rename snapcraft/extensions/{kde-neon.py => kde_neon.py} (78%) diff --git a/snapcraft/extensions/kde-neon.py b/snapcraft/extensions/kde_neon.py similarity index 78% rename from snapcraft/extensions/kde-neon.py rename to snapcraft/extensions/kde_neon.py index 2426ec49fd..34b9aa2498 100644 --- a/snapcraft/extensions/kde-neon.py +++ b/snapcraft/extensions/kde_neon.py @@ -26,16 +26,12 @@ from .extension import Extension, get_extensions_data_dir, prepend_to_env _SDK_SNAP = {"core22": "kde-frameworks-5-102-qt-5-15-8-core22-sd"} -_ExtensionInfo = namedtuple("ExtensionInfo", "cmake_args content provider build_snaps") -_Info = dict( - core22=_ExtensionInfo( - cmake_args="-DCMAKE_FIND_ROOT_PATH=/snap/kde-frameworks-5-102-qt-5-15-8-core22-sd/current", - content="kde-frameworks-5-102-qt-5-15-8-core22-all", - provider="kde-frameworks-5-102-qt-5-15-8-core22", - build_snaps=["kde-frameworks-5-102-qt-5-15-8-core22-sd/latest/stable"], - ), -) +@dataclasses.dataclass +class ExtensionInfo: + """ Content/SDK build information""" + + cmake_args: str @dataclasses.dataclass class KDESnaps: @@ -46,7 +42,7 @@ class KDESnaps: builtin: bool = True -class KDENEON(Extension): +class KDENeon(Extension): """The KDE Neon extension. This extension makes it easy to assemble KDE based applications @@ -102,12 +98,30 @@ def get_app_snippet(self) -> Dict[str, Any]: def kde_snaps(self) -> KDESnaps: """Return the KDE related snaps to use to construct the environment.""" base = self.yaml_data["base"] - info = _Info[yaml_data[base]] sdk_snap = _SDK_SNAP[base] - build_snaps: info.build_snaps - content = info.content - return KDESnaps(sdk=sdk_snap, content=content, builtin=False) + build_snaps: List[str] = [] + for part in self.yaml_data["parts"].values(): + build_snaps.extend(part.get("build-snaps", [])) + + matcher = re.compile(r"kde-frameworks-\d+-qt-\d+" + base + r"sd.*") + sdk_snap_candidates = [s for s in build_snaps if matcher.match(s)] + if sdk_snap_candidates: + sdk_snap = sdk_snap_candidates[0].split("/")[0] + builtin = False + else: + builtin = True + # The same except the trailing -sdk + content = sdk_snap[:-3] + + return KDESnaps(sdk=sdk_snap, content=content, builtin=builtin) + + @functools.cached_property + def ext_info(self) -> ExtensionInfo: + """Return the extension info cmake_args, provider, content, build_snaps""" + cmake_args=f"-DCMAKE_FIND_ROOT_PATH=/snap/" + self.kde_snaps.sdk + f"/current" + + return ExtensionInfo(cmake_args=cmake_args) @overrides def get_root_snippet(self) -> Dict[str, Any]: @@ -128,10 +142,9 @@ def get_root_snippet(self) -> Dict[str, Any]: "target": "$SNAP/data-dir/sounds", "default-provider": "gtk-common-themes", }, - info.provider: { - "content": info.content, + platform_snap: { "interface": "content", - "default-provider": info.provider, + "default-provider": platform_snap, "target": "$SNAP/kf5", }, }, @@ -147,6 +160,7 @@ def get_root_snippet(self) -> Dict[str, Any]: @overrides def get_part_snippet(self) -> Dict[str, Any]: sdk_snap = self.kde_snaps.sdk + cmake_args = self.ext_info.cmake_args return { "build-environment": [ @@ -214,10 +228,12 @@ def get_part_snippet(self) -> Dict[str, Any]: ), }, { - if info.cmake_args is not None: + if cmake_args is not None: "SNAPCRAFT_CMAKE_ARGS": prepend_to_env( "SNAPCRAFT_CMAKE_ARGS", - [info.cmake_args], + [ + f"{cmake_args}", + ], ), }, ], @@ -225,13 +241,26 @@ def get_part_snippet(self) -> Dict[str, Any]: @overrides def get_parts_snippet(self) -> Dict[str, Any]: + source = get_extensions_data_dir() / "desktop" / "command-chain" + + if self.kde_snaps.builtin: + base = self.yaml_data["base"] + sdk_snap = _SDK_SNAP[base] + provider = self.kde_snaps.content + "-all" + return { + "kde-neon-extension": { + "source": str(source), + "source-subdir": "kde-neon" + "plugin": "make", + "make-parameters": [f"PLATFORM_PLUG={provider}"], + "build-packages": ["g++"], + "build-snaps": [sdk_snap], + } + } + return { "kde-neon-extension": { - "source": "$SNAPCRAFT_EXTENSIONS_DIR/desktop", - "source-subdir": "kde-neon", + "source": str(source), "plugin": "make", - "make-parameters": [f"PLATFORM_PLUG={info.provider}"], - "build-packages": ["g++"], - "build-snaps": info.build_snaps, } } From 93ab5d27b1d02992355259defa464847e3e5e318 Mon Sep 17 00:00:00 2001 From: Scarlett Moore Date: Wed, 25 Jan 2023 08:40:19 -0700 Subject: [PATCH 03/50] Update import and Class name in registry. --- snapcraft/extensions/registry.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/snapcraft/extensions/registry.py b/snapcraft/extensions/registry.py index 603573d089..7749dd78c6 100644 --- a/snapcraft/extensions/registry.py +++ b/snapcraft/extensions/registry.py @@ -22,7 +22,7 @@ from .gnome import GNOME from .ros2_humble import ROS2HumbleExtension -from .kde-neon import KDENEON +from .kde_neon import KDENeon if TYPE_CHECKING: from .extension import Extension @@ -32,7 +32,7 @@ _EXTENSIONS: Dict[str, "ExtensionType"] = { "gnome": GNOME, "ros2-humble": ROS2HumbleExtension, - "kde-neon": KDENEON, + "kde-neon": KDENeon, } From f62b68d9093d2b90f18b5f5674526bc77be51596 Mon Sep 17 00:00:00 2001 From: Scarlett Moore Date: Wed, 25 Jan 2023 09:12:47 -0700 Subject: [PATCH 04/50] Update platform plug to match test. Update tests with new class name, add cmake env to test. --- snapcraft/extensions/kde_neon.py | 4 ++- tests/unit/extensions/test_kde-neon.py | 45 ++++++++++++++++++++------ 2 files changed, 39 insertions(+), 10 deletions(-) diff --git a/snapcraft/extensions/kde_neon.py b/snapcraft/extensions/kde_neon.py index 34b9aa2498..bee106065d 100644 --- a/snapcraft/extensions/kde_neon.py +++ b/snapcraft/extensions/kde_neon.py @@ -126,6 +126,7 @@ def ext_info(self) -> ExtensionInfo: @overrides def get_root_snippet(self) -> Dict[str, Any]: platform_snap = self.kde_snaps.content + content_snap = self.kde_snaps.content + f"-all" return { "assumes": ["snapd2.43"], # for 'snapctl is-connected' @@ -143,6 +144,7 @@ def get_root_snippet(self) -> Dict[str, Any]: "default-provider": "gtk-common-themes", }, platform_snap: { + "content": content_snap, "interface": "content", "default-provider": platform_snap, "target": "$SNAP/kf5", @@ -246,7 +248,7 @@ def get_parts_snippet(self) -> Dict[str, Any]: if self.kde_snaps.builtin: base = self.yaml_data["base"] sdk_snap = _SDK_SNAP[base] - provider = self.kde_snaps.content + "-all" + provider = self.kde_snaps.content + f"-all" return { "kde-neon-extension": { "source": str(source), diff --git a/tests/unit/extensions/test_kde-neon.py b/tests/unit/extensions/test_kde-neon.py index c00d83f9e8..dac4099c13 100644 --- a/tests/unit/extensions/test_kde-neon.py +++ b/tests/unit/extensions/test_kde-neon.py @@ -16,7 +16,7 @@ import pytest -from snapcraft.extensions import kde-neon +from snapcraft.extensions import kde_neon from snapcraft.extensions.extension import get_extensions_data_dir ############ @@ -26,14 +26,14 @@ @pytest.fixture def kde-neon_extension(): - return kde-neon.KDENEON( + return kde_neon.KDENeon yaml_data={"base": "core22", "parts": {}}, arch="amd64", target_arch="amd64" ) @pytest.fixture def kde-neon_extension_with_build_snap(): - return gnome.GNOME( + return kde_neon.KDENeon( yaml_data={ "base": "core22", "parts": {"part1": {"build-snaps": ["kde-frameworks-5-102-qt-5-15-8-core22-sd/latest/stable"]}}, @@ -45,7 +45,7 @@ def kde-neon_extension_with_build_snap(): @pytest.fixture def kde-neon_extension_with_default_build_snap_from_latest_edge(): - return kde-neon.KDENEON( + return kde_neon.KDENeon( yaml_data={ "base": "core22", "parts": {"part1": {"build-snaps": ["kde-frameworks-5-102-qt-5-15-8-core22-sd/latest/edge"]}}, @@ -56,7 +56,7 @@ def kde-neon_extension_with_default_build_snap_from_latest_edge(): ################### -# GNOME Extension # +# KDENeon Extension # ################### @@ -69,7 +69,7 @@ def test_get_supported_confinement(kde-neon_extension): def test_is_experimental(): - assert kde-neon.KDENEON.is_experimental(base="core22") is False + assert kde_neon.KDENeon.is_experimental(base="core22") is False def test_get_app_snippet(kde-neon_extension): @@ -150,7 +150,7 @@ def test_get_root_snippet_with_external_sdk(kde-neon_extension_with_build_snap): class TestGetPartSnippet: - """Tests for KDENEON.get_part_snippet when using the default sdk snap name.""" + """Tests for KDENeon.get_part_snippet when using the default sdk snap name.""" def test_get_part_snippet(self, kde-neon_extension): self.assert_get_part_snippet(kde-neon_extension) @@ -292,6 +292,11 @@ def test_get_part_snippet_with_external_sdk(kde-neon_extension_with_build_snap): ) + "${PYTHONPATH:+:$PYTHONPATH}" }, + { + "SNAPCRAFT_CMAKE_ARGS": ( + "-DCMAKE_FIND_ROOT_PATH=/snap/kde-frameworks-5-102-qt-5-15-8-core22-sd/current" + ) + }, ] } @@ -302,8 +307,30 @@ def test_get_parts_snippet(kde-neon_extension): "source": "$SNAPCRAFT_EXTENSIONS_DIR/desktop", "source-subdir": "kde-neon", "plugin": "make", - "make-parameters": [f"PLATFORM_PLUG={"kde-frameworks-5-102-qt-5-15-8-core22"}"], + "make-parameters": [f"PLATFORM_PLUG={"kde-frameworks-5-102-qt-5-15-8-core22-all"}"], "build-packages": ["g++"], - "build-snaps": "kde-frameworks-5-102-qt-5-15-8-core22-sd/latest/stable", + "build-snaps": ["kde-frameworks-5-102-qt-5-15-8-core22-sd"], } } + +def test_get_parts_snippet_with_external_sdk(kde-neon_extension_with_build_snap): + assert kde-neon_extension_with_build_snap.get_parts_snippet() == { + "kde-neon-extension": { + "source": str(get_extensions_data_dir() / "desktop" / "command-chain"), + "plugin": "make", + } + } + + +def test_get_parts_snippet_with_external_sdk_different_channel( + kde-neon_extension_with_default_build_snap_from_latest_edge, +): + assert ( + kde-neon_extension_with_default_build_snap_from_latest_edge.get_parts_snippet() + == { + "kde-neon-extension": { + "source": str(get_extensions_data_dir() / "desktop" / "command-chain"), + "plugin": "make", + } + } + ) From 96a13965ae493002fc2219abd6aec3ab20c9f099 Mon Sep 17 00:00:00 2001 From: Scarlett Moore Date: Wed, 25 Jan 2023 10:46:55 -0700 Subject: [PATCH 05/50] Fix lint tests. --- snapcraft/extensions/kde_neon.py | 1 - tests/spread/extensions/kde-neon/task.yaml | 2 +- tests/unit/extensions/test_registry.py | 2 +- 3 files changed, 2 insertions(+), 3 deletions(-) diff --git a/snapcraft/extensions/kde_neon.py b/snapcraft/extensions/kde_neon.py index bee106065d..c165b17dbd 100644 --- a/snapcraft/extensions/kde_neon.py +++ b/snapcraft/extensions/kde_neon.py @@ -230,7 +230,6 @@ def get_part_snippet(self) -> Dict[str, Any]: ), }, { - if cmake_args is not None: "SNAPCRAFT_CMAKE_ARGS": prepend_to_env( "SNAPCRAFT_CMAKE_ARGS", [ diff --git a/tests/spread/extensions/kde-neon/task.yaml b/tests/spread/extensions/kde-neon/task.yaml index 74a9182142..8e1a42e230 100644 --- a/tests/spread/extensions/kde-neon/task.yaml +++ b/tests/spread/extensions/kde-neon/task.yaml @@ -8,7 +8,7 @@ systems: - ubuntu-20.04-64 - ubuntu-20.04-amd64 - ubuntu-22.04 - - ubunut-22.04-64 + - ubuntu-22.04-64 - ubuntu-22.04-amd64 environment: diff --git a/tests/unit/extensions/test_registry.py b/tests/unit/extensions/test_registry.py index 4d082d2ab0..118e815171 100644 --- a/tests/unit/extensions/test_registry.py +++ b/tests/unit/extensions/test_registry.py @@ -26,7 +26,7 @@ def test_get_extension_names(): assert extensions.get_extension_names() == [ "gnome", "ros2-humble", - "kde-neon" + "kde-neon", "fake-extension-experimental", "fake-extension-extra", "fake-extension", From 437bbbe16e6d0b68a57d6f50bade0444b1b663c0 Mon Sep 17 00:00:00 2001 From: Scarlett Moore Date: Wed, 25 Jan 2023 11:12:57 -0700 Subject: [PATCH 06/50] Fix black test. --- snapcraft/extensions/kde_neon.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/snapcraft/extensions/kde_neon.py b/snapcraft/extensions/kde_neon.py index c165b17dbd..05b62c78d2 100644 --- a/snapcraft/extensions/kde_neon.py +++ b/snapcraft/extensions/kde_neon.py @@ -251,7 +251,7 @@ def get_parts_snippet(self) -> Dict[str, Any]: return { "kde-neon-extension": { "source": str(source), - "source-subdir": "kde-neon" + "source-subdir": "kde-neon", "plugin": "make", "make-parameters": [f"PLATFORM_PLUG={provider}"], "build-packages": ["g++"], From 273990353c894a8dcc7ffd7f466f5eaa5d3b2c6f Mon Sep 17 00:00:00 2001 From: Scarlett Moore Date: Wed, 25 Jan 2023 12:05:10 -0700 Subject: [PATCH 07/50] Fix syntax found by black test. --- tests/unit/extensions/test_kde-neon.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/unit/extensions/test_kde-neon.py b/tests/unit/extensions/test_kde-neon.py index dac4099c13..7f9738020a 100644 --- a/tests/unit/extensions/test_kde-neon.py +++ b/tests/unit/extensions/test_kde-neon.py @@ -26,7 +26,7 @@ @pytest.fixture def kde-neon_extension(): - return kde_neon.KDENeon + return kde_neon.KDENeon( yaml_data={"base": "core22", "parts": {}}, arch="amd64", target_arch="amd64" ) From 014b18423c72de8622fbe57830f47fd6c0fe8161 Mon Sep 17 00:00:00 2001 From: Scarlett Moore Date: Wed, 25 Jan 2023 12:36:24 -0700 Subject: [PATCH 08/50] Fix syntax found by black. --- tests/unit/extensions/test_kde-neon.py | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/tests/unit/extensions/test_kde-neon.py b/tests/unit/extensions/test_kde-neon.py index 7f9738020a..449294dbcc 100644 --- a/tests/unit/extensions/test_kde-neon.py +++ b/tests/unit/extensions/test_kde-neon.py @@ -27,7 +27,12 @@ @pytest.fixture def kde-neon_extension(): return kde_neon.KDENeon( - yaml_data={"base": "core22", "parts": {}}, arch="amd64", target_arch="amd64" + yaml_data={ + "base": "core22", + "parts": {}, + }, + arch="amd64", + target_arch="amd64", ) From aabd50f1a3117095a945812d1980531d89a57ff0 Mon Sep 17 00:00:00 2001 From: Scarlett Moore Date: Thu, 26 Jan 2023 02:04:26 -0700 Subject: [PATCH 09/50] Fix kde-neon ext test formatting. --- tests/unit/extensions/test_kde-neon.py | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) diff --git a/tests/unit/extensions/test_kde-neon.py b/tests/unit/extensions/test_kde-neon.py index 449294dbcc..7f9738020a 100644 --- a/tests/unit/extensions/test_kde-neon.py +++ b/tests/unit/extensions/test_kde-neon.py @@ -27,12 +27,7 @@ @pytest.fixture def kde-neon_extension(): return kde_neon.KDENeon( - yaml_data={ - "base": "core22", - "parts": {}, - }, - arch="amd64", - target_arch="amd64", + yaml_data={"base": "core22", "parts": {}}, arch="amd64", target_arch="amd64" ) From 076438144e88193998b80ecfdc77b82bf19f98cc Mon Sep 17 00:00:00 2001 From: Scarlett Moore Date: Thu, 26 Jan 2023 02:36:09 -0700 Subject: [PATCH 10/50] Also rename the test with underscore kde_neon --- .../{test_kde-neon.py => test_kde_neon.py} | 62 +++++++++---------- 1 file changed, 31 insertions(+), 31 deletions(-) rename tests/unit/extensions/{test_kde-neon.py => test_kde_neon.py} (87%) diff --git a/tests/unit/extensions/test_kde-neon.py b/tests/unit/extensions/test_kde_neon.py similarity index 87% rename from tests/unit/extensions/test_kde-neon.py rename to tests/unit/extensions/test_kde_neon.py index 7f9738020a..92b01a458b 100644 --- a/tests/unit/extensions/test_kde-neon.py +++ b/tests/unit/extensions/test_kde_neon.py @@ -25,14 +25,14 @@ @pytest.fixture -def kde-neon_extension(): +def kde_neon_extension(): return kde_neon.KDENeon( yaml_data={"base": "core22", "parts": {}}, arch="amd64", target_arch="amd64" ) @pytest.fixture -def kde-neon_extension_with_build_snap(): +def kde_neon_extension_with_build_snap(): return kde_neon.KDENeon( yaml_data={ "base": "core22", @@ -44,7 +44,7 @@ def kde-neon_extension_with_build_snap(): @pytest.fixture -def kde-neon_extension_with_default_build_snap_from_latest_edge(): +def kde_neon_extension_with_default_build_snap_from_latest_edge(): return kde_neon.KDENeon( yaml_data={ "base": "core22", @@ -60,20 +60,20 @@ def kde-neon_extension_with_default_build_snap_from_latest_edge(): ################### -def test_get_supported_bases(kde-neon_extension): - assert kde-neon_extension.get_supported_bases() == ("core22",) +def test_get_supported_bases(kde_neon_extension): + assert kde_neon_extension.get_supported_bases() == ("core22",) -def test_get_supported_confinement(kde-neon_extension): - assert kde-neon_extension.get_supported_confinement() == ("strict", "devmode") +def test_get_supported_confinement(kde_neon_extension): + assert kde_neon_extension.get_supported_confinement() == ("strict", "devmode") def test_is_experimental(): assert kde_neon.KDENeon.is_experimental(base="core22") is False -def test_get_app_snippet(kde-neon_extension): - assert kde-neon_extension.get_app_snippet() == { +def test_get_app_snippet(kde_neon_extension): + assert kde_neon_extension.get_app_snippet() == { "command-chain": ["snap/command-chain/desktop-launch"], "plugs": ["desktop", "desktop-legacy", @@ -83,8 +83,8 @@ def test_get_app_snippet(kde-neon_extension): } -def test_get_root_snippet(kde-neon_extension): - assert kde-neon_extension.get_root_snippet() == { +def test_get_root_snippet(kde_neon_extension): + assert kde_neon_extension.get_root_snippet() == { "assumes": ["snapd2.43"], "environment": {"SNAP_DESKTOP_RUNTIME": "$SNAP/kf5"}, "hooks": { @@ -116,8 +116,8 @@ def test_get_root_snippet(kde-neon_extension): } -def test_get_root_snippet_with_external_sdk(kde-neon_extension_with_build_snap): - assert kde-neon_extension_with_build_snap.get_root_snippet() == { +def test_get_root_snippet_with_external_sdk(kde_neon_extension_with_build_snap): + assert kde_neon_extension_with_build_snap.get_root_snippet() == { "assumes": ["snapd2.43"], "environment": {"SNAP_DESKTOP_RUNTIME": "$SNAP/kf5"}, "hooks": { @@ -152,19 +152,19 @@ def test_get_root_snippet_with_external_sdk(kde-neon_extension_with_build_snap): class TestGetPartSnippet: """Tests for KDENeon.get_part_snippet when using the default sdk snap name.""" - def test_get_part_snippet(self, kde-neon_extension): - self.assert_get_part_snippet(kde-neon_extension) + def test_get_part_snippet(self, kde_neon_extension): + self.assert_get_part_snippet(kde_neon_extension) def test_get_part_snippet_latest_edge( - self, kde-neon_extension_with_default_build_snap_from_latest_edge + self, kde_neon_extension_with_default_build_snap_from_latest_edge ): self.assert_get_part_snippet( - kde-neon_extension_with_default_build_snap_from_latest_edge + kde_neon_extension_with_default_build_snap_from_latest_edge ) @staticmethod - def assert_get_part_snippet(kde-neon_instance): - assert kde-neon_instance.get_part_snippet() == { + def assert_get_part_snippet(kde_neon_instance): + assert kde_neon_instance.get_part_snippet() == { "build-environment": [ { "PATH": prepend_to_env( @@ -239,8 +239,8 @@ def assert_get_part_snippet(kde-neon_instance): } -def test_get_part_snippet_with_external_sdk(kde-neon_extension_with_build_snap): - assert kde-neon_extension_with_build_snap.get_part_snippet() == { +def test_get_part_snippet_with_external_sdk(kde_neon_extension_with_build_snap): + assert kde_neon_extension_with_build_snap.get_part_snippet() == { "build-environment": [ {"PATH": "/snap/kde-frameworks-5-102-qt-5-15-8-core22-sd/current/usr/bin${PATH:+:$PATH}"}, { @@ -301,11 +301,11 @@ def test_get_part_snippet_with_external_sdk(kde-neon_extension_with_build_snap): } -def test_get_parts_snippet(kde-neon_extension): - assert kde-neon_extension.get_parts_snippet() == { - "kde-neon-extension": { +def test_get_parts_snippet(kde_neon_extension): + assert kde_neon_extension.get_parts_snippet() == { + "kde_neon-extension": { "source": "$SNAPCRAFT_EXTENSIONS_DIR/desktop", - "source-subdir": "kde-neon", + "source-subdir": "kde_neon", "plugin": "make", "make-parameters": [f"PLATFORM_PLUG={"kde-frameworks-5-102-qt-5-15-8-core22-all"}"], "build-packages": ["g++"], @@ -313,9 +313,9 @@ def test_get_parts_snippet(kde-neon_extension): } } -def test_get_parts_snippet_with_external_sdk(kde-neon_extension_with_build_snap): - assert kde-neon_extension_with_build_snap.get_parts_snippet() == { - "kde-neon-extension": { +def test_get_parts_snippet_with_external_sdk(kde_neon_extension_with_build_snap): + assert kde_neon_extension_with_build_snap.get_parts_snippet() == { + "kde_neon-extension": { "source": str(get_extensions_data_dir() / "desktop" / "command-chain"), "plugin": "make", } @@ -323,12 +323,12 @@ def test_get_parts_snippet_with_external_sdk(kde-neon_extension_with_build_snap) def test_get_parts_snippet_with_external_sdk_different_channel( - kde-neon_extension_with_default_build_snap_from_latest_edge, + kde_neon_extension_with_default_build_snap_from_latest_edge, ): assert ( - kde-neon_extension_with_default_build_snap_from_latest_edge.get_parts_snippet() + kde_neon_extension_with_default_build_snap_from_latest_edge.get_parts_snippet() == { - "kde-neon-extension": { + "kde_neon-extension": { "source": str(get_extensions_data_dir() / "desktop" / "command-chain"), "plugin": "make", } From bdbef5cb362903c10724361c51b48e658a65a6f8 Mon Sep 17 00:00:00 2001 From: Scarlett Moore Date: Thu, 26 Jan 2023 03:00:48 -0700 Subject: [PATCH 11/50] Fix expectation yaml for kde-neon-extension and make-parameters in kde_neon test --- tests/unit/extensions/test_kde_neon.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/tests/unit/extensions/test_kde_neon.py b/tests/unit/extensions/test_kde_neon.py index 92b01a458b..1055f0ca62 100644 --- a/tests/unit/extensions/test_kde_neon.py +++ b/tests/unit/extensions/test_kde_neon.py @@ -303,11 +303,11 @@ def test_get_part_snippet_with_external_sdk(kde_neon_extension_with_build_snap): def test_get_parts_snippet(kde_neon_extension): assert kde_neon_extension.get_parts_snippet() == { - "kde_neon-extension": { + "kde-neon-extension": { "source": "$SNAPCRAFT_EXTENSIONS_DIR/desktop", "source-subdir": "kde_neon", "plugin": "make", - "make-parameters": [f"PLATFORM_PLUG={"kde-frameworks-5-102-qt-5-15-8-core22-all"}"], + "make-parameters": ["PLATFORM_PLUG=kde-frameworks-5-102-qt-5-15-8-core22-all"], "build-packages": ["g++"], "build-snaps": ["kde-frameworks-5-102-qt-5-15-8-core22-sd"], } @@ -315,7 +315,7 @@ def test_get_parts_snippet(kde_neon_extension): def test_get_parts_snippet_with_external_sdk(kde_neon_extension_with_build_snap): assert kde_neon_extension_with_build_snap.get_parts_snippet() == { - "kde_neon-extension": { + "kde-neon-extension": { "source": str(get_extensions_data_dir() / "desktop" / "command-chain"), "plugin": "make", } From 918bde173ff7ad23c5878abfacb6bea22e200efe Mon Sep 17 00:00:00 2001 From: Scarlett Moore Date: Thu, 26 Jan 2023 03:15:05 -0700 Subject: [PATCH 12/50] Formatting! kde-neon test. --- tests/unit/extensions/test_kde_neon.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tests/unit/extensions/test_kde_neon.py b/tests/unit/extensions/test_kde_neon.py index 1055f0ca62..7722a6a16c 100644 --- a/tests/unit/extensions/test_kde_neon.py +++ b/tests/unit/extensions/test_kde_neon.py @@ -305,12 +305,12 @@ def test_get_parts_snippet(kde_neon_extension): assert kde_neon_extension.get_parts_snippet() == { "kde-neon-extension": { "source": "$SNAPCRAFT_EXTENSIONS_DIR/desktop", - "source-subdir": "kde_neon", + "source-subdir": "kde-neon", "plugin": "make", "make-parameters": ["PLATFORM_PLUG=kde-frameworks-5-102-qt-5-15-8-core22-all"], "build-packages": ["g++"], "build-snaps": ["kde-frameworks-5-102-qt-5-15-8-core22-sd"], - } + } } def test_get_parts_snippet_with_external_sdk(kde_neon_extension_with_build_snap): From db1e9c3f675d249ce477c9c8d9d82687f659a756 Mon Sep 17 00:00:00 2001 From: Scarlett Moore Date: Thu, 26 Jan 2023 03:41:00 -0700 Subject: [PATCH 13/50] More formatting fixes for kde_neon ext and test. --- snapcraft/extensions/kde_neon.py | 15 ++- tests/unit/extensions/test_kde_neon.py | 133 ++++++++++++++----------- 2 files changed, 80 insertions(+), 68 deletions(-) diff --git a/snapcraft/extensions/kde_neon.py b/snapcraft/extensions/kde_neon.py index 05b62c78d2..bb1a8b8484 100644 --- a/snapcraft/extensions/kde_neon.py +++ b/snapcraft/extensions/kde_neon.py @@ -27,12 +27,14 @@ _SDK_SNAP = {"core22": "kde-frameworks-5-102-qt-5-15-8-core22-sd"} + @dataclasses.dataclass class ExtensionInfo: - """ Content/SDK build information""" + """Content/SDK build information""" cmake_args: str + @dataclasses.dataclass class KDESnaps: """A structure of KDE related snaps.""" @@ -85,13 +87,7 @@ def is_experimental(base: Optional[str]) -> bool: def get_app_snippet(self) -> Dict[str, Any]: return { "command-chain": ["snap/command-chain/desktop-launch"], - "plugs": [ - "desktop", - "desktop-legacy", - "opengl", - "wayland", - "x11" - ], + "plugs": ["desktop", "desktop-legacy", "opengl", "wayland", "x11"], } @functools.cached_property @@ -119,7 +115,7 @@ def kde_snaps(self) -> KDESnaps: @functools.cached_property def ext_info(self) -> ExtensionInfo: """Return the extension info cmake_args, provider, content, build_snaps""" - cmake_args=f"-DCMAKE_FIND_ROOT_PATH=/snap/" + self.kde_snaps.sdk + f"/current" + cmake_args = f"-DCMAKE_FIND_ROOT_PATH=/snap/" + self.kde_snaps.sdk + f"/current" return ExtensionInfo(cmake_args=cmake_args) @@ -159,6 +155,7 @@ def get_root_snippet(self) -> Dict[str, Any]: }, "layout": {"/usr/share/X11": {"symlink": "$SNAP/kf5/usr/share/X11"}}, } + @overrides def get_part_snippet(self) -> Dict[str, Any]: sdk_snap = self.kde_snaps.sdk diff --git a/tests/unit/extensions/test_kde_neon.py b/tests/unit/extensions/test_kde_neon.py index 7722a6a16c..c09ed75f01 100644 --- a/tests/unit/extensions/test_kde_neon.py +++ b/tests/unit/extensions/test_kde_neon.py @@ -36,7 +36,13 @@ def kde_neon_extension_with_build_snap(): return kde_neon.KDENeon( yaml_data={ "base": "core22", - "parts": {"part1": {"build-snaps": ["kde-frameworks-5-102-qt-5-15-8-core22-sd/latest/stable"]}}, + "parts": { + "part1": { + "build-snaps": [ + "kde-frameworks-5-102-qt-5-15-8-core22-sd/latest/stable" + ] + } + }, }, arch="amd64", target_arch="amd64", @@ -48,7 +54,13 @@ def kde_neon_extension_with_default_build_snap_from_latest_edge(): return kde_neon.KDENeon( yaml_data={ "base": "core22", - "parts": {"part1": {"build-snaps": ["kde-frameworks-5-102-qt-5-15-8-core22-sd/latest/edge"]}}, + "parts": { + "part1": { + "build-snaps": [ + "kde-frameworks-5-102-qt-5-15-8-core22-sd/latest/edge" + ] + } + }, }, arch="amd64", target_arch="amd64", @@ -75,11 +87,7 @@ def test_is_experimental(): def test_get_app_snippet(kde_neon_extension): assert kde_neon_extension.get_app_snippet() == { "command-chain": ["snap/command-chain/desktop-launch"], - "plugs": ["desktop", - "desktop-legacy", - "opengl", - "wayland", - "x11"], + "plugs": ["desktop", "desktop-legacy", "opengl", "wayland", "x11"], } @@ -88,30 +96,30 @@ def test_get_root_snippet(kde_neon_extension): "assumes": ["snapd2.43"], "environment": {"SNAP_DESKTOP_RUNTIME": "$SNAP/kf5"}, "hooks": { - "configure": { - "plugs": ["desktop"], - "command-chain": ["snap/command-chain/hooks-configure-desktop"], - } + "configure": { + "plugs": ["desktop"], + "command-chain": ["snap/command-chain/hooks-configure-desktop"], + } }, "layout": {"/usr/share/X11": {"symlink": "$SNAP/kf5/usr/share/X11"}}, "plugs": { - "desktop": {"mount-host-font-cache": False}, - "icon-themes": { - "interface": "content", - "target": "$SNAP/data-dir/icons", - "default-provider": "gtk-common-themes", - }, - "sound-themes": { - "interface": "content", - "target": "$SNAP/data-dir/sounds", - "default-provider": "gtk-common-themes", - }, - "kde-frameworks-5-102-qt-5-15-8-core22": { - "content": "kde-frameworks-5-102-qt-5-15-8-core22-all", - "interface": "content", - "default-provider": "kde-frameworks-5-102-qt-5-15-8-core22", - "target": "$SNAP/kf5", - }, + "desktop": {"mount-host-font-cache": False}, + "icon-themes": { + "interface": "content", + "target": "$SNAP/data-dir/icons", + "default-provider": "gtk-common-themes", + }, + "sound-themes": { + "interface": "content", + "target": "$SNAP/data-dir/sounds", + "default-provider": "gtk-common-themes", + }, + "kde-frameworks-5-102-qt-5-15-8-core22": { + "content": "kde-frameworks-5-102-qt-5-15-8-core22-all", + "interface": "content", + "default-provider": "kde-frameworks-5-102-qt-5-15-8-core22", + "target": "$SNAP/kf5", + }, }, } @@ -121,30 +129,30 @@ def test_get_root_snippet_with_external_sdk(kde_neon_extension_with_build_snap): "assumes": ["snapd2.43"], "environment": {"SNAP_DESKTOP_RUNTIME": "$SNAP/kf5"}, "hooks": { - "configure": { - "plugs": ["desktop"], - "command-chain": ["snap/command-chain/hooks-configure-desktop"], - } + "configure": { + "plugs": ["desktop"], + "command-chain": ["snap/command-chain/hooks-configure-desktop"], + } }, "layout": {"/usr/share/X11": {"symlink": "$SNAP/kf5/usr/share/X11"}}, "plugs": { - "desktop": {"mount-host-font-cache": False}, - "icon-themes": { - "interface": "content", - "target": "$SNAP/data-dir/icons", - "default-provider": "gtk-common-themes", - }, - "sound-themes": { - "interface": "content", - "target": "$SNAP/data-dir/sounds", - "default-provider": "gtk-common-themes", - }, - "kde-frameworks-5-102-qt-5-15-8-core22": { - "content": "kde-frameworks-5-102-qt-5-15-8-core22-all", - "interface": "content", - "default-provider": "kde-frameworks-5-102-qt-5-15-8-core22", - "target": "$SNAP/kf5", - }, + "desktop": {"mount-host-font-cache": False}, + "icon-themes": { + "interface": "content", + "target": "$SNAP/data-dir/icons", + "default-provider": "gtk-common-themes", + }, + "sound-themes": { + "interface": "content", + "target": "$SNAP/data-dir/sounds", + "default-provider": "gtk-common-themes", + }, + "kde-frameworks-5-102-qt-5-15-8-core22": { + "content": "kde-frameworks-5-102-qt-5-15-8-core22-all", + "interface": "content", + "default-provider": "kde-frameworks-5-102-qt-5-15-8-core22", + "target": "$SNAP/kf5", + }, }, } @@ -165,10 +173,13 @@ def test_get_part_snippet_latest_edge( @staticmethod def assert_get_part_snippet(kde_neon_instance): assert kde_neon_instance.get_part_snippet() == { - "build-environment": [ + "build-environment": [ { "PATH": prepend_to_env( - "PATH", [f"/snap/kde-frameworks-5-102-qt-5-15-8-core22-sd/current/usr/bin"] + "PATH", + [ + f"/snap/kde-frameworks-5-102-qt-5-15-8-core22-sd/current/usr/bin" + ] ), }, { @@ -232,7 +243,9 @@ def assert_get_part_snippet(kde_neon_instance): { "SNAPCRAFT_CMAKE_ARGS": prepend_to_env( "SNAPCRAFT_CMAKE_ARGS", - ["-DCMAKE_FIND_ROOT_PATH=/snap/kde-frameworks-5-102-qt-5-15-8-core22-sd/current"], + [ + "-DCMAKE_FIND_ROOT_PATH=/snap/kde-frameworks-5-102-qt-5-15-8-core22-sd/current" + ], ), }, ], @@ -242,7 +255,9 @@ def assert_get_part_snippet(kde_neon_instance): def test_get_part_snippet_with_external_sdk(kde_neon_extension_with_build_snap): assert kde_neon_extension_with_build_snap.get_part_snippet() == { "build-environment": [ - {"PATH": "/snap/kde-frameworks-5-102-qt-5-15-8-core22-sd/current/usr/bin${PATH:+:$PATH}"}, + { + "PATH": "/snap/kde-frameworks-5-102-qt-5-15-8-core22-sd/current/usr/bin${PATH:+:$PATH}" + }, { "XDG_DATA_DIRS": ( "$SNAPCRAFT_STAGE/usr/share:/snap/kde-frameworks-5-102-qt-5-15-8-core22-sd" @@ -304,12 +319,12 @@ def test_get_part_snippet_with_external_sdk(kde_neon_extension_with_build_snap): def test_get_parts_snippet(kde_neon_extension): assert kde_neon_extension.get_parts_snippet() == { "kde-neon-extension": { - "source": "$SNAPCRAFT_EXTENSIONS_DIR/desktop", - "source-subdir": "kde-neon", - "plugin": "make", - "make-parameters": ["PLATFORM_PLUG=kde-frameworks-5-102-qt-5-15-8-core22-all"], - "build-packages": ["g++"], - "build-snaps": ["kde-frameworks-5-102-qt-5-15-8-core22-sd"], + "source": "$SNAPCRAFT_EXTENSIONS_DIR/desktop", + "source-subdir": "kde-neon", + "plugin": "make", + "make-parameters": ["PLATFORM_PLUG=kde-frameworks-5-102-qt-5-15-8-core22-all"], + "build-packages": ["g++"], + "build-snaps": ["kde-frameworks-5-102-qt-5-15-8-core22-sd"], } } From ea4fa1b0dca0ef43e39d586708d4a4459f8d6ce4 Mon Sep 17 00:00:00 2001 From: Scarlett Moore Date: Thu, 26 Jan 2023 03:53:58 -0700 Subject: [PATCH 14/50] kde-neon extension test formatting --- tests/unit/extensions/test_kde_neon.py | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/tests/unit/extensions/test_kde_neon.py b/tests/unit/extensions/test_kde_neon.py index c09ed75f01..52e579fc33 100644 --- a/tests/unit/extensions/test_kde_neon.py +++ b/tests/unit/extensions/test_kde_neon.py @@ -179,7 +179,7 @@ def assert_get_part_snippet(kde_neon_instance): "PATH", [ f"/snap/kde-frameworks-5-102-qt-5-15-8-core22-sd/current/usr/bin" - ] + ], ), }, { @@ -322,12 +322,15 @@ def test_get_parts_snippet(kde_neon_extension): "source": "$SNAPCRAFT_EXTENSIONS_DIR/desktop", "source-subdir": "kde-neon", "plugin": "make", - "make-parameters": ["PLATFORM_PLUG=kde-frameworks-5-102-qt-5-15-8-core22-all"], + "make-parameters": [ + "PLATFORM_PLUG=kde-frameworks-5-102-qt-5-15-8-core22-all" + ], "build-packages": ["g++"], "build-snaps": ["kde-frameworks-5-102-qt-5-15-8-core22-sd"], } } + def test_get_parts_snippet_with_external_sdk(kde_neon_extension_with_build_snap): assert kde_neon_extension_with_build_snap.get_parts_snippet() == { "kde-neon-extension": { From e86c36e3b18f300fb5f93fc5f533d24aba5abdcd Mon Sep 17 00:00:00 2001 From: Scarlett Moore Date: Thu, 26 Jan 2023 04:14:01 -0700 Subject: [PATCH 15/50] Remove f-strings, fix build-environment test. --- tests/unit/extensions/test_kde_neon.py | 135 +++++++++++-------------- 1 file changed, 59 insertions(+), 76 deletions(-) diff --git a/tests/unit/extensions/test_kde_neon.py b/tests/unit/extensions/test_kde_neon.py index 52e579fc33..ffa5d3b7ed 100644 --- a/tests/unit/extensions/test_kde_neon.py +++ b/tests/unit/extensions/test_kde_neon.py @@ -174,82 +174,65 @@ def test_get_part_snippet_latest_edge( def assert_get_part_snippet(kde_neon_instance): assert kde_neon_instance.get_part_snippet() == { "build-environment": [ - { - "PATH": prepend_to_env( - "PATH", - [ - f"/snap/kde-frameworks-5-102-qt-5-15-8-core22-sd/current/usr/bin" - ], - ), - }, - { - "XDG_DATA_DIRS": prepend_to_env( - "XDG_DATA_DIRS", - [ - f"$SNAPCRAFT_STAGE/usr/share:/snap/kde-frameworks-5-102-qt-5-15-8-core22-sd/current/usr/share", - "/usr/share", - ], - ), - }, - { - "LD_LIBRARY_PATH": prepend_to_env( - "LD_LIBRARY_PATH", - [ - f"/snap/kde-frameworks-5-102-qt-5-15-8-core22-sd/current/lib/$CRAFT_ARCH_TRIPLET", - f"/snap/kde-frameworks-5-102-qt-5-15-8-core22-sd/current/usr/lib/$CRAFT_ARCH_TRIPLET", - f"/snap/kde-frameworks-5-102-qt-5-15-8-core22-sd/current/usr/lib", - f"/snap/kde-frameworks-5-102-qt-5-15-8-core22-sd/current/usr/lib/vala-current", - f"/snap/kde-frameworks-5-102-qt-5-15-8-core22-sd/current/usr/lib/$CRAFT_ARCH_TRIPLET/pulseaudio", - ], - ), - }, - { - "PKG_CONFIG_PATH": prepend_to_env( - "PKG_CONFIG_PATH", - [ - f"/snap/kde-frameworks-5-102-qt-5-15-8-core22-sd/current/usr/lib/$CRAFT_ARCH_TRIPLET/pkgconfig", - f"/snap/kde-frameworks-5-102-qt-5-15-8-core22-sd/current/usr/lib/pkgconfig", - f"/snap/kde-frameworks-5-102-qt-5-15-8-core22-sd/current/usr/share/pkgconfig", - ], - ), - }, - { - "GETTEXTDATADIRS": prepend_to_env( - "GETTEXTDATADIRS", - [ - f"/snap/kde-frameworks-5-102-qt-5-15-8-core22-sd/current/usr/share/gettext-current", - ], - ), - }, - { - "ACLOCAL_PATH": prepend_to_env( - "ACLOCAL_PATH", - [ - f"/snap/kde-frameworks-5-102-qt-5-15-8-core22-sd/current/usr/share/aclocal", - ], - ), - }, - { - "PYTHONPATH": prepend_to_env( - "PYTHONPATH", - [ - f"/snap/kde-frameworks-5-102-qt-5-15-8-core22-sd/current/usr/lib/python3.10", - f"/snap/kde-frameworks-5-102-qt-5-15-8-core22-sd/current/usr/lib/python3/dist-packages", - f"/snap/kde-frameworks-5-102-qt-5-15-8-core22-sd/current/usr/lib/$CRAFT_ARCH_TRIPLET" - "/gobject-introspection", - ], - ), - }, - { - "SNAPCRAFT_CMAKE_ARGS": prepend_to_env( - "SNAPCRAFT_CMAKE_ARGS", - [ - "-DCMAKE_FIND_ROOT_PATH=/snap/kde-frameworks-5-102-qt-5-15-8-core22-sd/current" - ], - ), - }, - ], - } + { + "PATH": "/snap/kde-frameworks-5-102-qt-5-15-8-core22-sd/current/usr/bin${PATH:+:$PATH}" + }, + { + "XDG_DATA_DIRS": ( + "$SNAPCRAFT_STAGE/usr/share:/snap/kde-frameworks-5-102-qt-5-15-8-core22-sd" + "/current/usr/share:/usr/share${XDG_DATA_DIRS:+:$XDG_DATA_DIRS}" + ) + }, + { + "LD_LIBRARY_PATH": ":".join( + [ + "/snap/kde-frameworks-5-102-qt-5-15-8-core22-sd/current/lib/$CRAFT_ARCH_TRIPLET", + "/snap/kde-frameworks-5-102-qt-5-15-8-core22-sd/current/usr/lib/$CRAFT_ARCH_TRIPLET", + "/snap/kde-frameworks-5-102-qt-5-15-8-core22-sd/current/usr/lib", + "/snap/kde-frameworks-5-102-qt-5-15-8-core22-sd/current/usr/lib/vala-current", + "/snap/kde-frameworks-5-102-qt-5-15-8-core22-sd/current/usr/lib/$CRAFT_ARCH_TRIPLET/pulseaudio", + ] + ) + + "${LD_LIBRARY_PATH:+:$LD_LIBRARY_PATH}" + }, + { + "PKG_CONFIG_PATH": ( + "/snap/kde-frameworks-5-102-qt-5-15-8-core22-sd/current/usr/lib/$CRAFT_ARCH_TRIPLET/pkgconfig:" + "/snap/kde-frameworks-5-102-qt-5-15-8-core22-sd/current/usr/lib/pkgconfig:" + "/snap/kde-frameworks-5-102-qt-5-15-8-core22-sd/current/usr/share/pkgconfig" + "${PKG_CONFIG_PATH:+:$PKG_CONFIG_PATH}" + ) + }, + { + "GETTEXTDATADIRS": ( + "/snap/kde-frameworks-5-102-qt-5-15-8-core22-sd/current/usr/share/gettext-current" + "${GETTEXTDATADIRS:+:$GETTEXTDATADIRS}" + ) + }, + { + "ACLOCAL_PATH": ( + "/snap/kde-frameworks-5-102-qt-5-15-8-core22-sd/current/usr/share/aclocal" + "${ACLOCAL_PATH:+:$ACLOCAL_PATH}" + ) + }, + { + "PYTHONPATH": ":".join( + [ + "/snap/kde-frameworks-5-102-qt-5-15-8-core22-sd/current/usr/lib/python3.10", + "/snap/kde-frameworks-5-102-qt-5-15-8-core22-sd/current/usr/lib/python3/dist-packages", + "/snap/kde-frameworks-5-102-qt-5-15-8-core22-sd/current/usr/lib/$CRAFT_ARCH_TRIPLET" + "/gobject-introspection", + ] + ) + + "${PYTHONPATH:+:$PYTHONPATH}" + }, + { + "SNAPCRAFT_CMAKE_ARGS": ( + "-DCMAKE_FIND_ROOT_PATH=/snap/kde-frameworks-5-102-qt-5-15-8-core22-sd/current" + ) + }, + ] + } def test_get_part_snippet_with_external_sdk(kde_neon_extension_with_build_snap): From 9fa24f189826b2cd6d216fd65820050b669f29f8 Mon Sep 17 00:00:00 2001 From: Scarlett Moore Date: Thu, 26 Jan 2023 05:52:35 -0700 Subject: [PATCH 16/50] Fix formatting kde-neon test. --- tests/unit/extensions/test_kde_neon.py | 118 ++++++++++++------------- 1 file changed, 59 insertions(+), 59 deletions(-) diff --git a/tests/unit/extensions/test_kde_neon.py b/tests/unit/extensions/test_kde_neon.py index ffa5d3b7ed..c5f46dce5d 100644 --- a/tests/unit/extensions/test_kde_neon.py +++ b/tests/unit/extensions/test_kde_neon.py @@ -174,65 +174,65 @@ def test_get_part_snippet_latest_edge( def assert_get_part_snippet(kde_neon_instance): assert kde_neon_instance.get_part_snippet() == { "build-environment": [ - { - "PATH": "/snap/kde-frameworks-5-102-qt-5-15-8-core22-sd/current/usr/bin${PATH:+:$PATH}" - }, - { - "XDG_DATA_DIRS": ( - "$SNAPCRAFT_STAGE/usr/share:/snap/kde-frameworks-5-102-qt-5-15-8-core22-sd" - "/current/usr/share:/usr/share${XDG_DATA_DIRS:+:$XDG_DATA_DIRS}" - ) - }, - { - "LD_LIBRARY_PATH": ":".join( - [ - "/snap/kde-frameworks-5-102-qt-5-15-8-core22-sd/current/lib/$CRAFT_ARCH_TRIPLET", - "/snap/kde-frameworks-5-102-qt-5-15-8-core22-sd/current/usr/lib/$CRAFT_ARCH_TRIPLET", - "/snap/kde-frameworks-5-102-qt-5-15-8-core22-sd/current/usr/lib", - "/snap/kde-frameworks-5-102-qt-5-15-8-core22-sd/current/usr/lib/vala-current", - "/snap/kde-frameworks-5-102-qt-5-15-8-core22-sd/current/usr/lib/$CRAFT_ARCH_TRIPLET/pulseaudio", - ] - ) - + "${LD_LIBRARY_PATH:+:$LD_LIBRARY_PATH}" - }, - { - "PKG_CONFIG_PATH": ( - "/snap/kde-frameworks-5-102-qt-5-15-8-core22-sd/current/usr/lib/$CRAFT_ARCH_TRIPLET/pkgconfig:" - "/snap/kde-frameworks-5-102-qt-5-15-8-core22-sd/current/usr/lib/pkgconfig:" - "/snap/kde-frameworks-5-102-qt-5-15-8-core22-sd/current/usr/share/pkgconfig" - "${PKG_CONFIG_PATH:+:$PKG_CONFIG_PATH}" - ) - }, - { - "GETTEXTDATADIRS": ( - "/snap/kde-frameworks-5-102-qt-5-15-8-core22-sd/current/usr/share/gettext-current" - "${GETTEXTDATADIRS:+:$GETTEXTDATADIRS}" - ) - }, - { - "ACLOCAL_PATH": ( - "/snap/kde-frameworks-5-102-qt-5-15-8-core22-sd/current/usr/share/aclocal" - "${ACLOCAL_PATH:+:$ACLOCAL_PATH}" - ) - }, - { - "PYTHONPATH": ":".join( - [ - "/snap/kde-frameworks-5-102-qt-5-15-8-core22-sd/current/usr/lib/python3.10", - "/snap/kde-frameworks-5-102-qt-5-15-8-core22-sd/current/usr/lib/python3/dist-packages", - "/snap/kde-frameworks-5-102-qt-5-15-8-core22-sd/current/usr/lib/$CRAFT_ARCH_TRIPLET" - "/gobject-introspection", - ] - ) - + "${PYTHONPATH:+:$PYTHONPATH}" - }, - { - "SNAPCRAFT_CMAKE_ARGS": ( - "-DCMAKE_FIND_ROOT_PATH=/snap/kde-frameworks-5-102-qt-5-15-8-core22-sd/current" - ) - }, - ] - } + { + "PATH": "/snap/kde-frameworks-5-102-qt-5-15-8-core22-sd/current/usr/bin${PATH:+:$PATH}" + }, + { + "XDG_DATA_DIRS": ( + "$SNAPCRAFT_STAGE/usr/share:/snap/kde-frameworks-5-102-qt-5-15-8-core22-sd" + "/current/usr/share:/usr/share${XDG_DATA_DIRS:+:$XDG_DATA_DIRS}" + ) + }, + { + "LD_LIBRARY_PATH": ":".join( + [ + "/snap/kde-frameworks-5-102-qt-5-15-8-core22-sd/current/lib/$CRAFT_ARCH_TRIPLET", + "/snap/kde-frameworks-5-102-qt-5-15-8-core22-sd/current/usr/lib/$CRAFT_ARCH_TRIPLET", + "/snap/kde-frameworks-5-102-qt-5-15-8-core22-sd/current/usr/lib", + "/snap/kde-frameworks-5-102-qt-5-15-8-core22-sd/current/usr/lib/vala-current", + "/snap/kde-frameworks-5-102-qt-5-15-8-core22-sd/current/usr/lib/$CRAFT_ARCH_TRIPLET/pulseaudio", + ] + ) + + "${LD_LIBRARY_PATH:+:$LD_LIBRARY_PATH}" + }, + { + "PKG_CONFIG_PATH": ( + "/snap/kde-frameworks-5-102-qt-5-15-8-core22-sd/current/usr/lib/$CRAFT_ARCH_TRIPLET/pkgconfig:" + "/snap/kde-frameworks-5-102-qt-5-15-8-core22-sd/current/usr/lib/pkgconfig:" + "/snap/kde-frameworks-5-102-qt-5-15-8-core22-sd/current/usr/share/pkgconfig" + "${PKG_CONFIG_PATH:+:$PKG_CONFIG_PATH}" + ) + }, + { + "GETTEXTDATADIRS": ( + "/snap/kde-frameworks-5-102-qt-5-15-8-core22-sd/current/usr/share/gettext-current" + "${GETTEXTDATADIRS:+:$GETTEXTDATADIRS}" + ) + }, + { + "ACLOCAL_PATH": ( + "/snap/kde-frameworks-5-102-qt-5-15-8-core22-sd/current/usr/share/aclocal" + "${ACLOCAL_PATH:+:$ACLOCAL_PATH}" + ) + }, + { + "PYTHONPATH": ":".join( + [ + "/snap/kde-frameworks-5-102-qt-5-15-8-core22-sd/current/usr/lib/python3.10", + "/snap/kde-frameworks-5-102-qt-5-15-8-core22-sd/current/usr/lib/python3/dist-packages", + "/snap/kde-frameworks-5-102-qt-5-15-8-core22-sd/current/usr/lib/$CRAFT_ARCH_TRIPLET" + "/gobject-introspection", + ] + ) + + "${PYTHONPATH:+:$PYTHONPATH}" + }, + { + "SNAPCRAFT_CMAKE_ARGS": ( + "-DCMAKE_FIND_ROOT_PATH=/snap/kde-frameworks-5-102-qt-5-15-8-core22-sd/current" + ) + }, + ] + } def test_get_part_snippet_with_external_sdk(kde_neon_extension_with_build_snap): From 3a64f3ae4488f3a1ddc8ea7ea02ca4d9e368e778 Mon Sep 17 00:00:00 2001 From: Scarlett Moore Date: Thu, 26 Jan 2023 11:56:21 -0700 Subject: [PATCH 17/50] Remove f-strings kde-neon ext, sort import block found by ruff. --- snapcraft/extensions/kde_neon.py | 6 +++--- snapcraft/extensions/registry.py | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/snapcraft/extensions/kde_neon.py b/snapcraft/extensions/kde_neon.py index bb1a8b8484..8dc9f268d8 100644 --- a/snapcraft/extensions/kde_neon.py +++ b/snapcraft/extensions/kde_neon.py @@ -115,14 +115,14 @@ def kde_snaps(self) -> KDESnaps: @functools.cached_property def ext_info(self) -> ExtensionInfo: """Return the extension info cmake_args, provider, content, build_snaps""" - cmake_args = f"-DCMAKE_FIND_ROOT_PATH=/snap/" + self.kde_snaps.sdk + f"/current" + cmake_args = "-DCMAKE_FIND_ROOT_PATH=/snap/" + self.kde_snaps.sdk + "/current" return ExtensionInfo(cmake_args=cmake_args) @overrides def get_root_snippet(self) -> Dict[str, Any]: platform_snap = self.kde_snaps.content - content_snap = self.kde_snaps.content + f"-all" + content_snap = self.kde_snaps.content + "-all" return { "assumes": ["snapd2.43"], # for 'snapctl is-connected' @@ -244,7 +244,7 @@ def get_parts_snippet(self) -> Dict[str, Any]: if self.kde_snaps.builtin: base = self.yaml_data["base"] sdk_snap = _SDK_SNAP[base] - provider = self.kde_snaps.content + f"-all" + provider = self.kde_snaps.content + "-all" return { "kde-neon-extension": { "source": str(source), diff --git a/snapcraft/extensions/registry.py b/snapcraft/extensions/registry.py index 7749dd78c6..e6ca9ddf88 100644 --- a/snapcraft/extensions/registry.py +++ b/snapcraft/extensions/registry.py @@ -16,7 +16,7 @@ """Extension registry.""" -from typing import TYPE_CHECKING, Dict, List, Type +from typing import Dict, List, Type, TYPE_CHECKING from snapcraft import errors From f17f73ea8af6c3a2395fe0c09324f82286a08465 Mon Sep 17 00:00:00 2001 From: Scarlett Moore Date: Fri, 27 Jan 2023 10:34:57 -0700 Subject: [PATCH 18/50] Fix from tox -m fix kde-neon-extention test. --- snapcraft/extensions/registry.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/snapcraft/extensions/registry.py b/snapcraft/extensions/registry.py index e6ca9ddf88..77ddb6ebe4 100644 --- a/snapcraft/extensions/registry.py +++ b/snapcraft/extensions/registry.py @@ -16,13 +16,13 @@ """Extension registry.""" -from typing import Dict, List, Type, TYPE_CHECKING +from typing import TYPE_CHECKING, Dict, List, Type from snapcraft import errors from .gnome import GNOME -from .ros2_humble import ROS2HumbleExtension from .kde_neon import KDENeon +from .ros2_humble import ROS2HumbleExtension if TYPE_CHECKING: from .extension import Extension From 5526eac14bc7e5de9353c150f8adef20f5055ce5 Mon Sep 17 00:00:00 2001 From: Scarlett Moore Date: Fri, 27 Jan 2023 11:18:15 -0700 Subject: [PATCH 19/50] Fix pylint line-to-long errors. --- tests/unit/extensions/test_kde_neon.py | 232 ++++++++++++++++--------- 1 file changed, 147 insertions(+), 85 deletions(-) diff --git a/tests/unit/extensions/test_kde_neon.py b/tests/unit/extensions/test_kde_neon.py index c5f46dce5d..2d983f5a47 100644 --- a/tests/unit/extensions/test_kde_neon.py +++ b/tests/unit/extensions/test_kde_neon.py @@ -175,60 +175,91 @@ def assert_get_part_snippet(kde_neon_instance): assert kde_neon_instance.get_part_snippet() == { "build-environment": [ { - "PATH": "/snap/kde-frameworks-5-102-qt-5-15-8-core22-sd/current/usr/bin${PATH:+:$PATH}" + "PATH": ":".join( + [ + "/snap/kde-frameworks-5-102-qt-5-15-8-core22-sd/current/usr/bin", + ] + ) + + "${PATH:+:$PATH}" }, { - "XDG_DATA_DIRS": ( - "$SNAPCRAFT_STAGE/usr/share:/snap/kde-frameworks-5-102-qt-5-15-8-core22-sd" - "/current/usr/share:/usr/share${XDG_DATA_DIRS:+:$XDG_DATA_DIRS}" + "XDG_DATA_DIRS": ":".join( + [ + "$SNAPCRAFT_STAGE/usr/share:" + + "/snap/kde-frameworks-5-102-qt-5-15-8-core22-sd", + "/current/usr/share:/usr/share", + ] ) + + "${XDG_DATA_DIRS:+:$XDG_DATA_DIRS}" }, { "LD_LIBRARY_PATH": ":".join( [ - "/snap/kde-frameworks-5-102-qt-5-15-8-core22-sd/current/lib/$CRAFT_ARCH_TRIPLET", - "/snap/kde-frameworks-5-102-qt-5-15-8-core22-sd/current/usr/lib/$CRAFT_ARCH_TRIPLET", - "/snap/kde-frameworks-5-102-qt-5-15-8-core22-sd/current/usr/lib", - "/snap/kde-frameworks-5-102-qt-5-15-8-core22-sd/current/usr/lib/vala-current", - "/snap/kde-frameworks-5-102-qt-5-15-8-core22-sd/current/usr/lib/$CRAFT_ARCH_TRIPLET/pulseaudio", + "/snap/kde-frameworks-5-102-qt-5-15-8-core22-sd/current/" + + "lib/$CRAFT_ARCH_TRIPLET", + "/snap/kde-frameworks-5-102-qt-5-15-8-core22-sd/current/" + + "usr/lib/$CRAFT_ARCH_TRIPLET", + "/snap/kde-frameworks-5-102-qt-5-15-8-core22-sd/current/" + + "usr/lib", + "/snap/kde-frameworks-5-102-qt-5-15-8-core22-sd/current/" + + "usr/lib/vala-current", + "/snap/kde-frameworks-5-102-qt-5-15-8-core22-sd/current/" + + "usr/lib/$CRAFT_ARCH_TRIPLET/pulseaudio", ] ) + "${LD_LIBRARY_PATH:+:$LD_LIBRARY_PATH}" }, { - "PKG_CONFIG_PATH": ( - "/snap/kde-frameworks-5-102-qt-5-15-8-core22-sd/current/usr/lib/$CRAFT_ARCH_TRIPLET/pkgconfig:" - "/snap/kde-frameworks-5-102-qt-5-15-8-core22-sd/current/usr/lib/pkgconfig:" - "/snap/kde-frameworks-5-102-qt-5-15-8-core22-sd/current/usr/share/pkgconfig" - "${PKG_CONFIG_PATH:+:$PKG_CONFIG_PATH}" + "PKG_CONFIG_PATH": ":".join( + [ + "/snap/kde-frameworks-5-102-qt-5-15-8-core22-sd/current/" + + "usr/lib/$CRAFT_ARCH_TRIPLET/pkgconfig", + "/snap/kde-frameworks-5-102-qt-5-15-8-core22-sd/current/" + + "usr/lib/pkgconfig", + "/snap/kde-frameworks-5-102-qt-5-15-8-core22-sd/current/" + + "usr/share/pkgconfig", + ] ) + + "${PKG_CONFIG_PATH:+:$PKG_CONFIG_PATH}" }, { - "GETTEXTDATADIRS": ( - "/snap/kde-frameworks-5-102-qt-5-15-8-core22-sd/current/usr/share/gettext-current" - "${GETTEXTDATADIRS:+:$GETTEXTDATADIRS}" + "GETTEXTDATADIRS": ":".join( + [ + "/snap/kde-frameworks-5-102-qt-5-15-8-core22-sd/current/" + + "usr/share/gettext-current", + ] ) + + "${GETTEXTDATADIRS:+:$GETTEXTDATADIRS}" }, { - "ACLOCAL_PATH": ( - "/snap/kde-frameworks-5-102-qt-5-15-8-core22-sd/current/usr/share/aclocal" - "${ACLOCAL_PATH:+:$ACLOCAL_PATH}" + "ACLOCAL_PATH": ":".join( + [ + "/snap/kde-frameworks-5-102-qt-5-15-8-core22-sd/current/" + + "usr/share/aclocal", + ] ) + + "${ACLOCAL_PATH:+:$ACLOCAL_PATH}" }, { "PYTHONPATH": ":".join( [ - "/snap/kde-frameworks-5-102-qt-5-15-8-core22-sd/current/usr/lib/python3.10", - "/snap/kde-frameworks-5-102-qt-5-15-8-core22-sd/current/usr/lib/python3/dist-packages", - "/snap/kde-frameworks-5-102-qt-5-15-8-core22-sd/current/usr/lib/$CRAFT_ARCH_TRIPLET" + "/snap/kde-frameworks-5-102-qt-5-15-8-core22-sd/current/" + + "usr/lib/python3.10", + "/snap/kde-frameworks-5-102-qt-5-15-8-core22-sd/current/" + + "usr/lib/python3/dist-packages", + "/snap/kde-frameworks-5-102-qt-5-15-8-core22-sd/current/" + + "usr/lib/$CRAFT_ARCH_TRIPLET", "/gobject-introspection", ] ) + "${PYTHONPATH:+:$PYTHONPATH}" }, { - "SNAPCRAFT_CMAKE_ARGS": ( - "-DCMAKE_FIND_ROOT_PATH=/snap/kde-frameworks-5-102-qt-5-15-8-core22-sd/current" + "SNAPCRAFT_CMAKE_ARGS": ":".join( + [ + "-DCMAKE_FIND_ROOT_PATH=" + + "/snap/kde-frameworks-5-102-qt-5-15-8-core22-sd/current", + ] ) }, ] @@ -237,66 +268,97 @@ def assert_get_part_snippet(kde_neon_instance): def test_get_part_snippet_with_external_sdk(kde_neon_extension_with_build_snap): assert kde_neon_extension_with_build_snap.get_part_snippet() == { - "build-environment": [ - { - "PATH": "/snap/kde-frameworks-5-102-qt-5-15-8-core22-sd/current/usr/bin${PATH:+:$PATH}" - }, - { - "XDG_DATA_DIRS": ( - "$SNAPCRAFT_STAGE/usr/share:/snap/kde-frameworks-5-102-qt-5-15-8-core22-sd" - "/current/usr/share:/usr/share${XDG_DATA_DIRS:+:$XDG_DATA_DIRS}" - ) - }, - { - "LD_LIBRARY_PATH": ":".join( - [ - "/snap/kde-frameworks-5-102-qt-5-15-8-core22-sd/current/lib/$CRAFT_ARCH_TRIPLET", - "/snap/kde-frameworks-5-102-qt-5-15-8-core22-sd/current/usr/lib/$CRAFT_ARCH_TRIPLET", - "/snap/kde-frameworks-5-102-qt-5-15-8-core22-sd/current/usr/lib", - "/snap/kde-frameworks-5-102-qt-5-15-8-core22-sd/current/usr/lib/vala-current", - "/snap/kde-frameworks-5-102-qt-5-15-8-core22-sd/current/usr/lib/$CRAFT_ARCH_TRIPLET/pulseaudio", - ] - ) - + "${LD_LIBRARY_PATH:+:$LD_LIBRARY_PATH}" - }, - { - "PKG_CONFIG_PATH": ( - "/snap/kde-frameworks-5-102-qt-5-15-8-core22-sd/current/usr/lib/$CRAFT_ARCH_TRIPLET/pkgconfig:" - "/snap/kde-frameworks-5-102-qt-5-15-8-core22-sd/current/usr/lib/pkgconfig:" - "/snap/kde-frameworks-5-102-qt-5-15-8-core22-sd/current/usr/share/pkgconfig" - "${PKG_CONFIG_PATH:+:$PKG_CONFIG_PATH}" - ) - }, - { - "GETTEXTDATADIRS": ( - "/snap/kde-frameworks-5-102-qt-5-15-8-core22-sd/current/usr/share/gettext-current" - "${GETTEXTDATADIRS:+:$GETTEXTDATADIRS}" - ) - }, - { - "ACLOCAL_PATH": ( - "/snap/kde-frameworks-5-102-qt-5-15-8-core22-sd/current/usr/share/aclocal" - "${ACLOCAL_PATH:+:$ACLOCAL_PATH}" - ) - }, - { - "PYTHONPATH": ":".join( - [ - "/snap/kde-frameworks-5-102-qt-5-15-8-core22-sd/current/usr/lib/python3.10", - "/snap/kde-frameworks-5-102-qt-5-15-8-core22-sd/current/usr/lib/python3/dist-packages", - "/snap/kde-frameworks-5-102-qt-5-15-8-core22-sd/current/usr/lib/$CRAFT_ARCH_TRIPLET" - "/gobject-introspection", - ] - ) - + "${PYTHONPATH:+:$PYTHONPATH}" - }, - { - "SNAPCRAFT_CMAKE_ARGS": ( - "-DCMAKE_FIND_ROOT_PATH=/snap/kde-frameworks-5-102-qt-5-15-8-core22-sd/current" - ) - }, - ] - } + "build-environment": [ + { + "PATH": ":".join( + [ + "/snap/kde-frameworks-5-102-qt-5-15-8-core22-sd/current/usr/bin", + ] + ) + + "${PATH:+:$PATH}" + }, + { + "XDG_DATA_DIRS": ":".join( + [ + "$SNAPCRAFT_STAGE/usr/share:" + + "/snap/kde-frameworks-5-102-qt-5-15-8-core22-sd", + "/current/usr/share:/usr/share", + ] + ) + + "${XDG_DATA_DIRS:+:$XDG_DATA_DIRS}" + }, + { + "LD_LIBRARY_PATH": ":".join( + [ + "/snap/kde-frameworks-5-102-qt-5-15-8-core22-sd/current/" + + "lib/$CRAFT_ARCH_TRIPLET", + "/snap/kde-frameworks-5-102-qt-5-15-8-core22-sd/current/" + + "usr/lib/$CRAFT_ARCH_TRIPLET", + "/snap/kde-frameworks-5-102-qt-5-15-8-core22-sd/current/" + + "usr/lib", + "/snap/kde-frameworks-5-102-qt-5-15-8-core22-sd/current/" + + "usr/lib/vala-current", + "/snap/kde-frameworks-5-102-qt-5-15-8-core22-sd/current/" + + "usr/lib/$CRAFT_ARCH_TRIPLET/pulseaudio", + ] + ) + + "${LD_LIBRARY_PATH:+:$LD_LIBRARY_PATH}" + }, + { + "PKG_CONFIG_PATH": ":".join( + [ + "/snap/kde-frameworks-5-102-qt-5-15-8-core22-sd/current/" + + "usr/lib/$CRAFT_ARCH_TRIPLET/pkgconfig", + "/snap/kde-frameworks-5-102-qt-5-15-8-core22-sd/current/" + + "usr/lib/pkgconfig", + "/snap/kde-frameworks-5-102-qt-5-15-8-core22-sd/current/" + + "usr/share/pkgconfig", + ] + ) + + "${PKG_CONFIG_PATH:+:$PKG_CONFIG_PATH}" + }, + { + "GETTEXTDATADIRS": ":".join( + [ + "/snap/kde-frameworks-5-102-qt-5-15-8-core22-sd/current/" + + "usr/share/gettext-current", + ] + ) + + "${GETTEXTDATADIRS:+:$GETTEXTDATADIRS}" + }, + { + "ACLOCAL_PATH": ":".join( + [ + "/snap/kde-frameworks-5-102-qt-5-15-8-core22-sd/current/" + + "usr/share/aclocal", + ] + ) + + "${ACLOCAL_PATH:+:$ACLOCAL_PATH}" + }, + { + "PYTHONPATH": ":".join( + [ + "/snap/kde-frameworks-5-102-qt-5-15-8-core22-sd/current/" + + "usr/lib/python3.10", + "/snap/kde-frameworks-5-102-qt-5-15-8-core22-sd/current/" + + "usr/lib/python3/dist-packages", + "/snap/kde-frameworks-5-102-qt-5-15-8-core22-sd/current/" + + "usr/lib/$CRAFT_ARCH_TRIPLET", + "/gobject-introspection", + ] + ) + + "${PYTHONPATH:+:$PYTHONPATH}" + }, + { + "SNAPCRAFT_CMAKE_ARGS": ":".join( + [ + "-DCMAKE_FIND_ROOT_PATH=" + + "/snap/kde-frameworks-5-102-qt-5-15-8-core22-sd/current", + ] + ) + }, + ] + } def test_get_parts_snippet(kde_neon_extension): From 17156afb408bb7d314b8402011dd6d34adaae8bd Mon Sep 17 00:00:00 2001 From: Scarlett Moore Date: Sat, 28 Jan 2023 06:26:49 -0700 Subject: [PATCH 20/50] Fix formatting with black test, kde-neon test. --- tests/unit/extensions/test_kde_neon.py | 182 ++++++++++++------------- 1 file changed, 91 insertions(+), 91 deletions(-) diff --git a/tests/unit/extensions/test_kde_neon.py b/tests/unit/extensions/test_kde_neon.py index 2d983f5a47..bbff6ab311 100644 --- a/tests/unit/extensions/test_kde_neon.py +++ b/tests/unit/extensions/test_kde_neon.py @@ -257,8 +257,8 @@ def assert_get_part_snippet(kde_neon_instance): { "SNAPCRAFT_CMAKE_ARGS": ":".join( [ - "-DCMAKE_FIND_ROOT_PATH=" - + "/snap/kde-frameworks-5-102-qt-5-15-8-core22-sd/current", + "-DCMAKE_FIND_ROOT_PATH=" + + "/snap/kde-frameworks-5-102-qt-5-15-8-core22-sd/current", ] ) }, @@ -268,97 +268,97 @@ def assert_get_part_snippet(kde_neon_instance): def test_get_part_snippet_with_external_sdk(kde_neon_extension_with_build_snap): assert kde_neon_extension_with_build_snap.get_part_snippet() == { - "build-environment": [ - { - "PATH": ":".join( - [ - "/snap/kde-frameworks-5-102-qt-5-15-8-core22-sd/current/usr/bin", - ] - ) - + "${PATH:+:$PATH}" - }, - { - "XDG_DATA_DIRS": ":".join( - [ - "$SNAPCRAFT_STAGE/usr/share:" - + "/snap/kde-frameworks-5-102-qt-5-15-8-core22-sd", - "/current/usr/share:/usr/share", - ] - ) - + "${XDG_DATA_DIRS:+:$XDG_DATA_DIRS}" - }, - { - "LD_LIBRARY_PATH": ":".join( - [ - "/snap/kde-frameworks-5-102-qt-5-15-8-core22-sd/current/" - + "lib/$CRAFT_ARCH_TRIPLET", - "/snap/kde-frameworks-5-102-qt-5-15-8-core22-sd/current/" - + "usr/lib/$CRAFT_ARCH_TRIPLET", - "/snap/kde-frameworks-5-102-qt-5-15-8-core22-sd/current/" - + "usr/lib", - "/snap/kde-frameworks-5-102-qt-5-15-8-core22-sd/current/" - + "usr/lib/vala-current", - "/snap/kde-frameworks-5-102-qt-5-15-8-core22-sd/current/" - + "usr/lib/$CRAFT_ARCH_TRIPLET/pulseaudio", - ] - ) - + "${LD_LIBRARY_PATH:+:$LD_LIBRARY_PATH}" - }, - { - "PKG_CONFIG_PATH": ":".join( - [ - "/snap/kde-frameworks-5-102-qt-5-15-8-core22-sd/current/" - + "usr/lib/$CRAFT_ARCH_TRIPLET/pkgconfig", - "/snap/kde-frameworks-5-102-qt-5-15-8-core22-sd/current/" - + "usr/lib/pkgconfig", - "/snap/kde-frameworks-5-102-qt-5-15-8-core22-sd/current/" - + "usr/share/pkgconfig", - ] - ) - + "${PKG_CONFIG_PATH:+:$PKG_CONFIG_PATH}" - }, - { - "GETTEXTDATADIRS": ":".join( - [ - "/snap/kde-frameworks-5-102-qt-5-15-8-core22-sd/current/" - + "usr/share/gettext-current", - ] - ) - + "${GETTEXTDATADIRS:+:$GETTEXTDATADIRS}" - }, - { - "ACLOCAL_PATH": ":".join( - [ - "/snap/kde-frameworks-5-102-qt-5-15-8-core22-sd/current/" - + "usr/share/aclocal", - ] - ) - + "${ACLOCAL_PATH:+:$ACLOCAL_PATH}" - }, - { - "PYTHONPATH": ":".join( - [ - "/snap/kde-frameworks-5-102-qt-5-15-8-core22-sd/current/" - + "usr/lib/python3.10", - "/snap/kde-frameworks-5-102-qt-5-15-8-core22-sd/current/" - + "usr/lib/python3/dist-packages", - "/snap/kde-frameworks-5-102-qt-5-15-8-core22-sd/current/" - + "usr/lib/$CRAFT_ARCH_TRIPLET", - "/gobject-introspection", - ] - ) - + "${PYTHONPATH:+:$PYTHONPATH}" - }, - { - "SNAPCRAFT_CMAKE_ARGS": ":".join( - [ + "build-environment": [ + { + "PATH": ":".join( + [ + "/snap/kde-frameworks-5-102-qt-5-15-8-core22-sd/current/usr/bin", + ] + ) + + "${PATH:+:$PATH}" + }, + { + "XDG_DATA_DIRS": ":".join( + [ + "$SNAPCRAFT_STAGE/usr/share:" + + "/snap/kde-frameworks-5-102-qt-5-15-8-core22-sd", + "/current/usr/share:/usr/share", + ] + ) + + "${XDG_DATA_DIRS:+:$XDG_DATA_DIRS}" + }, + { + "LD_LIBRARY_PATH": ":".join( + [ + "/snap/kde-frameworks-5-102-qt-5-15-8-core22-sd/current/" + + "lib/$CRAFT_ARCH_TRIPLET", + "/snap/kde-frameworks-5-102-qt-5-15-8-core22-sd/current/" + + "usr/lib/$CRAFT_ARCH_TRIPLET", + "/snap/kde-frameworks-5-102-qt-5-15-8-core22-sd/current/" + + "usr/lib", + "/snap/kde-frameworks-5-102-qt-5-15-8-core22-sd/current/" + + "usr/lib/vala-current", + "/snap/kde-frameworks-5-102-qt-5-15-8-core22-sd/current/" + + "usr/lib/$CRAFT_ARCH_TRIPLET/pulseaudio", + ] + ) + + "${LD_LIBRARY_PATH:+:$LD_LIBRARY_PATH}" + }, + { + "PKG_CONFIG_PATH": ":".join( + [ + "/snap/kde-frameworks-5-102-qt-5-15-8-core22-sd/current/" + + "usr/lib/$CRAFT_ARCH_TRIPLET/pkgconfig", + "/snap/kde-frameworks-5-102-qt-5-15-8-core22-sd/current/" + + "usr/lib/pkgconfig", + "/snap/kde-frameworks-5-102-qt-5-15-8-core22-sd/current/" + + "usr/share/pkgconfig", + ] + ) + + "${PKG_CONFIG_PATH:+:$PKG_CONFIG_PATH}" + }, + { + "GETTEXTDATADIRS": ":".join( + [ + "/snap/kde-frameworks-5-102-qt-5-15-8-core22-sd/current/" + + "usr/share/gettext-current", + ] + ) + + "${GETTEXTDATADIRS:+:$GETTEXTDATADIRS}" + }, + { + "ACLOCAL_PATH": ":".join( + [ + "/snap/kde-frameworks-5-102-qt-5-15-8-core22-sd/current/" + + "usr/share/aclocal", + ] + ) + + "${ACLOCAL_PATH:+:$ACLOCAL_PATH}" + }, + { + "PYTHONPATH": ":".join( + [ + "/snap/kde-frameworks-5-102-qt-5-15-8-core22-sd/current/" + + "usr/lib/python3.10", + "/snap/kde-frameworks-5-102-qt-5-15-8-core22-sd/current/" + + "usr/lib/python3/dist-packages", + "/snap/kde-frameworks-5-102-qt-5-15-8-core22-sd/current/" + + "usr/lib/$CRAFT_ARCH_TRIPLET", + "/gobject-introspection", + ] + ) + + "${PYTHONPATH:+:$PYTHONPATH}" + }, + { + "SNAPCRAFT_CMAKE_ARGS": ":".join( + [ "-DCMAKE_FIND_ROOT_PATH=" + "/snap/kde-frameworks-5-102-qt-5-15-8-core22-sd/current", - ] - ) - }, - ] - } + ] + ) + }, + ] + } def test_get_parts_snippet(kde_neon_extension): From 29dfe657d0a348f5d14115626ea546108205d13b Mon Sep 17 00:00:00 2001 From: Scarlett Moore Date: Sat, 28 Jan 2023 06:42:24 -0700 Subject: [PATCH 21/50] Fix docstring test for kde-neon extension. --- snapcraft/extensions/kde_neon.py | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/snapcraft/extensions/kde_neon.py b/snapcraft/extensions/kde_neon.py index 8dc9f268d8..7fab30b008 100644 --- a/snapcraft/extensions/kde_neon.py +++ b/snapcraft/extensions/kde_neon.py @@ -30,7 +30,7 @@ @dataclasses.dataclass class ExtensionInfo: - """Content/SDK build information""" + """Content/SDK build information.""" cmake_args: str @@ -45,7 +45,7 @@ class KDESnaps: class KDENeon(Extension): - """The KDE Neon extension. + r"""The KDE Neon extension. This extension makes it easy to assemble KDE based applications using the Neon stack. @@ -114,7 +114,8 @@ def kde_snaps(self) -> KDESnaps: @functools.cached_property def ext_info(self) -> ExtensionInfo: - """Return the extension info cmake_args, provider, content, build_snaps""" + """Return the extension info cmake_args, provider, content, build_snaps.""" + cmake_args = "-DCMAKE_FIND_ROOT_PATH=/snap/" + self.kde_snaps.sdk + "/current" return ExtensionInfo(cmake_args=cmake_args) From 1242aaf1dee2eeb97ec1bb0bc9868d355c0a9cfe Mon Sep 17 00:00:00 2001 From: Scarlett Moore Date: Sat, 28 Jan 2023 06:55:50 -0700 Subject: [PATCH 22/50] Remove the extra blank line after docstring, kde-neon ext. --- snapcraft/extensions/kde_neon.py | 1 - 1 file changed, 1 deletion(-) diff --git a/snapcraft/extensions/kde_neon.py b/snapcraft/extensions/kde_neon.py index 7fab30b008..8a46c6e1f0 100644 --- a/snapcraft/extensions/kde_neon.py +++ b/snapcraft/extensions/kde_neon.py @@ -115,7 +115,6 @@ def kde_snaps(self) -> KDESnaps: @functools.cached_property def ext_info(self) -> ExtensionInfo: """Return the extension info cmake_args, provider, content, build_snaps.""" - cmake_args = "-DCMAKE_FIND_ROOT_PATH=/snap/" + self.kde_snaps.sdk + "/current" return ExtensionInfo(cmake_args=cmake_args) From 74fb596a8449a1bfdb8a1ee01ae06be09635e6c8 Mon Sep 17 00:00:00 2001 From: Scarlett Moore Date: Thu, 2 Feb 2023 11:13:53 -0700 Subject: [PATCH 23/50] kde-neon-extension: Fix unit test with missing option commpression: lzo. --- tests/unit/extensions/test_kde_neon.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/tests/unit/extensions/test_kde_neon.py b/tests/unit/extensions/test_kde_neon.py index bbff6ab311..fd6dd2538a 100644 --- a/tests/unit/extensions/test_kde_neon.py +++ b/tests/unit/extensions/test_kde_neon.py @@ -94,6 +94,7 @@ def test_get_app_snippet(kde_neon_extension): def test_get_root_snippet(kde_neon_extension): assert kde_neon_extension.get_root_snippet() == { "assumes": ["snapd2.43"], + "compression": "lzo", "environment": {"SNAP_DESKTOP_RUNTIME": "$SNAP/kf5"}, "hooks": { "configure": { @@ -127,6 +128,7 @@ def test_get_root_snippet(kde_neon_extension): def test_get_root_snippet_with_external_sdk(kde_neon_extension_with_build_snap): assert kde_neon_extension_with_build_snap.get_root_snippet() == { "assumes": ["snapd2.43"], + "compression": "lzo", "environment": {"SNAP_DESKTOP_RUNTIME": "$SNAP/kf5"}, "hooks": { "configure": { From 0f2ba5f3f7da55e21ffb8073a127a4628439d504 Mon Sep 17 00:00:00 2001 From: Scarlett Moore Date: Fri, 3 Feb 2023 08:15:43 -0700 Subject: [PATCH 24/50] kde-neon-extension: further attempt to fix my tests. Correct the build-environment expectation. Correct the registry expectation as legacy and non legacy differs. --- tests/unit/commands/test_list_extensions.py | 4 +- tests/unit/extensions/test_kde_neon.py | 230 +++++++++----------- 2 files changed, 105 insertions(+), 129 deletions(-) diff --git a/tests/unit/commands/test_list_extensions.py b/tests/unit/commands/test_list_extensions.py index 731f5db850..b1889f1fa6 100644 --- a/tests/unit/commands/test_list_extensions.py +++ b/tests/unit/commands/test_list_extensions.py @@ -41,7 +41,7 @@ def test_command(emitter, command): gnome-3-28 core18 gnome-3-34 core18 gnome-3-38 core20 - kde-neon core18, core20, core22 + kde-neon core22 ros1-noetic core20 ros2-foxy core20 ros2-humble core22""" @@ -67,7 +67,7 @@ def test_command_extension_dups(emitter, command): gnome-3-28 core18 gnome-3-34 core18 gnome-3-38 core20 - kde-neon core18, core20, core22 + kde-neon core18, core20 ros1-noetic core20 ros2-foxy core20 ros2-humble core22""" diff --git a/tests/unit/extensions/test_kde_neon.py b/tests/unit/extensions/test_kde_neon.py index fd6dd2538a..d1f95e94ea 100644 --- a/tests/unit/extensions/test_kde_neon.py +++ b/tests/unit/extensions/test_kde_neon.py @@ -176,118 +176,19 @@ def test_get_part_snippet_latest_edge( def assert_get_part_snippet(kde_neon_instance): assert kde_neon_instance.get_part_snippet() == { "build-environment": [ - { - "PATH": ":".join( - [ - "/snap/kde-frameworks-5-102-qt-5-15-8-core22-sd/current/usr/bin", - ] - ) - + "${PATH:+:$PATH}" - }, - { - "XDG_DATA_DIRS": ":".join( - [ - "$SNAPCRAFT_STAGE/usr/share:" - + "/snap/kde-frameworks-5-102-qt-5-15-8-core22-sd", - "/current/usr/share:/usr/share", - ] - ) - + "${XDG_DATA_DIRS:+:$XDG_DATA_DIRS}" - }, - { - "LD_LIBRARY_PATH": ":".join( - [ - "/snap/kde-frameworks-5-102-qt-5-15-8-core22-sd/current/" - + "lib/$CRAFT_ARCH_TRIPLET", - "/snap/kde-frameworks-5-102-qt-5-15-8-core22-sd/current/" - + "usr/lib/$CRAFT_ARCH_TRIPLET", - "/snap/kde-frameworks-5-102-qt-5-15-8-core22-sd/current/" - + "usr/lib", - "/snap/kde-frameworks-5-102-qt-5-15-8-core22-sd/current/" - + "usr/lib/vala-current", - "/snap/kde-frameworks-5-102-qt-5-15-8-core22-sd/current/" - + "usr/lib/$CRAFT_ARCH_TRIPLET/pulseaudio", - ] - ) - + "${LD_LIBRARY_PATH:+:$LD_LIBRARY_PATH}" - }, - { - "PKG_CONFIG_PATH": ":".join( - [ - "/snap/kde-frameworks-5-102-qt-5-15-8-core22-sd/current/" - + "usr/lib/$CRAFT_ARCH_TRIPLET/pkgconfig", - "/snap/kde-frameworks-5-102-qt-5-15-8-core22-sd/current/" - + "usr/lib/pkgconfig", - "/snap/kde-frameworks-5-102-qt-5-15-8-core22-sd/current/" - + "usr/share/pkgconfig", - ] - ) - + "${PKG_CONFIG_PATH:+:$PKG_CONFIG_PATH}" - }, - { - "GETTEXTDATADIRS": ":".join( - [ - "/snap/kde-frameworks-5-102-qt-5-15-8-core22-sd/current/" - + "usr/share/gettext-current", - ] - ) - + "${GETTEXTDATADIRS:+:$GETTEXTDATADIRS}" - }, - { - "ACLOCAL_PATH": ":".join( - [ - "/snap/kde-frameworks-5-102-qt-5-15-8-core22-sd/current/" - + "usr/share/aclocal", - ] - ) - + "${ACLOCAL_PATH:+:$ACLOCAL_PATH}" - }, - { - "PYTHONPATH": ":".join( - [ - "/snap/kde-frameworks-5-102-qt-5-15-8-core22-sd/current/" - + "usr/lib/python3.10", - "/snap/kde-frameworks-5-102-qt-5-15-8-core22-sd/current/" - + "usr/lib/python3/dist-packages", - "/snap/kde-frameworks-5-102-qt-5-15-8-core22-sd/current/" - + "usr/lib/$CRAFT_ARCH_TRIPLET", - "/gobject-introspection", - ] - ) - + "${PYTHONPATH:+:$PYTHONPATH}" - }, - { - "SNAPCRAFT_CMAKE_ARGS": ":".join( - [ - "-DCMAKE_FIND_ROOT_PATH=" - + "/snap/kde-frameworks-5-102-qt-5-15-8-core22-sd/current", - ] - ) - }, - ] - } - - -def test_get_part_snippet_with_external_sdk(kde_neon_extension_with_build_snap): - assert kde_neon_extension_with_build_snap.get_part_snippet() == { - "build-environment": [ { - "PATH": ":".join( - [ - "/snap/kde-frameworks-5-102-qt-5-15-8-core22-sd/current/usr/bin", - ] + "PATH": ( + "/snap/kde-frameworks-5-102-qt-5-15-8-core22-sd/current/usr/bin" + + "${PATH:+:$PATH}" ) - + "${PATH:+:$PATH}" + }, { - "XDG_DATA_DIRS": ":".join( - [ - "$SNAPCRAFT_STAGE/usr/share:" - + "/snap/kde-frameworks-5-102-qt-5-15-8-core22-sd", - "/current/usr/share:/usr/share", - ] + "XDG_DATA_DIRS": ( + "$SNAPCRAFT_STAGE/usr/share:" + + "/snap/kde-frameworks-5-102-qt-5-15-8-core22-sd" + "/current/usr/share:/usr/share${XDG_DATA_DIRS:+:$XDG_DATA_DIRS}" ) - + "${XDG_DATA_DIRS:+:$XDG_DATA_DIRS}" }, { "LD_LIBRARY_PATH": ":".join( @@ -307,35 +208,112 @@ def test_get_part_snippet_with_external_sdk(kde_neon_extension_with_build_snap): + "${LD_LIBRARY_PATH:+:$LD_LIBRARY_PATH}" }, { - "PKG_CONFIG_PATH": ":".join( + "PKG_CONFIG_PATH": ( + "/snap/kde-frameworks-5-102-qt-5-15-8-core22-sd/current/" + + "usr/lib/$CRAFT_ARCH_TRIPLET/pkgconfig:" + "/snap/kde-frameworks-5-102-qt-5-15-8-core22-sd/current/" + + "usr/lib/pkgconfig:" + "/snap/kde-frameworks-5-102-qt-5-15-8-core22-sd/current/" + + "usr/share/pkgconfig" + "${PKG_CONFIG_PATH:+:$PKG_CONFIG_PATH}" + ) + }, + { + "GETTEXTDATADIRS": ( + "/snap/kde-frameworks-5-102-qt-5-15-8-core22-sd/current/" + + "usr/share/gettext-current" + "${GETTEXTDATADIRS:+:$GETTEXTDATADIRS}" + ) + }, + { + "ACLOCAL_PATH": ( + "/snap/kde-frameworks-5-102-qt-5-15-8-core22-sd/current/" + + "usr/share/aclocal" + "${ACLOCAL_PATH:+:$ACLOCAL_PATH}" + ) + }, + { + "PYTHONPATH": ":".join( [ "/snap/kde-frameworks-5-102-qt-5-15-8-core22-sd/current/" - + "usr/lib/$CRAFT_ARCH_TRIPLET/pkgconfig", + + "usr/lib/python3.10", "/snap/kde-frameworks-5-102-qt-5-15-8-core22-sd/current/" - + "usr/lib/pkgconfig", + + "usr/lib/python3/dist-packages", "/snap/kde-frameworks-5-102-qt-5-15-8-core22-sd/current/" - + "usr/share/pkgconfig", + + "usr/lib/$CRAFT_ARCH_TRIPLET", + "/gobject-introspection", ] ) - + "${PKG_CONFIG_PATH:+:$PKG_CONFIG_PATH}" + + "${PYTHONPATH:+:$PYTHONPATH}" }, { - "GETTEXTDATADIRS": ":".join( - [ - "/snap/kde-frameworks-5-102-qt-5-15-8-core22-sd/current/" - + "usr/share/gettext-current", - ] + "SNAPCRAFT_CMAKE_ARGS": ( + "-DCMAKE_FIND_ROOT_PATH=" + + "/snap/kde-frameworks-5-102-qt-5-15-8-core22-sd/current" + ) + }, + ] + } + + +def test_get_part_snippet_with_external_sdk(kde_neon_extension_with_build_snap): + assert kde_neon_extension_with_build_snap.get_part_snippet() == { + "build-environment": [ + { + "PATH": ( + "/snap/kde-frameworks-5-102-qt-5-15-8-core22-sd/current/usr/bin" + + "${PATH:+:$PATH}" + ) + + }, + { + "XDG_DATA_DIRS": ( + "$SNAPCRAFT_STAGE/usr/share:" + + "/snap/kde-frameworks-5-102-qt-5-15-8-core22-sd" + "/current/usr/share:/usr/share${XDG_DATA_DIRS:+:$XDG_DATA_DIRS}" ) - + "${GETTEXTDATADIRS:+:$GETTEXTDATADIRS}" }, { - "ACLOCAL_PATH": ":".join( + "LD_LIBRARY_PATH": ":".join( [ "/snap/kde-frameworks-5-102-qt-5-15-8-core22-sd/current/" - + "usr/share/aclocal", + + "lib/$CRAFT_ARCH_TRIPLET", + "/snap/kde-frameworks-5-102-qt-5-15-8-core22-sd/current/" + + "usr/lib/$CRAFT_ARCH_TRIPLET", + "/snap/kde-frameworks-5-102-qt-5-15-8-core22-sd/current/" + + "usr/lib", + "/snap/kde-frameworks-5-102-qt-5-15-8-core22-sd/current/" + + "usr/lib/vala-current", + "/snap/kde-frameworks-5-102-qt-5-15-8-core22-sd/current/" + + "usr/lib/$CRAFT_ARCH_TRIPLET/pulseaudio", ] ) - + "${ACLOCAL_PATH:+:$ACLOCAL_PATH}" + + "${LD_LIBRARY_PATH:+:$LD_LIBRARY_PATH}" + }, + { + "PKG_CONFIG_PATH": ( + "/snap/kde-frameworks-5-102-qt-5-15-8-core22-sd/current/" + + "usr/lib/$CRAFT_ARCH_TRIPLET/pkgconfig:" + "/snap/kde-frameworks-5-102-qt-5-15-8-core22-sd/current/" + + "usr/lib/pkgconfig:" + "/snap/kde-frameworks-5-102-qt-5-15-8-core22-sd/current/" + + "usr/share/pkgconfig" + "${PKG_CONFIG_PATH:+:$PKG_CONFIG_PATH}" + ) + }, + { + "GETTEXTDATADIRS": ( + "/snap/kde-frameworks-5-102-qt-5-15-8-core22-sd/current/" + + "usr/share/gettext-current" + "${GETTEXTDATADIRS:+:$GETTEXTDATADIRS}" + ) + }, + { + "ACLOCAL_PATH": ( + "/snap/kde-frameworks-5-102-qt-5-15-8-core22-sd/current/" + + "usr/share/aclocal" + "${ACLOCAL_PATH:+:$ACLOCAL_PATH}" + ) }, { "PYTHONPATH": ":".join( @@ -352,11 +330,9 @@ def test_get_part_snippet_with_external_sdk(kde_neon_extension_with_build_snap): + "${PYTHONPATH:+:$PYTHONPATH}" }, { - "SNAPCRAFT_CMAKE_ARGS": ":".join( - [ - "-DCMAKE_FIND_ROOT_PATH=" - + "/snap/kde-frameworks-5-102-qt-5-15-8-core22-sd/current", - ] + "SNAPCRAFT_CMAKE_ARGS": ( + "-DCMAKE_FIND_ROOT_PATH=" + + "/snap/kde-frameworks-5-102-qt-5-15-8-core22-sd/current" ) }, ] @@ -366,7 +342,7 @@ def test_get_part_snippet_with_external_sdk(kde_neon_extension_with_build_snap): def test_get_parts_snippet(kde_neon_extension): assert kde_neon_extension.get_parts_snippet() == { "kde-neon-extension": { - "source": "$SNAPCRAFT_EXTENSIONS_DIR/desktop", + "source": get_extensions_data_dir() / "desktop" / "command-chain", "source-subdir": "kde-neon", "plugin": "make", "make-parameters": [ From 481e25f0a8901eefbc91752bcddd9004bf876b5a Mon Sep 17 00:00:00 2001 From: Scarlett Moore Date: Fri, 3 Feb 2023 09:07:55 -0700 Subject: [PATCH 25/50] kde-neon-extension: At some point I will get used to python formatting. Fix formatting for black linter kde-neon-extension. --- tests/unit/extensions/test_kde_neon.py | 294 ++++++++++++------------- 1 file changed, 147 insertions(+), 147 deletions(-) diff --git a/tests/unit/extensions/test_kde_neon.py b/tests/unit/extensions/test_kde_neon.py index d1f95e94ea..fc924df17b 100644 --- a/tests/unit/extensions/test_kde_neon.py +++ b/tests/unit/extensions/test_kde_neon.py @@ -176,167 +176,167 @@ def test_get_part_snippet_latest_edge( def assert_get_part_snippet(kde_neon_instance): assert kde_neon_instance.get_part_snippet() == { "build-environment": [ - { - "PATH": ( - "/snap/kde-frameworks-5-102-qt-5-15-8-core22-sd/current/usr/bin" - + "${PATH:+:$PATH}" - ) - - }, - { - "XDG_DATA_DIRS": ( - "$SNAPCRAFT_STAGE/usr/share:" - + "/snap/kde-frameworks-5-102-qt-5-15-8-core22-sd" - "/current/usr/share:/usr/share${XDG_DATA_DIRS:+:$XDG_DATA_DIRS}" - ) - }, - { - "LD_LIBRARY_PATH": ":".join( - [ + { + "PATH": ( + "/snap/kde-frameworks-5-102-qt-5-15-8-core22-sd/current/usr/bin" + + "${PATH:+:$PATH}" + ) + + }, + { + "XDG_DATA_DIRS": ( + "$SNAPCRAFT_STAGE/usr/share:" + + "/snap/kde-frameworks-5-102-qt-5-15-8-core22-sd" + "/current/usr/share:/usr/share${XDG_DATA_DIRS:+:$XDG_DATA_DIRS}" + ) + }, + { + "LD_LIBRARY_PATH": ":".join( + [ + "/snap/kde-frameworks-5-102-qt-5-15-8-core22-sd/current/" + + "lib/$CRAFT_ARCH_TRIPLET", + "/snap/kde-frameworks-5-102-qt-5-15-8-core22-sd/current/" + + "usr/lib/$CRAFT_ARCH_TRIPLET", + "/snap/kde-frameworks-5-102-qt-5-15-8-core22-sd/current/" + + "usr/lib", + "/snap/kde-frameworks-5-102-qt-5-15-8-core22-sd/current/" + + "usr/lib/vala-current", + "/snap/kde-frameworks-5-102-qt-5-15-8-core22-sd/current/" + + "usr/lib/$CRAFT_ARCH_TRIPLET/pulseaudio", + ] + ) + + "${LD_LIBRARY_PATH:+:$LD_LIBRARY_PATH}" + }, + { + "PKG_CONFIG_PATH": ( "/snap/kde-frameworks-5-102-qt-5-15-8-core22-sd/current/" - + "lib/$CRAFT_ARCH_TRIPLET", + + "usr/lib/$CRAFT_ARCH_TRIPLET/pkgconfig:" "/snap/kde-frameworks-5-102-qt-5-15-8-core22-sd/current/" - + "usr/lib/$CRAFT_ARCH_TRIPLET", + + "usr/lib/pkgconfig:" "/snap/kde-frameworks-5-102-qt-5-15-8-core22-sd/current/" - + "usr/lib", + + "usr/share/pkgconfig" + "${PKG_CONFIG_PATH:+:$PKG_CONFIG_PATH}" + ) + }, + { + "GETTEXTDATADIRS": ( "/snap/kde-frameworks-5-102-qt-5-15-8-core22-sd/current/" - + "usr/lib/vala-current", - "/snap/kde-frameworks-5-102-qt-5-15-8-core22-sd/current/" - + "usr/lib/$CRAFT_ARCH_TRIPLET/pulseaudio", - ] - ) - + "${LD_LIBRARY_PATH:+:$LD_LIBRARY_PATH}" - }, - { - "PKG_CONFIG_PATH": ( - "/snap/kde-frameworks-5-102-qt-5-15-8-core22-sd/current/" - + "usr/lib/$CRAFT_ARCH_TRIPLET/pkgconfig:" - "/snap/kde-frameworks-5-102-qt-5-15-8-core22-sd/current/" - + "usr/lib/pkgconfig:" - "/snap/kde-frameworks-5-102-qt-5-15-8-core22-sd/current/" - + "usr/share/pkgconfig" - "${PKG_CONFIG_PATH:+:$PKG_CONFIG_PATH}" - ) - }, - { - "GETTEXTDATADIRS": ( - "/snap/kde-frameworks-5-102-qt-5-15-8-core22-sd/current/" - + "usr/share/gettext-current" - "${GETTEXTDATADIRS:+:$GETTEXTDATADIRS}" - ) - }, - { - "ACLOCAL_PATH": ( - "/snap/kde-frameworks-5-102-qt-5-15-8-core22-sd/current/" - + "usr/share/aclocal" - "${ACLOCAL_PATH:+:$ACLOCAL_PATH}" - ) - }, - { - "PYTHONPATH": ":".join( - [ + + "usr/share/gettext-current" + "${GETTEXTDATADIRS:+:$GETTEXTDATADIRS}" + ) + }, + { + "ACLOCAL_PATH": ( "/snap/kde-frameworks-5-102-qt-5-15-8-core22-sd/current/" - + "usr/lib/python3.10", - "/snap/kde-frameworks-5-102-qt-5-15-8-core22-sd/current/" - + "usr/lib/python3/dist-packages", - "/snap/kde-frameworks-5-102-qt-5-15-8-core22-sd/current/" - + "usr/lib/$CRAFT_ARCH_TRIPLET", - "/gobject-introspection", - ] - ) - + "${PYTHONPATH:+:$PYTHONPATH}" - }, - { - "SNAPCRAFT_CMAKE_ARGS": ( - "-DCMAKE_FIND_ROOT_PATH=" - + "/snap/kde-frameworks-5-102-qt-5-15-8-core22-sd/current" - ) - }, - ] - } + + "usr/share/aclocal" + "${ACLOCAL_PATH:+:$ACLOCAL_PATH}" + ) + }, + { + "PYTHONPATH": ":".join( + [ + "/snap/kde-frameworks-5-102-qt-5-15-8-core22-sd/current/" + + "usr/lib/python3.10", + "/snap/kde-frameworks-5-102-qt-5-15-8-core22-sd/current/" + + "usr/lib/python3/dist-packages", + "/snap/kde-frameworks-5-102-qt-5-15-8-core22-sd/current/" + + "usr/lib/$CRAFT_ARCH_TRIPLET", + "/gobject-introspection", + ] + ) + + "${PYTHONPATH:+:$PYTHONPATH}" + }, + { + "SNAPCRAFT_CMAKE_ARGS": ( + "-DCMAKE_FIND_ROOT_PATH=" + + "/snap/kde-frameworks-5-102-qt-5-15-8-core22-sd/current" + ) + }, + ] + } def test_get_part_snippet_with_external_sdk(kde_neon_extension_with_build_snap): assert kde_neon_extension_with_build_snap.get_part_snippet() == { - "build-environment": [ - { - "PATH": ( - "/snap/kde-frameworks-5-102-qt-5-15-8-core22-sd/current/usr/bin" - + "${PATH:+:$PATH}" - ) - - }, - { - "XDG_DATA_DIRS": ( - "$SNAPCRAFT_STAGE/usr/share:" - + "/snap/kde-frameworks-5-102-qt-5-15-8-core22-sd" - "/current/usr/share:/usr/share${XDG_DATA_DIRS:+:$XDG_DATA_DIRS}" - ) - }, - { - "LD_LIBRARY_PATH": ":".join( - [ - "/snap/kde-frameworks-5-102-qt-5-15-8-core22-sd/current/" - + "lib/$CRAFT_ARCH_TRIPLET", - "/snap/kde-frameworks-5-102-qt-5-15-8-core22-sd/current/" - + "usr/lib/$CRAFT_ARCH_TRIPLET", - "/snap/kde-frameworks-5-102-qt-5-15-8-core22-sd/current/" - + "usr/lib", + "build-environment": [ + { + "PATH": ( + "/snap/kde-frameworks-5-102-qt-5-15-8-core22-sd/current/usr/bin" + + "${PATH:+:$PATH}" + ) + + }, + { + "XDG_DATA_DIRS": ( + "$SNAPCRAFT_STAGE/usr/share:" + + "/snap/kde-frameworks-5-102-qt-5-15-8-core22-sd" + "/current/usr/share:/usr/share${XDG_DATA_DIRS:+:$XDG_DATA_DIRS}" + ) + }, + { + "LD_LIBRARY_PATH": ":".join( + [ + "/snap/kde-frameworks-5-102-qt-5-15-8-core22-sd/current/" + + "lib/$CRAFT_ARCH_TRIPLET", + "/snap/kde-frameworks-5-102-qt-5-15-8-core22-sd/current/" + + "usr/lib/$CRAFT_ARCH_TRIPLET", + "/snap/kde-frameworks-5-102-qt-5-15-8-core22-sd/current/" + + "usr/lib", + "/snap/kde-frameworks-5-102-qt-5-15-8-core22-sd/current/" + + "usr/lib/vala-current", + "/snap/kde-frameworks-5-102-qt-5-15-8-core22-sd/current/" + + "usr/lib/$CRAFT_ARCH_TRIPLET/pulseaudio", + ] + ) + + "${LD_LIBRARY_PATH:+:$LD_LIBRARY_PATH}" + }, + { + "PKG_CONFIG_PATH": ( "/snap/kde-frameworks-5-102-qt-5-15-8-core22-sd/current/" - + "usr/lib/vala-current", + + "usr/lib/$CRAFT_ARCH_TRIPLET/pkgconfig:" "/snap/kde-frameworks-5-102-qt-5-15-8-core22-sd/current/" - + "usr/lib/$CRAFT_ARCH_TRIPLET/pulseaudio", - ] - ) - + "${LD_LIBRARY_PATH:+:$LD_LIBRARY_PATH}" - }, - { - "PKG_CONFIG_PATH": ( - "/snap/kde-frameworks-5-102-qt-5-15-8-core22-sd/current/" - + "usr/lib/$CRAFT_ARCH_TRIPLET/pkgconfig:" - "/snap/kde-frameworks-5-102-qt-5-15-8-core22-sd/current/" - + "usr/lib/pkgconfig:" - "/snap/kde-frameworks-5-102-qt-5-15-8-core22-sd/current/" - + "usr/share/pkgconfig" - "${PKG_CONFIG_PATH:+:$PKG_CONFIG_PATH}" - ) - }, - { - "GETTEXTDATADIRS": ( - "/snap/kde-frameworks-5-102-qt-5-15-8-core22-sd/current/" - + "usr/share/gettext-current" - "${GETTEXTDATADIRS:+:$GETTEXTDATADIRS}" - ) - }, - { - "ACLOCAL_PATH": ( - "/snap/kde-frameworks-5-102-qt-5-15-8-core22-sd/current/" - + "usr/share/aclocal" - "${ACLOCAL_PATH:+:$ACLOCAL_PATH}" - ) - }, - { - "PYTHONPATH": ":".join( - [ + + "usr/lib/pkgconfig:" "/snap/kde-frameworks-5-102-qt-5-15-8-core22-sd/current/" - + "usr/lib/python3.10", + + "usr/share/pkgconfig" + "${PKG_CONFIG_PATH:+:$PKG_CONFIG_PATH}" + ) + }, + { + "GETTEXTDATADIRS": ( "/snap/kde-frameworks-5-102-qt-5-15-8-core22-sd/current/" - + "usr/lib/python3/dist-packages", + + "usr/share/gettext-current" + "${GETTEXTDATADIRS:+:$GETTEXTDATADIRS}" + ) + }, + { + "ACLOCAL_PATH": ( "/snap/kde-frameworks-5-102-qt-5-15-8-core22-sd/current/" - + "usr/lib/$CRAFT_ARCH_TRIPLET", - "/gobject-introspection", - ] - ) - + "${PYTHONPATH:+:$PYTHONPATH}" - }, - { - "SNAPCRAFT_CMAKE_ARGS": ( - "-DCMAKE_FIND_ROOT_PATH=" - + "/snap/kde-frameworks-5-102-qt-5-15-8-core22-sd/current" - ) - }, - ] - } + + "usr/share/aclocal" + "${ACLOCAL_PATH:+:$ACLOCAL_PATH}" + ) + }, + { + "PYTHONPATH": ":".join( + [ + "/snap/kde-frameworks-5-102-qt-5-15-8-core22-sd/current/" + + "usr/lib/python3.10", + "/snap/kde-frameworks-5-102-qt-5-15-8-core22-sd/current/" + + "usr/lib/python3/dist-packages", + "/snap/kde-frameworks-5-102-qt-5-15-8-core22-sd/current/" + + "usr/lib/$CRAFT_ARCH_TRIPLET", + "/gobject-introspection", + ] + ) + + "${PYTHONPATH:+:$PYTHONPATH}" + }, + { + "SNAPCRAFT_CMAKE_ARGS": ( + "-DCMAKE_FIND_ROOT_PATH=" + + "/snap/kde-frameworks-5-102-qt-5-15-8-core22-sd/current" + ) + }, + ] + } def test_get_parts_snippet(kde_neon_extension): From 17a632bc554e66df3dad35eb1fd622ba7d5e8086 Mon Sep 17 00:00:00 2001 From: Scarlett Moore Date: Fri, 3 Feb 2023 09:18:12 -0700 Subject: [PATCH 26/50] kde-neon-extension: Fix Extension has invalid part names by add /sdk. --- snapcraft/extensions/kde_neon.py | 4 ++-- tests/unit/extensions/test_kde_neon.py | 6 +++--- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/snapcraft/extensions/kde_neon.py b/snapcraft/extensions/kde_neon.py index 8a46c6e1f0..e89de741ba 100644 --- a/snapcraft/extensions/kde_neon.py +++ b/snapcraft/extensions/kde_neon.py @@ -246,7 +246,7 @@ def get_parts_snippet(self) -> Dict[str, Any]: sdk_snap = _SDK_SNAP[base] provider = self.kde_snaps.content + "-all" return { - "kde-neon-extension": { + "kde-neon-extension/sdk": { "source": str(source), "source-subdir": "kde-neon", "plugin": "make", @@ -257,7 +257,7 @@ def get_parts_snippet(self) -> Dict[str, Any]: } return { - "kde-neon-extension": { + "kde-neon-extension/sdk": { "source": str(source), "plugin": "make", } diff --git a/tests/unit/extensions/test_kde_neon.py b/tests/unit/extensions/test_kde_neon.py index fc924df17b..2d6455ed44 100644 --- a/tests/unit/extensions/test_kde_neon.py +++ b/tests/unit/extensions/test_kde_neon.py @@ -341,7 +341,7 @@ def test_get_part_snippet_with_external_sdk(kde_neon_extension_with_build_snap): def test_get_parts_snippet(kde_neon_extension): assert kde_neon_extension.get_parts_snippet() == { - "kde-neon-extension": { + "kde-neon-extension/sdk": { "source": get_extensions_data_dir() / "desktop" / "command-chain", "source-subdir": "kde-neon", "plugin": "make", @@ -356,7 +356,7 @@ def test_get_parts_snippet(kde_neon_extension): def test_get_parts_snippet_with_external_sdk(kde_neon_extension_with_build_snap): assert kde_neon_extension_with_build_snap.get_parts_snippet() == { - "kde-neon-extension": { + "kde-neon-extension/sdk": { "source": str(get_extensions_data_dir() / "desktop" / "command-chain"), "plugin": "make", } @@ -369,7 +369,7 @@ def test_get_parts_snippet_with_external_sdk_different_channel( assert ( kde_neon_extension_with_default_build_snap_from_latest_edge.get_parts_snippet() == { - "kde_neon-extension": { + "kde_neon-extension/sdk": { "source": str(get_extensions_data_dir() / "desktop" / "command-chain"), "plugin": "make", } From 6feb7a74e11ad9e99e046452baf4d999e1b22917 Mon Sep 17 00:00:00 2001 From: Scarlett Moore Date: Fri, 3 Feb 2023 10:02:10 -0700 Subject: [PATCH 27/50] kde-neon-extension: fix formatting again.. :( kde-neon test. --- tests/unit/extensions/test_kde_neon.py | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/tests/unit/extensions/test_kde_neon.py b/tests/unit/extensions/test_kde_neon.py index 2d6455ed44..7906ebab9e 100644 --- a/tests/unit/extensions/test_kde_neon.py +++ b/tests/unit/extensions/test_kde_neon.py @@ -181,7 +181,6 @@ def assert_get_part_snippet(kde_neon_instance): "/snap/kde-frameworks-5-102-qt-5-15-8-core22-sd/current/usr/bin" + "${PATH:+:$PATH}" ) - }, { "XDG_DATA_DIRS": ( @@ -256,15 +255,14 @@ def assert_get_part_snippet(kde_neon_instance): } -def test_get_part_snippet_with_external_sdk(kde_neon_extension_with_build_snap): - assert kde_neon_extension_with_build_snap.get_part_snippet() == { + def test_get_part_snippet_with_external_sdk(kde_neon_extension_with_build_snap): + assert kde_neon_extension_with_build_snap.get_part_snippet() == { "build-environment": [ { "PATH": ( "/snap/kde-frameworks-5-102-qt-5-15-8-core22-sd/current/usr/bin" + "${PATH:+:$PATH}" ) - }, { "XDG_DATA_DIRS": ( From 1e8fca4b7f0373e3c6f6519f104c98352a462c91 Mon Sep 17 00:00:00 2001 From: Scarlett Moore Date: Fri, 3 Feb 2023 10:32:39 -0700 Subject: [PATCH 28/50] kde-neon-extension: spread-test still using core20 snap, update connect to make it happy. --- tests/spread/extensions/kde-neon/task.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/spread/extensions/kde-neon/task.yaml b/tests/spread/extensions/kde-neon/task.yaml index 8e1a42e230..e7b2244ea5 100644 --- a/tests/spread/extensions/kde-neon/task.yaml +++ b/tests/spread/extensions/kde-neon/task.yaml @@ -37,7 +37,7 @@ execute: | cd "$SNAP_DIR" output="$(snapcraft)" snap install neon-hello_*.snap --dangerous - snap connect neon-hello:kde-frameworks-5-102-qt-5-15-8-core22 kde-frameworks-5-102-qt-5-15-8-core22 + snap connect neon-hello:kde-frameworks-5-99-qt-5-15-7-core20 kde-frameworks-5-99-qt-5-15-7-core20 [ "$(neon-hello)" = "hello world" ] From 2e9276cf330d25b32e25e9c654946efcfd891d83 Mon Sep 17 00:00:00 2001 From: Scarlett Moore Date: Fri, 3 Feb 2023 10:56:26 -0700 Subject: [PATCH 29/50] kde-neon-extension: kde-neon test formatting again. --- tests/unit/extensions/test_kde_neon.py | 150 ++++++++++++------------- 1 file changed, 75 insertions(+), 75 deletions(-) diff --git a/tests/unit/extensions/test_kde_neon.py b/tests/unit/extensions/test_kde_neon.py index 7906ebab9e..075a3e6a1f 100644 --- a/tests/unit/extensions/test_kde_neon.py +++ b/tests/unit/extensions/test_kde_neon.py @@ -255,86 +255,86 @@ def assert_get_part_snippet(kde_neon_instance): } - def test_get_part_snippet_with_external_sdk(kde_neon_extension_with_build_snap): - assert kde_neon_extension_with_build_snap.get_part_snippet() == { - "build-environment": [ - { - "PATH": ( - "/snap/kde-frameworks-5-102-qt-5-15-8-core22-sd/current/usr/bin" - + "${PATH:+:$PATH}" - ) - }, - { - "XDG_DATA_DIRS": ( - "$SNAPCRAFT_STAGE/usr/share:" - + "/snap/kde-frameworks-5-102-qt-5-15-8-core22-sd" - "/current/usr/share:/usr/share${XDG_DATA_DIRS:+:$XDG_DATA_DIRS}" - ) - }, - { - "LD_LIBRARY_PATH": ":".join( - [ - "/snap/kde-frameworks-5-102-qt-5-15-8-core22-sd/current/" - + "lib/$CRAFT_ARCH_TRIPLET", - "/snap/kde-frameworks-5-102-qt-5-15-8-core22-sd/current/" - + "usr/lib/$CRAFT_ARCH_TRIPLET", - "/snap/kde-frameworks-5-102-qt-5-15-8-core22-sd/current/" - + "usr/lib", - "/snap/kde-frameworks-5-102-qt-5-15-8-core22-sd/current/" - + "usr/lib/vala-current", - "/snap/kde-frameworks-5-102-qt-5-15-8-core22-sd/current/" - + "usr/lib/$CRAFT_ARCH_TRIPLET/pulseaudio", - ] - ) - + "${LD_LIBRARY_PATH:+:$LD_LIBRARY_PATH}" - }, - { - "PKG_CONFIG_PATH": ( +def test_get_part_snippet_with_external_sdk(kde_neon_extension_with_build_snap): + assert kde_neon_extension_with_build_snap.get_part_snippet() == { + "build-environment": [ + { + "PATH": ( + "/snap/kde-frameworks-5-102-qt-5-15-8-core22-sd/current/usr/bin" + + "${PATH:+:$PATH}" + ) + }, + { + "XDG_DATA_DIRS": ( + "$SNAPCRAFT_STAGE/usr/share:" + + "/snap/kde-frameworks-5-102-qt-5-15-8-core22-sd" + "/current/usr/share:/usr/share${XDG_DATA_DIRS:+:$XDG_DATA_DIRS}" + ) + }, + { + "LD_LIBRARY_PATH": ":".join( + [ "/snap/kde-frameworks-5-102-qt-5-15-8-core22-sd/current/" - + "usr/lib/$CRAFT_ARCH_TRIPLET/pkgconfig:" + + "lib/$CRAFT_ARCH_TRIPLET", "/snap/kde-frameworks-5-102-qt-5-15-8-core22-sd/current/" - + "usr/lib/pkgconfig:" + + "usr/lib/$CRAFT_ARCH_TRIPLET", "/snap/kde-frameworks-5-102-qt-5-15-8-core22-sd/current/" - + "usr/share/pkgconfig" - "${PKG_CONFIG_PATH:+:$PKG_CONFIG_PATH}" - ) - }, - { - "GETTEXTDATADIRS": ( + + "usr/lib", "/snap/kde-frameworks-5-102-qt-5-15-8-core22-sd/current/" - + "usr/share/gettext-current" - "${GETTEXTDATADIRS:+:$GETTEXTDATADIRS}" - ) - }, - { - "ACLOCAL_PATH": ( + + "usr/lib/vala-current", "/snap/kde-frameworks-5-102-qt-5-15-8-core22-sd/current/" - + "usr/share/aclocal" - "${ACLOCAL_PATH:+:$ACLOCAL_PATH}" - ) - }, - { - "PYTHONPATH": ":".join( - [ - "/snap/kde-frameworks-5-102-qt-5-15-8-core22-sd/current/" - + "usr/lib/python3.10", - "/snap/kde-frameworks-5-102-qt-5-15-8-core22-sd/current/" - + "usr/lib/python3/dist-packages", - "/snap/kde-frameworks-5-102-qt-5-15-8-core22-sd/current/" - + "usr/lib/$CRAFT_ARCH_TRIPLET", - "/gobject-introspection", - ] - ) - + "${PYTHONPATH:+:$PYTHONPATH}" - }, - { - "SNAPCRAFT_CMAKE_ARGS": ( - "-DCMAKE_FIND_ROOT_PATH=" - + "/snap/kde-frameworks-5-102-qt-5-15-8-core22-sd/current" - ) - }, - ] - } + + "usr/lib/$CRAFT_ARCH_TRIPLET/pulseaudio", + ] + ) + + "${LD_LIBRARY_PATH:+:$LD_LIBRARY_PATH}" + }, + { + "PKG_CONFIG_PATH": ( + "/snap/kde-frameworks-5-102-qt-5-15-8-core22-sd/current/" + + "usr/lib/$CRAFT_ARCH_TRIPLET/pkgconfig:" + "/snap/kde-frameworks-5-102-qt-5-15-8-core22-sd/current/" + + "usr/lib/pkgconfig:" + "/snap/kde-frameworks-5-102-qt-5-15-8-core22-sd/current/" + + "usr/share/pkgconfig" + "${PKG_CONFIG_PATH:+:$PKG_CONFIG_PATH}" + ) + }, + { + "GETTEXTDATADIRS": ( + "/snap/kde-frameworks-5-102-qt-5-15-8-core22-sd/current/" + + "usr/share/gettext-current" + "${GETTEXTDATADIRS:+:$GETTEXTDATADIRS}" + ) + }, + { + "ACLOCAL_PATH": ( + "/snap/kde-frameworks-5-102-qt-5-15-8-core22-sd/current/" + + "usr/share/aclocal" + "${ACLOCAL_PATH:+:$ACLOCAL_PATH}" + ) + }, + { + "PYTHONPATH": ":".join( + [ + "/snap/kde-frameworks-5-102-qt-5-15-8-core22-sd/current/" + + "usr/lib/python3.10", + "/snap/kde-frameworks-5-102-qt-5-15-8-core22-sd/current/" + + "usr/lib/python3/dist-packages", + "/snap/kde-frameworks-5-102-qt-5-15-8-core22-sd/current/" + + "usr/lib/$CRAFT_ARCH_TRIPLET", + "/gobject-introspection", + ] + ) + + "${PYTHONPATH:+:$PYTHONPATH}" + }, + { + "SNAPCRAFT_CMAKE_ARGS": ( + "-DCMAKE_FIND_ROOT_PATH=" + + "/snap/kde-frameworks-5-102-qt-5-15-8-core22-sd/current" + ) + }, + ] + } def test_get_parts_snippet(kde_neon_extension): From 9a5b4584c6ec241ffe84983a16778e99bfe7aa11 Mon Sep 17 00:00:00 2001 From: Scarlett Moore Date: Fri, 3 Feb 2023 12:07:19 -0700 Subject: [PATCH 30/50] kde-neon-extension: try -all for the content snap connect. --- tests/spread/extensions/kde-neon/task.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/spread/extensions/kde-neon/task.yaml b/tests/spread/extensions/kde-neon/task.yaml index e7b2244ea5..a2a9e4757c 100644 --- a/tests/spread/extensions/kde-neon/task.yaml +++ b/tests/spread/extensions/kde-neon/task.yaml @@ -37,7 +37,7 @@ execute: | cd "$SNAP_DIR" output="$(snapcraft)" snap install neon-hello_*.snap --dangerous - snap connect neon-hello:kde-frameworks-5-99-qt-5-15-7-core20 kde-frameworks-5-99-qt-5-15-7-core20 + snap connect neon-hello:kde-frameworks-5-99-qt-5-15-7-core20 kde-frameworks-5-99-qt-5-15-7-core20-all [ "$(neon-hello)" = "hello world" ] From b6a7e1aeabae0fb2b94126b793be0232d4d90130 Mon Sep 17 00:00:00 2001 From: Scarlett Moore Date: Sat, 4 Feb 2023 05:03:23 -0700 Subject: [PATCH 31/50] kde-neon-extension: fix spread test with correct values for core20, add back removed 18.04. --- tests/spread/extensions/kde-neon/task.yaml | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/tests/spread/extensions/kde-neon/task.yaml b/tests/spread/extensions/kde-neon/task.yaml index a2a9e4757c..921bed3bab 100644 --- a/tests/spread/extensions/kde-neon/task.yaml +++ b/tests/spread/extensions/kde-neon/task.yaml @@ -4,6 +4,9 @@ summary: Build and run a basic kde snap using extensions # available on a subset of all the architectures this testbed # can run on. systems: + - ubuntu-18.04 + - ubuntu-18.04-64 + - ubuntu-18.04-amd64 - ubuntu-20.04 - ubuntu-20.04-64 - ubuntu-20.04-amd64 @@ -49,7 +52,7 @@ execute: | [ "$(cat "$snap_user_data/.last_revision")" = "SNAP_DESKTOP_LAST_REVISION=x1" ] # Verify content snap was installed for dependency checks. - snap list kde-frameworks-5-102-qt-5-15-8-core22 + snap list kde-frameworks-5-99-qt-5-15-7-core20 snap list gtk-common-themes # Verify all dependencies were found. From 5667f00f7bf1a8dd642db13c7e164f3d03538f51 Mon Sep 17 00:00:00 2001 From: Scarlett Moore Date: Sat, 4 Feb 2023 07:09:51 -0700 Subject: [PATCH 32/50] kde-neon-extension: only run spread test on core20 until global is set on core22. --- tests/spread/extensions/kde-neon/task.yaml | 6 ------ 1 file changed, 6 deletions(-) diff --git a/tests/spread/extensions/kde-neon/task.yaml b/tests/spread/extensions/kde-neon/task.yaml index 921bed3bab..e61bb78623 100644 --- a/tests/spread/extensions/kde-neon/task.yaml +++ b/tests/spread/extensions/kde-neon/task.yaml @@ -4,15 +4,9 @@ summary: Build and run a basic kde snap using extensions # available on a subset of all the architectures this testbed # can run on. systems: - - ubuntu-18.04 - - ubuntu-18.04-64 - - ubuntu-18.04-amd64 - ubuntu-20.04 - ubuntu-20.04-64 - ubuntu-20.04-amd64 - - ubuntu-22.04 - - ubuntu-22.04-64 - - ubuntu-22.04-amd64 environment: SNAP_DIR: ../snaps/neon-hello From e7ca659038b052da70fb99490d127f9739cfb926 Mon Sep 17 00:00:00 2001 From: Scarlett Moore Date: Sat, 4 Feb 2023 09:46:51 -0700 Subject: [PATCH 33/50] kde-neon-extension: spread test, remove the -all from connect. --- tests/spread/extensions/kde-neon/task.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/spread/extensions/kde-neon/task.yaml b/tests/spread/extensions/kde-neon/task.yaml index e61bb78623..eb622143c1 100644 --- a/tests/spread/extensions/kde-neon/task.yaml +++ b/tests/spread/extensions/kde-neon/task.yaml @@ -34,7 +34,7 @@ execute: | cd "$SNAP_DIR" output="$(snapcraft)" snap install neon-hello_*.snap --dangerous - snap connect neon-hello:kde-frameworks-5-99-qt-5-15-7-core20 kde-frameworks-5-99-qt-5-15-7-core20-all + snap connect neon-hello:kde-frameworks-5-99-qt-5-15-7-core20 kde-frameworks-5-99-qt-5-15-7-core20 [ "$(neon-hello)" = "hello world" ] From 2abae68211583e30bc14327ca456815b6cec956d Mon Sep 17 00:00:00 2001 From: Scarlett Moore Date: Sat, 4 Feb 2023 09:52:48 -0700 Subject: [PATCH 34/50] kde-neon-extension: fix list_registry command test.. I hope. --- tests/unit/commands/test_list_extensions.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/unit/commands/test_list_extensions.py b/tests/unit/commands/test_list_extensions.py index b1889f1fa6..380df6d564 100644 --- a/tests/unit/commands/test_list_extensions.py +++ b/tests/unit/commands/test_list_extensions.py @@ -41,7 +41,7 @@ def test_command(emitter, command): gnome-3-28 core18 gnome-3-34 core18 gnome-3-38 core20 - kde-neon core22 + kde-neon core18, core20, core22 ros1-noetic core20 ros2-foxy core20 ros2-humble core22""" From 633add343dadb858abfad15b84ffa54c79664e1f Mon Sep 17 00:00:00 2001 From: Scarlett Moore Date: Sat, 4 Feb 2023 10:35:03 -0700 Subject: [PATCH 35/50] kde-neon-extension: ebuild-environment assert again, either I fail linter for line to long or I fail this test. --- tests/unit/extensions/test_kde_neon.py | 118 +++++++++++-------------- 1 file changed, 54 insertions(+), 64 deletions(-) diff --git a/tests/unit/extensions/test_kde_neon.py b/tests/unit/extensions/test_kde_neon.py index 075a3e6a1f..bb145a9375 100644 --- a/tests/unit/extensions/test_kde_neon.py +++ b/tests/unit/extensions/test_kde_neon.py @@ -176,70 +176,65 @@ def test_get_part_snippet_latest_edge( def assert_get_part_snippet(kde_neon_instance): assert kde_neon_instance.get_part_snippet() == { "build-environment": [ - { - "PATH": ( - "/snap/kde-frameworks-5-102-qt-5-15-8-core22-sd/current/usr/bin" - + "${PATH:+:$PATH}" - ) - }, + {"PATH":"/snap/kde-frameworks-5-102-qt-5-15-8-core22-sd/current/usr/bin${PATH:+:$PATH}"}, { "XDG_DATA_DIRS": ( "$SNAPCRAFT_STAGE/usr/share:" - + "/snap/kde-frameworks-5-102-qt-5-15-8-core22-sd" + "/snap/kde-frameworks-5-102-qt-5-15-8-core22-sd" "/current/usr/share:/usr/share${XDG_DATA_DIRS:+:$XDG_DATA_DIRS}" ) }, { "LD_LIBRARY_PATH": ":".join( [ - "/snap/kde-frameworks-5-102-qt-5-15-8-core22-sd/current/" - + "lib/$CRAFT_ARCH_TRIPLET", - "/snap/kde-frameworks-5-102-qt-5-15-8-core22-sd/current/" - + "usr/lib/$CRAFT_ARCH_TRIPLET", - "/snap/kde-frameworks-5-102-qt-5-15-8-core22-sd/current/" - + "usr/lib", - "/snap/kde-frameworks-5-102-qt-5-15-8-core22-sd/current/" - + "usr/lib/vala-current", - "/snap/kde-frameworks-5-102-qt-5-15-8-core22-sd/current/" - + "usr/lib/$CRAFT_ARCH_TRIPLET/pulseaudio", + "/snap/kde-frameworks-5-102-qt-5-15-8-core22-sd/current/ \ + lib/$CRAFT_ARCH_TRIPLET", + "/snap/kde-frameworks-5-102-qt-5-15-8-core22-sd/current/ \ + usr/lib/$CRAFT_ARCH_TRIPLET", + "/snap/kde-frameworks-5-102-qt-5-15-8-core22-sd/current/ \ + usr/lib", + "/snap/kde-frameworks-5-102-qt-5-15-8-core22-sd/current/ \ + usr/lib/vala-current", + "/snap/kde-frameworks-5-102-qt-5-15-8-core22-sd/current/ \ + usr/lib/$CRAFT_ARCH_TRIPLET/pulseaudio", ] ) + "${LD_LIBRARY_PATH:+:$LD_LIBRARY_PATH}" }, { "PKG_CONFIG_PATH": ( - "/snap/kde-frameworks-5-102-qt-5-15-8-core22-sd/current/" - + "usr/lib/$CRAFT_ARCH_TRIPLET/pkgconfig:" - "/snap/kde-frameworks-5-102-qt-5-15-8-core22-sd/current/" - + "usr/lib/pkgconfig:" - "/snap/kde-frameworks-5-102-qt-5-15-8-core22-sd/current/" - + "usr/share/pkgconfig" + "/snap/kde-frameworks-5-102-qt-5-15-8-core22-sd/current/ \ + usr/lib/$CRAFT_ARCH_TRIPLET/pkgconfig:" + "/snap/kde-frameworks-5-102-qt-5-15-8-core22-sd/current/ \ + usr/lib/pkgconfig:" + "/snap/kde-frameworks-5-102-qt-5-15-8-core22-sd/current/ \ + usr/share/pkgconfig" "${PKG_CONFIG_PATH:+:$PKG_CONFIG_PATH}" ) }, { "GETTEXTDATADIRS": ( "/snap/kde-frameworks-5-102-qt-5-15-8-core22-sd/current/" - + "usr/share/gettext-current" + "usr/share/gettext-current" "${GETTEXTDATADIRS:+:$GETTEXTDATADIRS}" ) }, { "ACLOCAL_PATH": ( "/snap/kde-frameworks-5-102-qt-5-15-8-core22-sd/current/" - + "usr/share/aclocal" + "usr/share/aclocal" "${ACLOCAL_PATH:+:$ACLOCAL_PATH}" ) }, { "PYTHONPATH": ":".join( [ - "/snap/kde-frameworks-5-102-qt-5-15-8-core22-sd/current/" - + "usr/lib/python3.10", - "/snap/kde-frameworks-5-102-qt-5-15-8-core22-sd/current/" - + "usr/lib/python3/dist-packages", - "/snap/kde-frameworks-5-102-qt-5-15-8-core22-sd/current/" - + "usr/lib/$CRAFT_ARCH_TRIPLET", + "/snap/kde-frameworks-5-102-qt-5-15-8-core22-sd/current/ \ + usr/lib/python3.10", + "/snap/kde-frameworks-5-102-qt-5-15-8-core22-sd/current/ \ + usr/lib/python3/dist-packages", + "/snap/kde-frameworks-5-102-qt-5-15-8-core22-sd/current/ \ + usr/lib/$CRAFT_ARCH_TRIPLET", "/gobject-introspection", ] ) @@ -248,7 +243,7 @@ def assert_get_part_snippet(kde_neon_instance): { "SNAPCRAFT_CMAKE_ARGS": ( "-DCMAKE_FIND_ROOT_PATH=" - + "/snap/kde-frameworks-5-102-qt-5-15-8-core22-sd/current" + "/snap/kde-frameworks-5-102-qt-5-15-8-core22-sd/current" ) }, ] @@ -258,70 +253,65 @@ def assert_get_part_snippet(kde_neon_instance): def test_get_part_snippet_with_external_sdk(kde_neon_extension_with_build_snap): assert kde_neon_extension_with_build_snap.get_part_snippet() == { "build-environment": [ - { - "PATH": ( - "/snap/kde-frameworks-5-102-qt-5-15-8-core22-sd/current/usr/bin" - + "${PATH:+:$PATH}" - ) - }, + {"PATH":"/snap/kde-frameworks-5-102-qt-5-15-8-core22-sd/current/usr/bin${PATH:+:$PATH}"}, { "XDG_DATA_DIRS": ( "$SNAPCRAFT_STAGE/usr/share:" - + "/snap/kde-frameworks-5-102-qt-5-15-8-core22-sd" + "/snap/kde-frameworks-5-102-qt-5-15-8-core22-sd" "/current/usr/share:/usr/share${XDG_DATA_DIRS:+:$XDG_DATA_DIRS}" ) }, { "LD_LIBRARY_PATH": ":".join( [ - "/snap/kde-frameworks-5-102-qt-5-15-8-core22-sd/current/" - + "lib/$CRAFT_ARCH_TRIPLET", - "/snap/kde-frameworks-5-102-qt-5-15-8-core22-sd/current/" - + "usr/lib/$CRAFT_ARCH_TRIPLET", - "/snap/kde-frameworks-5-102-qt-5-15-8-core22-sd/current/" - + "usr/lib", - "/snap/kde-frameworks-5-102-qt-5-15-8-core22-sd/current/" - + "usr/lib/vala-current", - "/snap/kde-frameworks-5-102-qt-5-15-8-core22-sd/current/" - + "usr/lib/$CRAFT_ARCH_TRIPLET/pulseaudio", + "/snap/kde-frameworks-5-102-qt-5-15-8-core22-sd/current/ \ + lib/$CRAFT_ARCH_TRIPLET", + "/snap/kde-frameworks-5-102-qt-5-15-8-core22-sd/current/ \ + usr/lib/$CRAFT_ARCH_TRIPLET", + "/snap/kde-frameworks-5-102-qt-5-15-8-core22-sd/current/ \ + usr/lib", + "/snap/kde-frameworks-5-102-qt-5-15-8-core22-sd/current/ \ + usr/lib/vala-current", + "/snap/kde-frameworks-5-102-qt-5-15-8-core22-sd/current/ \ + usr/lib/$CRAFT_ARCH_TRIPLET/pulseaudio", ] ) + "${LD_LIBRARY_PATH:+:$LD_LIBRARY_PATH}" }, { "PKG_CONFIG_PATH": ( - "/snap/kde-frameworks-5-102-qt-5-15-8-core22-sd/current/" - + "usr/lib/$CRAFT_ARCH_TRIPLET/pkgconfig:" - "/snap/kde-frameworks-5-102-qt-5-15-8-core22-sd/current/" - + "usr/lib/pkgconfig:" - "/snap/kde-frameworks-5-102-qt-5-15-8-core22-sd/current/" - + "usr/share/pkgconfig" + "/snap/kde-frameworks-5-102-qt-5-15-8-core22-sd/current/ \ + usr/lib/$CRAFT_ARCH_TRIPLET/pkgconfig:" + "/snap/kde-frameworks-5-102-qt-5-15-8-core22-sd/current/ \ + usr/lib/pkgconfig:" + "/snap/kde-frameworks-5-102-qt-5-15-8-core22-sd/current/ \ + usr/share/pkgconfig" "${PKG_CONFIG_PATH:+:$PKG_CONFIG_PATH}" ) }, { "GETTEXTDATADIRS": ( "/snap/kde-frameworks-5-102-qt-5-15-8-core22-sd/current/" - + "usr/share/gettext-current" + "usr/share/gettext-current" "${GETTEXTDATADIRS:+:$GETTEXTDATADIRS}" ) }, { "ACLOCAL_PATH": ( "/snap/kde-frameworks-5-102-qt-5-15-8-core22-sd/current/" - + "usr/share/aclocal" + "usr/share/aclocal" "${ACLOCAL_PATH:+:$ACLOCAL_PATH}" ) }, { "PYTHONPATH": ":".join( [ - "/snap/kde-frameworks-5-102-qt-5-15-8-core22-sd/current/" - + "usr/lib/python3.10", - "/snap/kde-frameworks-5-102-qt-5-15-8-core22-sd/current/" - + "usr/lib/python3/dist-packages", - "/snap/kde-frameworks-5-102-qt-5-15-8-core22-sd/current/" - + "usr/lib/$CRAFT_ARCH_TRIPLET", + "/snap/kde-frameworks-5-102-qt-5-15-8-core22-sd/current/ \ + usr/lib/python3.10", + "/snap/kde-frameworks-5-102-qt-5-15-8-core22-sd/current/ \ + usr/lib/python3/dist-packages", + "/snap/kde-frameworks-5-102-qt-5-15-8-core22-sd/current/ \ + usr/lib/$CRAFT_ARCH_TRIPLET", "/gobject-introspection", ] ) @@ -330,7 +320,7 @@ def test_get_part_snippet_with_external_sdk(kde_neon_extension_with_build_snap): { "SNAPCRAFT_CMAKE_ARGS": ( "-DCMAKE_FIND_ROOT_PATH=" - + "/snap/kde-frameworks-5-102-qt-5-15-8-core22-sd/current" + "/snap/kde-frameworks-5-102-qt-5-15-8-core22-sd/current" ) }, ] From 47000a1242da853142f4874d14116164d94d0bde Mon Sep 17 00:00:00 2001 From: Scarlett Moore Date: Sun, 12 Feb 2023 07:08:36 -0700 Subject: [PATCH 36/50] kde-neon-extension: fix various tox tests. --- snapcraft/extensions/kde_neon.py | 2 +- tests/unit/commands/test_list_extensions.py | 4 +-- tests/unit/extensions/test_kde_neon.py | 28 ++++++++++++++------- 3 files changed, 22 insertions(+), 12 deletions(-) diff --git a/snapcraft/extensions/kde_neon.py b/snapcraft/extensions/kde_neon.py index e89de741ba..ff7514576e 100644 --- a/snapcraft/extensions/kde_neon.py +++ b/snapcraft/extensions/kde_neon.py @@ -244,7 +244,7 @@ def get_parts_snippet(self) -> Dict[str, Any]: if self.kde_snaps.builtin: base = self.yaml_data["base"] sdk_snap = _SDK_SNAP[base] - provider = self.kde_snaps.content + "-all" + provider = self.kde_snaps.content return { "kde-neon-extension/sdk": { "source": str(source), diff --git a/tests/unit/commands/test_list_extensions.py b/tests/unit/commands/test_list_extensions.py index 380df6d564..9b1ee7f37f 100644 --- a/tests/unit/commands/test_list_extensions.py +++ b/tests/unit/commands/test_list_extensions.py @@ -41,7 +41,7 @@ def test_command(emitter, command): gnome-3-28 core18 gnome-3-34 core18 gnome-3-38 core20 - kde-neon core18, core20, core22 + kde-neon core18,core20,core22 ros1-noetic core20 ros2-foxy core20 ros2-humble core22""" @@ -67,7 +67,7 @@ def test_command_extension_dups(emitter, command): gnome-3-28 core18 gnome-3-34 core18 gnome-3-38 core20 - kde-neon core18, core20 + kde-neon core18,core20 ros1-noetic core20 ros2-foxy core20 ros2-humble core22""" diff --git a/tests/unit/extensions/test_kde_neon.py b/tests/unit/extensions/test_kde_neon.py index bb145a9375..b3974bdc7d 100644 --- a/tests/unit/extensions/test_kde_neon.py +++ b/tests/unit/extensions/test_kde_neon.py @@ -176,11 +176,11 @@ def test_get_part_snippet_latest_edge( def assert_get_part_snippet(kde_neon_instance): assert kde_neon_instance.get_part_snippet() == { "build-environment": [ - {"PATH":"/snap/kde-frameworks-5-102-qt-5-15-8-core22-sd/current/usr/bin${PATH:+:$PATH}"}, + { "PATH": "/snap/kde-frameworks-5-102-qt-5-15-8-core22-sd/current/usr/bin${PATH:+:$PATH}" }, { "XDG_DATA_DIRS": ( - "$SNAPCRAFT_STAGE/usr/share:" - "/snap/kde-frameworks-5-102-qt-5-15-8-core22-sd" + "$SNAPCRAFT_STAGE/usr/share: \ + /snap/kde-frameworks-5-102-qt-5-15-8-core22-sd" "/current/usr/share:/usr/share${XDG_DATA_DIRS:+:$XDG_DATA_DIRS}" ) }, @@ -334,7 +334,7 @@ def test_get_parts_snippet(kde_neon_extension): "source-subdir": "kde-neon", "plugin": "make", "make-parameters": [ - "PLATFORM_PLUG=kde-frameworks-5-102-qt-5-15-8-core22-all" + "PLATFORM_PLUG=kde-frameworks-5-102-qt-5-15-8-core22" ], "build-packages": ["g++"], "build-snaps": ["kde-frameworks-5-102-qt-5-15-8-core22-sd"], @@ -345,8 +345,14 @@ def test_get_parts_snippet(kde_neon_extension): def test_get_parts_snippet_with_external_sdk(kde_neon_extension_with_build_snap): assert kde_neon_extension_with_build_snap.get_parts_snippet() == { "kde-neon-extension/sdk": { - "source": str(get_extensions_data_dir() / "desktop" / "command-chain"), + "source": get_extensions_data_dir() / "desktop" / "command-chain", + "source-subdir": "kde-neon", "plugin": "make", + "make-parameters": [ + "PLATFORM_PLUG=kde-frameworks-5-102-qt-5-15-8-core22" + ], + "build-packages": ["g++"], + "build-snaps": ["kde-frameworks-5-102-qt-5-15-8-core22-sd"], } } @@ -357,9 +363,13 @@ def test_get_parts_snippet_with_external_sdk_different_channel( assert ( kde_neon_extension_with_default_build_snap_from_latest_edge.get_parts_snippet() == { - "kde_neon-extension/sdk": { - "source": str(get_extensions_data_dir() / "desktop" / "command-chain"), - "plugin": "make", - } + "source": get_extensions_data_dir() / "desktop" / "command-chain", + "source-subdir": "kde-neon", + "plugin": "make", + "make-parameters": [ + "PLATFORM_PLUG=kde-frameworks-5-102-qt-5-15-8-core22" + ], + "build-packages": ["g++"], + "build-snaps": ["kde-frameworks-5-102-qt-5-15-8-core22-sd"], } ) From 7ff11d015b6f68befb3a5a8656916e19c16929e4 Mon Sep 17 00:00:00 2001 From: Scarlett Moore Date: Sun, 12 Feb 2023 07:47:53 -0700 Subject: [PATCH 37/50] kde-neon-extension: fix black linter. --- tests/unit/extensions/test_kde_neon.py | 20 +++++++++----------- 1 file changed, 9 insertions(+), 11 deletions(-) diff --git a/tests/unit/extensions/test_kde_neon.py b/tests/unit/extensions/test_kde_neon.py index b3974bdc7d..7e207705e5 100644 --- a/tests/unit/extensions/test_kde_neon.py +++ b/tests/unit/extensions/test_kde_neon.py @@ -176,7 +176,9 @@ def test_get_part_snippet_latest_edge( def assert_get_part_snippet(kde_neon_instance): assert kde_neon_instance.get_part_snippet() == { "build-environment": [ - { "PATH": "/snap/kde-frameworks-5-102-qt-5-15-8-core22-sd/current/usr/bin${PATH:+:$PATH}" }, + { + "PATH": "/snap/kde-frameworks-5-102-qt-5-15-8-core22-sd/current/usr/bin${PATH:+:$PATH}" + }, { "XDG_DATA_DIRS": ( "$SNAPCRAFT_STAGE/usr/share: \ @@ -253,7 +255,9 @@ def assert_get_part_snippet(kde_neon_instance): def test_get_part_snippet_with_external_sdk(kde_neon_extension_with_build_snap): assert kde_neon_extension_with_build_snap.get_part_snippet() == { "build-environment": [ - {"PATH":"/snap/kde-frameworks-5-102-qt-5-15-8-core22-sd/current/usr/bin${PATH:+:$PATH}"}, + { + "PATH":"/snap/kde-frameworks-5-102-qt-5-15-8-core22-sd/current/usr/bin${PATH:+:$PATH}" + }, { "XDG_DATA_DIRS": ( "$SNAPCRAFT_STAGE/usr/share:" @@ -333,9 +337,7 @@ def test_get_parts_snippet(kde_neon_extension): "source": get_extensions_data_dir() / "desktop" / "command-chain", "source-subdir": "kde-neon", "plugin": "make", - "make-parameters": [ - "PLATFORM_PLUG=kde-frameworks-5-102-qt-5-15-8-core22" - ], + "make-parameters": ["PLATFORM_PLUG=kde-frameworks-5-102-qt-5-15-8-core22"], ], "build-packages": ["g++"], "build-snaps": ["kde-frameworks-5-102-qt-5-15-8-core22-sd"], } @@ -348,9 +350,7 @@ def test_get_parts_snippet_with_external_sdk(kde_neon_extension_with_build_snap) "source": get_extensions_data_dir() / "desktop" / "command-chain", "source-subdir": "kde-neon", "plugin": "make", - "make-parameters": [ - "PLATFORM_PLUG=kde-frameworks-5-102-qt-5-15-8-core22" - ], + "make-parameters": ["PLATFORM_PLUG=kde-frameworks-5-102-qt-5-15-8-core22"], "build-packages": ["g++"], "build-snaps": ["kde-frameworks-5-102-qt-5-15-8-core22-sd"], } @@ -366,9 +366,7 @@ def test_get_parts_snippet_with_external_sdk_different_channel( "source": get_extensions_data_dir() / "desktop" / "command-chain", "source-subdir": "kde-neon", "plugin": "make", - "make-parameters": [ - "PLATFORM_PLUG=kde-frameworks-5-102-qt-5-15-8-core22" - ], + "make-parameters": ["PLATFORM_PLUG=kde-frameworks-5-102-qt-5-15-8-core22"], "build-packages": ["g++"], "build-snaps": ["kde-frameworks-5-102-qt-5-15-8-core22-sd"], } From d7f46f7310a592d1bf3f9961254c58299ba070c9 Mon Sep 17 00:00:00 2001 From: Scarlett Moore Date: Sun, 12 Feb 2023 07:54:01 -0700 Subject: [PATCH 38/50] kde-neon-extension: fix pylint line to long. --- tests/unit/extensions/test_kde_neon.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/tests/unit/extensions/test_kde_neon.py b/tests/unit/extensions/test_kde_neon.py index 7e207705e5..7c8b6afd59 100644 --- a/tests/unit/extensions/test_kde_neon.py +++ b/tests/unit/extensions/test_kde_neon.py @@ -177,7 +177,8 @@ def assert_get_part_snippet(kde_neon_instance): assert kde_neon_instance.get_part_snippet() == { "build-environment": [ { - "PATH": "/snap/kde-frameworks-5-102-qt-5-15-8-core22-sd/current/usr/bin${PATH:+:$PATH}" + "PATH": "/snap/kde-frameworks-5-102-qt-5-15-8-core22-sd/current/ \ + usr/bin${PATH:+:$PATH}" }, { "XDG_DATA_DIRS": ( @@ -256,7 +257,8 @@ def test_get_part_snippet_with_external_sdk(kde_neon_extension_with_build_snap): assert kde_neon_extension_with_build_snap.get_part_snippet() == { "build-environment": [ { - "PATH":"/snap/kde-frameworks-5-102-qt-5-15-8-core22-sd/current/usr/bin${PATH:+:$PATH}" + "PATH":"/snap/kde-frameworks-5-102-qt-5-15-8-core22-sd/current/ \ + usr/bin${PATH:+:$PATH}" }, { "XDG_DATA_DIRS": ( From d6ebe3303ba36e75869fb05638bb12ec7f2ee82b Mon Sep 17 00:00:00 2001 From: Scarlett Moore Date: Sun, 12 Feb 2023 08:39:48 -0700 Subject: [PATCH 39/50] kde-neon-extension: fix spread test, remove the connect as we use platform plug. Fix the build snaps name. --- snapcraft/extensions/kde_neon.py | 2 +- tests/spread/extensions/kde-neon/task.yaml | 1 - tests/unit/extensions/test_kde_neon.py | 6 +++--- 3 files changed, 4 insertions(+), 5 deletions(-) diff --git a/snapcraft/extensions/kde_neon.py b/snapcraft/extensions/kde_neon.py index ff7514576e..35399a311b 100644 --- a/snapcraft/extensions/kde_neon.py +++ b/snapcraft/extensions/kde_neon.py @@ -252,7 +252,7 @@ def get_parts_snippet(self) -> Dict[str, Any]: "plugin": "make", "make-parameters": [f"PLATFORM_PLUG={provider}"], "build-packages": ["g++"], - "build-snaps": [sdk_snap], + "build-snaps": [f"{sdk_snap}/current/stable"], } } diff --git a/tests/spread/extensions/kde-neon/task.yaml b/tests/spread/extensions/kde-neon/task.yaml index eb622143c1..dcdf6d3c39 100644 --- a/tests/spread/extensions/kde-neon/task.yaml +++ b/tests/spread/extensions/kde-neon/task.yaml @@ -34,7 +34,6 @@ execute: | cd "$SNAP_DIR" output="$(snapcraft)" snap install neon-hello_*.snap --dangerous - snap connect neon-hello:kde-frameworks-5-99-qt-5-15-7-core20 kde-frameworks-5-99-qt-5-15-7-core20 [ "$(neon-hello)" = "hello world" ] diff --git a/tests/unit/extensions/test_kde_neon.py b/tests/unit/extensions/test_kde_neon.py index 7c8b6afd59..f9a7c7492b 100644 --- a/tests/unit/extensions/test_kde_neon.py +++ b/tests/unit/extensions/test_kde_neon.py @@ -341,7 +341,7 @@ def test_get_parts_snippet(kde_neon_extension): "plugin": "make", "make-parameters": ["PLATFORM_PLUG=kde-frameworks-5-102-qt-5-15-8-core22"], ], "build-packages": ["g++"], - "build-snaps": ["kde-frameworks-5-102-qt-5-15-8-core22-sd"], + "build-snaps": ["kde-frameworks-5-102-qt-5-15-8-core22-sd/current/stable"], } } @@ -354,7 +354,7 @@ def test_get_parts_snippet_with_external_sdk(kde_neon_extension_with_build_snap) "plugin": "make", "make-parameters": ["PLATFORM_PLUG=kde-frameworks-5-102-qt-5-15-8-core22"], "build-packages": ["g++"], - "build-snaps": ["kde-frameworks-5-102-qt-5-15-8-core22-sd"], + "build-snaps": ["kde-frameworks-5-102-qt-5-15-8-core22-sd/current/stable"], } } @@ -370,6 +370,6 @@ def test_get_parts_snippet_with_external_sdk_different_channel( "plugin": "make", "make-parameters": ["PLATFORM_PLUG=kde-frameworks-5-102-qt-5-15-8-core22"], "build-packages": ["g++"], - "build-snaps": ["kde-frameworks-5-102-qt-5-15-8-core22-sd"], + "build-snaps": ["kde-frameworks-5-102-qt-5-15-8-core22-sd/current/stable"], } ) From 0d844522314e05f10a437f4e9eff130038d102ac Mon Sep 17 00:00:00 2001 From: Scarlett Moore Date: Sun, 12 Feb 2023 09:14:33 -0700 Subject: [PATCH 40/50] kde-neon-extension: remove cruft.. :( --- tests/unit/extensions/test_kde_neon.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/unit/extensions/test_kde_neon.py b/tests/unit/extensions/test_kde_neon.py index f9a7c7492b..91728fb076 100644 --- a/tests/unit/extensions/test_kde_neon.py +++ b/tests/unit/extensions/test_kde_neon.py @@ -339,7 +339,7 @@ def test_get_parts_snippet(kde_neon_extension): "source": get_extensions_data_dir() / "desktop" / "command-chain", "source-subdir": "kde-neon", "plugin": "make", - "make-parameters": ["PLATFORM_PLUG=kde-frameworks-5-102-qt-5-15-8-core22"], ], + "make-parameters": ["PLATFORM_PLUG=kde-frameworks-5-102-qt-5-15-8-core22"], "build-packages": ["g++"], "build-snaps": ["kde-frameworks-5-102-qt-5-15-8-core22-sd/current/stable"], } From 221a717d1f919e47d78da520e39a994a3b8b1029 Mon Sep 17 00:00:00 2001 From: Scarlett Moore Date: Sun, 12 Feb 2023 09:51:05 -0700 Subject: [PATCH 41/50] kde-neon-extension: fix spacce for black linter. --- tests/unit/extensions/test_kde_neon.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/unit/extensions/test_kde_neon.py b/tests/unit/extensions/test_kde_neon.py index 91728fb076..2fbbb02fa7 100644 --- a/tests/unit/extensions/test_kde_neon.py +++ b/tests/unit/extensions/test_kde_neon.py @@ -257,7 +257,7 @@ def test_get_part_snippet_with_external_sdk(kde_neon_extension_with_build_snap): assert kde_neon_extension_with_build_snap.get_part_snippet() == { "build-environment": [ { - "PATH":"/snap/kde-frameworks-5-102-qt-5-15-8-core22-sd/current/ \ + "PATH": "/snap/kde-frameworks-5-102-qt-5-15-8-core22-sd/current/ \ usr/bin${PATH:+:$PATH}" }, { From 1b39022757ea688e6fdadb535fc4656f36952a72 Mon Sep 17 00:00:00 2001 From: Scarlett Moore Date: Sun, 12 Feb 2023 11:30:43 -0700 Subject: [PATCH 42/50] kde-neon-extension: fix sdk_different_channel test. --- tests/unit/extensions/test_kde_neon.py | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/tests/unit/extensions/test_kde_neon.py b/tests/unit/extensions/test_kde_neon.py index 2fbbb02fa7..da90036cd4 100644 --- a/tests/unit/extensions/test_kde_neon.py +++ b/tests/unit/extensions/test_kde_neon.py @@ -365,11 +365,13 @@ def test_get_parts_snippet_with_external_sdk_different_channel( assert ( kde_neon_extension_with_default_build_snap_from_latest_edge.get_parts_snippet() == { - "source": get_extensions_data_dir() / "desktop" / "command-chain", - "source-subdir": "kde-neon", - "plugin": "make", - "make-parameters": ["PLATFORM_PLUG=kde-frameworks-5-102-qt-5-15-8-core22"], - "build-packages": ["g++"], - "build-snaps": ["kde-frameworks-5-102-qt-5-15-8-core22-sd/current/stable"], + "kde-neon-extension/sdk": { + "source": get_extensions_data_dir() / "desktop" / "command-chain", + "source-subdir": "kde-neon", + "plugin": "make", + "make-parameters": ["PLATFORM_PLUG=kde-frameworks-5-102-qt-5-15-8-core22"], + "build-packages": ["g++"], + "build-snaps": ["kde-frameworks-5-102-qt-5-15-8-core22-sd/current/stable"], + } } ) From 1d7c16740507934e2cff2ec954b7684d74980ee5 Mon Sep 17 00:00:00 2001 From: Scarlett Moore Date: Sun, 12 Feb 2023 12:10:39 -0700 Subject: [PATCH 43/50] kde-neon-extension: and... changing make-parameters back again to make black happy. I wish it would make up its mind which way to do it. --- tests/unit/extensions/test_kde_neon.py | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/tests/unit/extensions/test_kde_neon.py b/tests/unit/extensions/test_kde_neon.py index da90036cd4..6e0a53629f 100644 --- a/tests/unit/extensions/test_kde_neon.py +++ b/tests/unit/extensions/test_kde_neon.py @@ -339,7 +339,9 @@ def test_get_parts_snippet(kde_neon_extension): "source": get_extensions_data_dir() / "desktop" / "command-chain", "source-subdir": "kde-neon", "plugin": "make", - "make-parameters": ["PLATFORM_PLUG=kde-frameworks-5-102-qt-5-15-8-core22"], + "make-parameters": [ + "PLATFORM_PLUG=kde-frameworks-5-102-qt-5-15-8-core22" + ], "build-packages": ["g++"], "build-snaps": ["kde-frameworks-5-102-qt-5-15-8-core22-sd/current/stable"], } @@ -352,7 +354,9 @@ def test_get_parts_snippet_with_external_sdk(kde_neon_extension_with_build_snap) "source": get_extensions_data_dir() / "desktop" / "command-chain", "source-subdir": "kde-neon", "plugin": "make", - "make-parameters": ["PLATFORM_PLUG=kde-frameworks-5-102-qt-5-15-8-core22"], + "make-parameters": [ + "PLATFORM_PLUG=kde-frameworks-5-102-qt-5-15-8-core22" + ], "build-packages": ["g++"], "build-snaps": ["kde-frameworks-5-102-qt-5-15-8-core22-sd/current/stable"], } @@ -369,7 +373,9 @@ def test_get_parts_snippet_with_external_sdk_different_channel( "source": get_extensions_data_dir() / "desktop" / "command-chain", "source-subdir": "kde-neon", "plugin": "make", - "make-parameters": ["PLATFORM_PLUG=kde-frameworks-5-102-qt-5-15-8-core22"], + "make-parameters": [ + "PLATFORM_PLUG=kde-frameworks-5-102-qt-5-15-8-core22" + ], "build-packages": ["g++"], "build-snaps": ["kde-frameworks-5-102-qt-5-15-8-core22-sd/current/stable"], } From 598d76bba5948658e2252ac7cc3814c3adc65284 Mon Sep 17 00:00:00 2001 From: Scarlett Moore Date: Sun, 12 Feb 2023 12:25:08 -0700 Subject: [PATCH 44/50] kde-neon-extension: fix spaces and line breaks in build-environment. --- tests/unit/extensions/test_kde_neon.py | 79 +++++++++++++------------- 1 file changed, 39 insertions(+), 40 deletions(-) diff --git a/tests/unit/extensions/test_kde_neon.py b/tests/unit/extensions/test_kde_neon.py index 6e0a53629f..6e2f03a9ef 100644 --- a/tests/unit/extensions/test_kde_neon.py +++ b/tests/unit/extensions/test_kde_neon.py @@ -177,12 +177,12 @@ def assert_get_part_snippet(kde_neon_instance): assert kde_neon_instance.get_part_snippet() == { "build-environment": [ { - "PATH": "/snap/kde-frameworks-5-102-qt-5-15-8-core22-sd/current/ \ + "PATH": "/snap/kde-frameworks-5-102-qt-5-15-8-core22-sd/current/\ usr/bin${PATH:+:$PATH}" }, { "XDG_DATA_DIRS": ( - "$SNAPCRAFT_STAGE/usr/share: \ + "$SNAPCRAFT_STAGE/usr/share:\ /snap/kde-frameworks-5-102-qt-5-15-8-core22-sd" "/current/usr/share:/usr/share${XDG_DATA_DIRS:+:$XDG_DATA_DIRS}" ) @@ -190,15 +190,15 @@ def assert_get_part_snippet(kde_neon_instance): { "LD_LIBRARY_PATH": ":".join( [ - "/snap/kde-frameworks-5-102-qt-5-15-8-core22-sd/current/ \ + "/snap/kde-frameworks-5-102-qt-5-15-8-core22-sd/current/\ lib/$CRAFT_ARCH_TRIPLET", - "/snap/kde-frameworks-5-102-qt-5-15-8-core22-sd/current/ \ + "/snap/kde-frameworks-5-102-qt-5-15-8-core22-sd/current/\ usr/lib/$CRAFT_ARCH_TRIPLET", - "/snap/kde-frameworks-5-102-qt-5-15-8-core22-sd/current/ \ + "/snap/kde-frameworks-5-102-qt-5-15-8-core22-sd/current/\ usr/lib", - "/snap/kde-frameworks-5-102-qt-5-15-8-core22-sd/current/ \ + "/snap/kde-frameworks-5-102-qt-5-15-8-core22-sd/current/\ usr/lib/vala-current", - "/snap/kde-frameworks-5-102-qt-5-15-8-core22-sd/current/ \ + "/snap/kde-frameworks-5-102-qt-5-15-8-core22-sd/current/\ usr/lib/$CRAFT_ARCH_TRIPLET/pulseaudio", ] ) @@ -206,37 +206,37 @@ def assert_get_part_snippet(kde_neon_instance): }, { "PKG_CONFIG_PATH": ( - "/snap/kde-frameworks-5-102-qt-5-15-8-core22-sd/current/ \ + "/snap/kde-frameworks-5-102-qt-5-15-8-core22-sd/current/\ usr/lib/$CRAFT_ARCH_TRIPLET/pkgconfig:" - "/snap/kde-frameworks-5-102-qt-5-15-8-core22-sd/current/ \ + "/snap/kde-frameworks-5-102-qt-5-15-8-core22-sd/current/\ usr/lib/pkgconfig:" - "/snap/kde-frameworks-5-102-qt-5-15-8-core22-sd/current/ \ + "/snap/kde-frameworks-5-102-qt-5-15-8-core22-sd/current/\ usr/share/pkgconfig" "${PKG_CONFIG_PATH:+:$PKG_CONFIG_PATH}" ) }, { "GETTEXTDATADIRS": ( - "/snap/kde-frameworks-5-102-qt-5-15-8-core22-sd/current/" - "usr/share/gettext-current" + "/snap/kde-frameworks-5-102-qt-5-15-8-core22-sd/current/\ + usr/share/gettext-current" "${GETTEXTDATADIRS:+:$GETTEXTDATADIRS}" ) }, { "ACLOCAL_PATH": ( - "/snap/kde-frameworks-5-102-qt-5-15-8-core22-sd/current/" - "usr/share/aclocal" + "/snap/kde-frameworks-5-102-qt-5-15-8-core22-sd/current/\ + usr/share/aclocal" "${ACLOCAL_PATH:+:$ACLOCAL_PATH}" ) }, { "PYTHONPATH": ":".join( [ - "/snap/kde-frameworks-5-102-qt-5-15-8-core22-sd/current/ \ + "/snap/kde-frameworks-5-102-qt-5-15-8-core22-sd/current/\ usr/lib/python3.10", - "/snap/kde-frameworks-5-102-qt-5-15-8-core22-sd/current/ \ + "/snap/kde-frameworks-5-102-qt-5-15-8-core22-sd/current/\ usr/lib/python3/dist-packages", - "/snap/kde-frameworks-5-102-qt-5-15-8-core22-sd/current/ \ + "/snap/kde-frameworks-5-102-qt-5-15-8-core22-sd/current/\ usr/lib/$CRAFT_ARCH_TRIPLET", "/gobject-introspection", ] @@ -245,8 +245,8 @@ def assert_get_part_snippet(kde_neon_instance): }, { "SNAPCRAFT_CMAKE_ARGS": ( - "-DCMAKE_FIND_ROOT_PATH=" - "/snap/kde-frameworks-5-102-qt-5-15-8-core22-sd/current" + "-DCMAKE_FIND_ROOT_PATH=\ + /snap/kde-frameworks-5-102-qt-5-15-8-core22-sd/current" ) }, ] @@ -257,28 +257,27 @@ def test_get_part_snippet_with_external_sdk(kde_neon_extension_with_build_snap): assert kde_neon_extension_with_build_snap.get_part_snippet() == { "build-environment": [ { - "PATH": "/snap/kde-frameworks-5-102-qt-5-15-8-core22-sd/current/ \ + "PATH": "/snap/kde-frameworks-5-102-qt-5-15-8-core22-sd/current/\ usr/bin${PATH:+:$PATH}" }, { "XDG_DATA_DIRS": ( - "$SNAPCRAFT_STAGE/usr/share:" - "/snap/kde-frameworks-5-102-qt-5-15-8-core22-sd" - "/current/usr/share:/usr/share${XDG_DATA_DIRS:+:$XDG_DATA_DIRS}" + "$SNAPCRAFT_STAGE/usr/share:/snap/kde-frameworks-5-102-qt-5-15-8-core22-sd\ + /current/usr/share:/usr/share${XDG_DATA_DIRS:+:$XDG_DATA_DIRS}" ) }, { "LD_LIBRARY_PATH": ":".join( [ - "/snap/kde-frameworks-5-102-qt-5-15-8-core22-sd/current/ \ + "/snap/kde-frameworks-5-102-qt-5-15-8-core22-sd/current/\ lib/$CRAFT_ARCH_TRIPLET", - "/snap/kde-frameworks-5-102-qt-5-15-8-core22-sd/current/ \ + "/snap/kde-frameworks-5-102-qt-5-15-8-core22-sd/current/\ usr/lib/$CRAFT_ARCH_TRIPLET", - "/snap/kde-frameworks-5-102-qt-5-15-8-core22-sd/current/ \ + "/snap/kde-frameworks-5-102-qt-5-15-8-core22-sd/current/\ usr/lib", - "/snap/kde-frameworks-5-102-qt-5-15-8-core22-sd/current/ \ + "/snap/kde-frameworks-5-102-qt-5-15-8-core22-sd/current/\ usr/lib/vala-current", - "/snap/kde-frameworks-5-102-qt-5-15-8-core22-sd/current/ \ + "/snap/kde-frameworks-5-102-qt-5-15-8-core22-sd/current/\ usr/lib/$CRAFT_ARCH_TRIPLET/pulseaudio", ] ) @@ -286,37 +285,37 @@ def test_get_part_snippet_with_external_sdk(kde_neon_extension_with_build_snap): }, { "PKG_CONFIG_PATH": ( - "/snap/kde-frameworks-5-102-qt-5-15-8-core22-sd/current/ \ + "/snap/kde-frameworks-5-102-qt-5-15-8-core22-sd/current/\ usr/lib/$CRAFT_ARCH_TRIPLET/pkgconfig:" - "/snap/kde-frameworks-5-102-qt-5-15-8-core22-sd/current/ \ + "/snap/kde-frameworks-5-102-qt-5-15-8-core22-sd/current/\ usr/lib/pkgconfig:" - "/snap/kde-frameworks-5-102-qt-5-15-8-core22-sd/current/ \ + "/snap/kde-frameworks-5-102-qt-5-15-8-core22-sd/current/\ usr/share/pkgconfig" "${PKG_CONFIG_PATH:+:$PKG_CONFIG_PATH}" ) }, { "GETTEXTDATADIRS": ( - "/snap/kde-frameworks-5-102-qt-5-15-8-core22-sd/current/" - "usr/share/gettext-current" + "/snap/kde-frameworks-5-102-qt-5-15-8-core22-sd/current/\ + usr/share/gettext-current" "${GETTEXTDATADIRS:+:$GETTEXTDATADIRS}" ) }, { "ACLOCAL_PATH": ( - "/snap/kde-frameworks-5-102-qt-5-15-8-core22-sd/current/" - "usr/share/aclocal" + "/snap/kde-frameworks-5-102-qt-5-15-8-core22-sd/current/\ + usr/share/aclocal" "${ACLOCAL_PATH:+:$ACLOCAL_PATH}" ) }, { "PYTHONPATH": ":".join( [ - "/snap/kde-frameworks-5-102-qt-5-15-8-core22-sd/current/ \ + "/snap/kde-frameworks-5-102-qt-5-15-8-core22-sd/current/\ usr/lib/python3.10", - "/snap/kde-frameworks-5-102-qt-5-15-8-core22-sd/current/ \ + "/snap/kde-frameworks-5-102-qt-5-15-8-core22-sd/current/\ usr/lib/python3/dist-packages", - "/snap/kde-frameworks-5-102-qt-5-15-8-core22-sd/current/ \ + "/snap/kde-frameworks-5-102-qt-5-15-8-core22-sd/current/\ usr/lib/$CRAFT_ARCH_TRIPLET", "/gobject-introspection", ] @@ -325,8 +324,8 @@ def test_get_part_snippet_with_external_sdk(kde_neon_extension_with_build_snap): }, { "SNAPCRAFT_CMAKE_ARGS": ( - "-DCMAKE_FIND_ROOT_PATH=" - "/snap/kde-frameworks-5-102-qt-5-15-8-core22-sd/current" + "-DCMAKE_FIND_ROOT_PATH=\ + /snap/kde-frameworks-5-102-qt-5-15-8-core22-sd/current" ) }, ] From edc94788cb05e49fdd0f615157a26c2d62c71beb Mon Sep 17 00:00:00 2001 From: Sergio Schvezov Date: Thu, 16 Feb 2023 10:59:17 -0300 Subject: [PATCH 45/50] lint: black --- tests/unit/extensions/test_kde_neon.py | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) diff --git a/tests/unit/extensions/test_kde_neon.py b/tests/unit/extensions/test_kde_neon.py index 6e2f03a9ef..5b327b545c 100644 --- a/tests/unit/extensions/test_kde_neon.py +++ b/tests/unit/extensions/test_kde_neon.py @@ -338,9 +338,7 @@ def test_get_parts_snippet(kde_neon_extension): "source": get_extensions_data_dir() / "desktop" / "command-chain", "source-subdir": "kde-neon", "plugin": "make", - "make-parameters": [ - "PLATFORM_PLUG=kde-frameworks-5-102-qt-5-15-8-core22" - ], + "make-parameters": ["PLATFORM_PLUG=kde-frameworks-5-102-qt-5-15-8-core22"], "build-packages": ["g++"], "build-snaps": ["kde-frameworks-5-102-qt-5-15-8-core22-sd/current/stable"], } @@ -353,9 +351,7 @@ def test_get_parts_snippet_with_external_sdk(kde_neon_extension_with_build_snap) "source": get_extensions_data_dir() / "desktop" / "command-chain", "source-subdir": "kde-neon", "plugin": "make", - "make-parameters": [ - "PLATFORM_PLUG=kde-frameworks-5-102-qt-5-15-8-core22" - ], + "make-parameters": ["PLATFORM_PLUG=kde-frameworks-5-102-qt-5-15-8-core22"], "build-packages": ["g++"], "build-snaps": ["kde-frameworks-5-102-qt-5-15-8-core22-sd/current/stable"], } @@ -376,7 +372,9 @@ def test_get_parts_snippet_with_external_sdk_different_channel( "PLATFORM_PLUG=kde-frameworks-5-102-qt-5-15-8-core22" ], "build-packages": ["g++"], - "build-snaps": ["kde-frameworks-5-102-qt-5-15-8-core22-sd/current/stable"], + "build-snaps": [ + "kde-frameworks-5-102-qt-5-15-8-core22-sd/current/stable" + ], } } ) From 4cd1e0f45d6d64135b40b08b2cb769de161ea47d Mon Sep 17 00:00:00 2001 From: Scarlett Moore Date: Thu, 16 Feb 2023 08:52:16 -0700 Subject: [PATCH 46/50] kde-neon-extension: fix tests with proper test environment. --- snapcraft/extensions/kde_neon.py | 16 +- tests/unit/commands/test_list_extensions.py | 8 +- tests/unit/extensions/test_kde_neon.py | 213 ++++++++++---------- 3 files changed, 121 insertions(+), 116 deletions(-) diff --git a/snapcraft/extensions/kde_neon.py b/snapcraft/extensions/kde_neon.py index 35399a311b..4cc4603ebe 100644 --- a/snapcraft/extensions/kde_neon.py +++ b/snapcraft/extensions/kde_neon.py @@ -199,14 +199,14 @@ def get_part_snippet(self) -> Dict[str, Any]: ], ), }, - { - "GETTEXTDATADIRS": prepend_to_env( - "GETTEXTDATADIRS", - [ - f"/snap/{sdk_snap}/current/usr/share/gettext-current", - ], - ), - }, + # { + # "GETTEXTDATADIRS": prepend_to_env( + # "GETTEXTDATADIRS", + # [ + # f"/snap/{sdk_snap}/current/usr/share/gettext-current", + # ], + # ), + # }, { "ACLOCAL_PATH": prepend_to_env( "ACLOCAL_PATH", diff --git a/tests/unit/commands/test_list_extensions.py b/tests/unit/commands/test_list_extensions.py index 9b1ee7f37f..2fef48836d 100644 --- a/tests/unit/commands/test_list_extensions.py +++ b/tests/unit/commands/test_list_extensions.py @@ -31,7 +31,7 @@ def test_command(emitter, command): dedent( """\ Extension name Supported bases - ---------------- ----------------- + ---------------- ---------------------- fake-extension core22 flutter-beta core18 flutter-dev core18 @@ -41,7 +41,7 @@ def test_command(emitter, command): gnome-3-28 core18 gnome-3-34 core18 gnome-3-38 core20 - kde-neon core18,core20,core22 + kde-neon core18, core20, core22 ros1-noetic core20 ros2-foxy core20 ros2-humble core22""" @@ -58,7 +58,7 @@ def test_command_extension_dups(emitter, command): dedent( """\ Extension name Supported bases - ---------------- ----------------- + ---------------- ---------------------- flutter-beta core18 flutter-dev core18 flutter-master core18 @@ -67,7 +67,7 @@ def test_command_extension_dups(emitter, command): gnome-3-28 core18 gnome-3-34 core18 gnome-3-38 core20 - kde-neon core18,core20 + kde-neon core18, core20, core22 ros1-noetic core20 ros2-foxy core20 ros2-humble core22""" diff --git a/tests/unit/extensions/test_kde_neon.py b/tests/unit/extensions/test_kde_neon.py index 5b327b545c..a5c3ff0c03 100644 --- a/tests/unit/extensions/test_kde_neon.py +++ b/tests/unit/extensions/test_kde_neon.py @@ -177,78 +177,78 @@ def assert_get_part_snippet(kde_neon_instance): assert kde_neon_instance.get_part_snippet() == { "build-environment": [ { - "PATH": "/snap/kde-frameworks-5-102-qt-5-15-8-core22-sd/current/\ - usr/bin${PATH:+:$PATH}" + "PATH": "/snap/kde-frameworks-5-102-qt-5-15-8-core22-sd/current/" + + "usr/bin${PATH:+:$PATH}" }, { "XDG_DATA_DIRS": ( - "$SNAPCRAFT_STAGE/usr/share:\ - /snap/kde-frameworks-5-102-qt-5-15-8-core22-sd" + "$SNAPCRAFT_STAGE/usr/share:" + + "/snap/kde-frameworks-5-102-qt-5-15-8-core22-sd" "/current/usr/share:/usr/share${XDG_DATA_DIRS:+:$XDG_DATA_DIRS}" ) }, { "LD_LIBRARY_PATH": ":".join( [ - "/snap/kde-frameworks-5-102-qt-5-15-8-core22-sd/current/\ - lib/$CRAFT_ARCH_TRIPLET", - "/snap/kde-frameworks-5-102-qt-5-15-8-core22-sd/current/\ - usr/lib/$CRAFT_ARCH_TRIPLET", - "/snap/kde-frameworks-5-102-qt-5-15-8-core22-sd/current/\ - usr/lib", - "/snap/kde-frameworks-5-102-qt-5-15-8-core22-sd/current/\ - usr/lib/vala-current", - "/snap/kde-frameworks-5-102-qt-5-15-8-core22-sd/current/\ - usr/lib/$CRAFT_ARCH_TRIPLET/pulseaudio", + "/snap/kde-frameworks-5-102-qt-5-15-8-core22-sd/current/" + + "lib/$CRAFT_ARCH_TRIPLET", + "/snap/kde-frameworks-5-102-qt-5-15-8-core22-sd/current/" + + "usr/lib/$CRAFT_ARCH_TRIPLET", + "/snap/kde-frameworks-5-102-qt-5-15-8-core22-sd/current/" + + "usr/lib", + "/snap/kde-frameworks-5-102-qt-5-15-8-core22-sd/current/" + + "usr/lib/vala-current", + "/snap/kde-frameworks-5-102-qt-5-15-8-core22-sd/current/" + + "usr/lib/$CRAFT_ARCH_TRIPLET/pulseaudio", ] ) + "${LD_LIBRARY_PATH:+:$LD_LIBRARY_PATH}" }, { "PKG_CONFIG_PATH": ( - "/snap/kde-frameworks-5-102-qt-5-15-8-core22-sd/current/\ - usr/lib/$CRAFT_ARCH_TRIPLET/pkgconfig:" - "/snap/kde-frameworks-5-102-qt-5-15-8-core22-sd/current/\ - usr/lib/pkgconfig:" - "/snap/kde-frameworks-5-102-qt-5-15-8-core22-sd/current/\ - usr/share/pkgconfig" - "${PKG_CONFIG_PATH:+:$PKG_CONFIG_PATH}" - ) - }, - { - "GETTEXTDATADIRS": ( - "/snap/kde-frameworks-5-102-qt-5-15-8-core22-sd/current/\ - usr/share/gettext-current" - "${GETTEXTDATADIRS:+:$GETTEXTDATADIRS}" + "/snap/kde-frameworks-5-102-qt-5-15-8-core22-sd/current/" + + "usr/lib/$CRAFT_ARCH_TRIPLET/pkgconfig:" + "/snap/kde-frameworks-5-102-qt-5-15-8-core22-sd/current/" + + "usr/lib/pkgconfig:" + "/snap/kde-frameworks-5-102-qt-5-15-8-core22-sd/current/" + + "usr/share/pkgconfig" ) + + "${PKG_CONFIG_PATH:+:$PKG_CONFIG_PATH}" }, + # { + # "GETTEXTDATADIRS": ( + # "/snap/kde-frameworks-5-102-qt-5-15-8-core22-sd/current/" + # + "usr/share/gettext-current" + # ) + # + "${GETTEXTDATADIRS:+:$GETTEXTDATADIRS}" + # }, { "ACLOCAL_PATH": ( - "/snap/kde-frameworks-5-102-qt-5-15-8-core22-sd/current/\ - usr/share/aclocal" - "${ACLOCAL_PATH:+:$ACLOCAL_PATH}" + "/snap/kde-frameworks-5-102-qt-5-15-8-core22-sd/current/" + + "usr/share/aclocal" ) + + "${ACLOCAL_PATH:+:$ACLOCAL_PATH}" }, { - "PYTHONPATH": ":".join( + "PYTHONPATH": ( [ - "/snap/kde-frameworks-5-102-qt-5-15-8-core22-sd/current/\ - usr/lib/python3.10", - "/snap/kde-frameworks-5-102-qt-5-15-8-core22-sd/current/\ - usr/lib/python3/dist-packages", - "/snap/kde-frameworks-5-102-qt-5-15-8-core22-sd/current/\ - usr/lib/$CRAFT_ARCH_TRIPLET", + "/snap/kde-frameworks-5-102-qt-5-15-8-core22-sd/current/" + + "usr/lib/python3.10", + "/snap/kde-frameworks-5-102-qt-5-15-8-core22-sd/current/" + + "usr/lib/python3/dist-packages", + "/snap/kde-frameworks-5-102-qt-5-15-8-core22-sd/current/" + + "usr/lib/$CRAFT_ARCH_TRIPLET", "/gobject-introspection", ] ) + "${PYTHONPATH:+:$PYTHONPATH}" }, - { - "SNAPCRAFT_CMAKE_ARGS": ( - "-DCMAKE_FIND_ROOT_PATH=\ - /snap/kde-frameworks-5-102-qt-5-15-8-core22-sd/current" - ) - }, + # { + # "SNAPCRAFT_CMAKE_ARGS": ( + # "-DCMAKE_FIND_ROOT_PATH=" + # + "/snap/kde-frameworks-5-102-qt-5-15-8-core22-sd/current" + # ) + # }, ] } @@ -257,66 +257,66 @@ def test_get_part_snippet_with_external_sdk(kde_neon_extension_with_build_snap): assert kde_neon_extension_with_build_snap.get_part_snippet() == { "build-environment": [ { - "PATH": "/snap/kde-frameworks-5-102-qt-5-15-8-core22-sd/current/\ - usr/bin${PATH:+:$PATH}" + "PATH": "/snap/kde-frameworks-5-102-qt-5-15-8-core22-sd/current/" + + "usr/bin${PATH:+:$PATH}" }, { "XDG_DATA_DIRS": ( - "$SNAPCRAFT_STAGE/usr/share:/snap/kde-frameworks-5-102-qt-5-15-8-core22-sd\ - /current/usr/share:/usr/share${XDG_DATA_DIRS:+:$XDG_DATA_DIRS}" + "$SNAPCRAFT_STAGE/usr/share:/snap/kde-frameworks-5-102-qt-5-15-8-core22-sd" + + "/current/usr/share:/usr/share${XDG_DATA_DIRS:+:$XDG_DATA_DIRS}" ) }, { "LD_LIBRARY_PATH": ":".join( [ - "/snap/kde-frameworks-5-102-qt-5-15-8-core22-sd/current/\ - lib/$CRAFT_ARCH_TRIPLET", - "/snap/kde-frameworks-5-102-qt-5-15-8-core22-sd/current/\ - usr/lib/$CRAFT_ARCH_TRIPLET", - "/snap/kde-frameworks-5-102-qt-5-15-8-core22-sd/current/\ - usr/lib", - "/snap/kde-frameworks-5-102-qt-5-15-8-core22-sd/current/\ - usr/lib/vala-current", - "/snap/kde-frameworks-5-102-qt-5-15-8-core22-sd/current/\ - usr/lib/$CRAFT_ARCH_TRIPLET/pulseaudio", + "/snap/kde-frameworks-5-102-qt-5-15-8-core22-sd/current/" + + "lib/$CRAFT_ARCH_TRIPLET", + "/snap/kde-frameworks-5-102-qt-5-15-8-core22-sd/current/" + + "usr/lib/$CRAFT_ARCH_TRIPLET", + "/snap/kde-frameworks-5-102-qt-5-15-8-core22-sd/current/" + + "usr/lib", + "/snap/kde-frameworks-5-102-qt-5-15-8-core22-sd/current/" + + "usr/lib/vala-current", + "/snap/kde-frameworks-5-102-qt-5-15-8-core22-sd/current/" + + "usr/lib/$CRAFT_ARCH_TRIPLET/pulseaudio", ] ) + "${LD_LIBRARY_PATH:+:$LD_LIBRARY_PATH}" }, { "PKG_CONFIG_PATH": ( - "/snap/kde-frameworks-5-102-qt-5-15-8-core22-sd/current/\ - usr/lib/$CRAFT_ARCH_TRIPLET/pkgconfig:" - "/snap/kde-frameworks-5-102-qt-5-15-8-core22-sd/current/\ - usr/lib/pkgconfig:" - "/snap/kde-frameworks-5-102-qt-5-15-8-core22-sd/current/\ - usr/share/pkgconfig" - "${PKG_CONFIG_PATH:+:$PKG_CONFIG_PATH}" - ) - }, - { - "GETTEXTDATADIRS": ( - "/snap/kde-frameworks-5-102-qt-5-15-8-core22-sd/current/\ - usr/share/gettext-current" - "${GETTEXTDATADIRS:+:$GETTEXTDATADIRS}" + "/snap/kde-frameworks-5-102-qt-5-15-8-core22-sd/current/" + + "usr/lib/$CRAFT_ARCH_TRIPLET/pkgconfig:" + "/snap/kde-frameworks-5-102-qt-5-15-8-core22-sd/current/" + + "usr/lib/pkgconfig:" + "/snap/kde-frameworks-5-102-qt-5-15-8-core22-sd/current/" + + "usr/share/pkgconfig" ) + + "${PKG_CONFIG_PATH:+:$PKG_CONFIG_PATH}" }, + # { + # "GETTEXTDATADIRS": ( + # "/snap/kde-frameworks-5-102-qt-5-15-8-core22-sd/current/" + # + "usr/share/gettext-current" + # ) + # + "${GETTEXTDATADIRS:+:$GETTEXTDATADIRS}" + # }, { "ACLOCAL_PATH": ( - "/snap/kde-frameworks-5-102-qt-5-15-8-core22-sd/current/\ - usr/share/aclocal" - "${ACLOCAL_PATH:+:$ACLOCAL_PATH}" + "/snap/kde-frameworks-5-102-qt-5-15-8-core22-sd/current/" + + "usr/share/aclocal" ) + + "${ACLOCAL_PATH:+:$ACLOCAL_PATH}" }, { - "PYTHONPATH": ":".join( + "PYTHONPATH": ( [ - "/snap/kde-frameworks-5-102-qt-5-15-8-core22-sd/current/\ - usr/lib/python3.10", - "/snap/kde-frameworks-5-102-qt-5-15-8-core22-sd/current/\ - usr/lib/python3/dist-packages", - "/snap/kde-frameworks-5-102-qt-5-15-8-core22-sd/current/\ - usr/lib/$CRAFT_ARCH_TRIPLET", + "/snap/kde-frameworks-5-102-qt-5-15-8-core22-sd/current/" + + "usr/lib/python3.10", + "/snap/kde-frameworks-5-102-qt-5-15-8-core22-sd/current/" + + "usr/lib/python3/dist-packages", + "/snap/kde-frameworks-5-102-qt-5-15-8-core22-sd/current/" + + "usr/lib/$CRAFT_ARCH_TRIPLET", "/gobject-introspection", ] ) @@ -324,8 +324,8 @@ def test_get_part_snippet_with_external_sdk(kde_neon_extension_with_build_snap): }, { "SNAPCRAFT_CMAKE_ARGS": ( - "-DCMAKE_FIND_ROOT_PATH=\ - /snap/kde-frameworks-5-102-qt-5-15-8-core22-sd/current" + "-DCMAKE_FIND_ROOT_PATH=" + + "/snap/kde-frameworks-5-102-qt-5-15-8-core22-sd/current" ) }, ] @@ -333,39 +333,44 @@ def test_get_part_snippet_with_external_sdk(kde_neon_extension_with_build_snap): def test_get_parts_snippet(kde_neon_extension): - assert kde_neon_extension.get_parts_snippet() == { - "kde-neon-extension/sdk": { - "source": get_extensions_data_dir() / "desktop" / "command-chain", - "source-subdir": "kde-neon", - "plugin": "make", - "make-parameters": ["PLATFORM_PLUG=kde-frameworks-5-102-qt-5-15-8-core22"], - "build-packages": ["g++"], - "build-snaps": ["kde-frameworks-5-102-qt-5-15-8-core22-sd/current/stable"], + source = get_extensions_data_dir() / "desktop" / "command-chain" + + assert kde_neon_extension.get_parts_snippet() == { + "kde-neon-extension/sdk": { + "source": str(source), + "source-subdir": "kde-neon", + "plugin": "make", + "make-parameters": ["PLATFORM_PLUG=kde-frameworks-5-102-qt-5-15-8-core22"], + "build-packages": ["g++"], + "build-snaps": ["kde-frameworks-5-102-qt-5-15-8-core22-sd/current/stable"], } } def test_get_parts_snippet_with_external_sdk(kde_neon_extension_with_build_snap): - assert kde_neon_extension_with_build_snap.get_parts_snippet() == { - "kde-neon-extension/sdk": { - "source": get_extensions_data_dir() / "desktop" / "command-chain", - "source-subdir": "kde-neon", - "plugin": "make", - "make-parameters": ["PLATFORM_PLUG=kde-frameworks-5-102-qt-5-15-8-core22"], - "build-packages": ["g++"], - "build-snaps": ["kde-frameworks-5-102-qt-5-15-8-core22-sd/current/stable"], - } - } + source = get_extensions_data_dir() / "desktop" / "command-chain" + + assert kde_neon_extension_with_build_snap.get_parts_snippet() == { + "kde-neon-extension/sdk": { + "source": str(source), + "source-subdir": "kde-neon", + "plugin": "make", + "make-parameters": ["PLATFORM_PLUG=kde-frameworks-5-102-qt-5-15-8-core22"], + "build-packages": ["g++"], + "build-snaps": ["kde-frameworks-5-102-qt-5-15-8-core22-sd/current/stable"], + } + } def test_get_parts_snippet_with_external_sdk_different_channel( kde_neon_extension_with_default_build_snap_from_latest_edge, ): - assert ( + source = get_extensions_data_dir() / "desktop" / "command-chain" + assert ( kde_neon_extension_with_default_build_snap_from_latest_edge.get_parts_snippet() == { "kde-neon-extension/sdk": { - "source": get_extensions_data_dir() / "desktop" / "command-chain", + "source": str(source), "source-subdir": "kde-neon", "plugin": "make", "make-parameters": [ From 9f04fe552f5d55046007d655c6250c47b92ec305 Mon Sep 17 00:00:00 2001 From: Scarlett Moore Date: Thu, 16 Feb 2023 09:58:54 -0700 Subject: [PATCH 47/50] kde-neon-extension: fix indentation. --- tests/unit/extensions/test_kde_neon.py | 80 +++++++++++++------------- 1 file changed, 40 insertions(+), 40 deletions(-) diff --git a/tests/unit/extensions/test_kde_neon.py b/tests/unit/extensions/test_kde_neon.py index a5c3ff0c03..d849c497cd 100644 --- a/tests/unit/extensions/test_kde_neon.py +++ b/tests/unit/extensions/test_kde_neon.py @@ -333,53 +333,53 @@ def test_get_part_snippet_with_external_sdk(kde_neon_extension_with_build_snap): def test_get_parts_snippet(kde_neon_extension): - source = get_extensions_data_dir() / "desktop" / "command-chain" - - assert kde_neon_extension.get_parts_snippet() == { - "kde-neon-extension/sdk": { - "source": str(source), - "source-subdir": "kde-neon", - "plugin": "make", - "make-parameters": ["PLATFORM_PLUG=kde-frameworks-5-102-qt-5-15-8-core22"], - "build-packages": ["g++"], - "build-snaps": ["kde-frameworks-5-102-qt-5-15-8-core22-sd/current/stable"], - } + source = get_extensions_data_dir() / "desktop" / "command-chain" + + assert kde_neon_extension.get_parts_snippet() == { + "kde-neon-extension/sdk": { + "source": str(source), + "source-subdir": "kde-neon", + "plugin": "make", + "make-parameters": ["PLATFORM_PLUG=kde-frameworks-5-102-qt-5-15-8-core22"], + "build-packages": ["g++"], + "build-snaps": ["kde-frameworks-5-102-qt-5-15-8-core22-sd/current/stable"], + } } def test_get_parts_snippet_with_external_sdk(kde_neon_extension_with_build_snap): - source = get_extensions_data_dir() / "desktop" / "command-chain" - - assert kde_neon_extension_with_build_snap.get_parts_snippet() == { - "kde-neon-extension/sdk": { - "source": str(source), - "source-subdir": "kde-neon", - "plugin": "make", - "make-parameters": ["PLATFORM_PLUG=kde-frameworks-5-102-qt-5-15-8-core22"], - "build-packages": ["g++"], - "build-snaps": ["kde-frameworks-5-102-qt-5-15-8-core22-sd/current/stable"], - } - } + source = get_extensions_data_dir() / "desktop" / "command-chain" + + assert kde_neon_extension_with_build_snap.get_parts_snippet() == { + "kde-neon-extension/sdk": { + "source": str(source), + "source-subdir": "kde-neon", + "plugin": "make", + "make-parameters": ["PLATFORM_PLUG=kde-frameworks-5-102-qt-5-15-8-core22"], + "build-packages": ["g++"], + "build-snaps": ["kde-frameworks-5-102-qt-5-15-8-core22-sd/current/stable"], + } + } def test_get_parts_snippet_with_external_sdk_different_channel( kde_neon_extension_with_default_build_snap_from_latest_edge, ): - source = get_extensions_data_dir() / "desktop" / "command-chain" - assert ( - kde_neon_extension_with_default_build_snap_from_latest_edge.get_parts_snippet() - == { - "kde-neon-extension/sdk": { - "source": str(source), - "source-subdir": "kde-neon", - "plugin": "make", - "make-parameters": [ - "PLATFORM_PLUG=kde-frameworks-5-102-qt-5-15-8-core22" - ], - "build-packages": ["g++"], - "build-snaps": [ - "kde-frameworks-5-102-qt-5-15-8-core22-sd/current/stable" - ], - } - } + source = get_extensions_data_dir() / "desktop" / "command-chain" + assert ( + kde_neon_extension_with_default_build_snap_from_latest_edge.get_parts_snippet() + == { + "kde-neon-extension/sdk": { + "source": str(source), + "source-subdir": "kde-neon", + "plugin": "make", + "make-parameters": [ + "PLATFORM_PLUG=kde-frameworks-5-102-qt-5-15-8-core22" + ], + "build-packages": ["g++"], + "build-snaps": [ + "kde-frameworks-5-102-qt-5-15-8-core22-sd/current/stable" + ], + } + } ) From 8bda52906f10e3ac92eaadaaea998ba5df37e40d Mon Sep 17 00:00:00 2001 From: Scarlett Moore Date: Thu, 16 Feb 2023 10:16:59 -0700 Subject: [PATCH 48/50] kde-neon-extension: fix pythonpath. --- tests/unit/extensions/test_kde_neon.py | 36 ++++++++++++-------------- 1 file changed, 16 insertions(+), 20 deletions(-) diff --git a/tests/unit/extensions/test_kde_neon.py b/tests/unit/extensions/test_kde_neon.py index d849c497cd..5fd3fa1487 100644 --- a/tests/unit/extensions/test_kde_neon.py +++ b/tests/unit/extensions/test_kde_neon.py @@ -230,16 +230,14 @@ def assert_get_part_snippet(kde_neon_instance): + "${ACLOCAL_PATH:+:$ACLOCAL_PATH}" }, { - "PYTHONPATH": ( - [ - "/snap/kde-frameworks-5-102-qt-5-15-8-core22-sd/current/" - + "usr/lib/python3.10", - "/snap/kde-frameworks-5-102-qt-5-15-8-core22-sd/current/" - + "usr/lib/python3/dist-packages", - "/snap/kde-frameworks-5-102-qt-5-15-8-core22-sd/current/" - + "usr/lib/$CRAFT_ARCH_TRIPLET", - "/gobject-introspection", - ] + "PYTHONPATH": ":".join( + "/snap/kde-frameworks-5-102-qt-5-15-8-core22-sd/current/" + + "usr/lib/python3.10", + "/snap/kde-frameworks-5-102-qt-5-15-8-core22-sd/current/" + + "usr/lib/python3/dist-packages", + "/snap/kde-frameworks-5-102-qt-5-15-8-core22-sd/current/" + + "usr/lib/$CRAFT_ARCH_TRIPLET", + "/gobject-introspection", ) + "${PYTHONPATH:+:$PYTHONPATH}" }, @@ -309,16 +307,14 @@ def test_get_part_snippet_with_external_sdk(kde_neon_extension_with_build_snap): + "${ACLOCAL_PATH:+:$ACLOCAL_PATH}" }, { - "PYTHONPATH": ( - [ - "/snap/kde-frameworks-5-102-qt-5-15-8-core22-sd/current/" - + "usr/lib/python3.10", - "/snap/kde-frameworks-5-102-qt-5-15-8-core22-sd/current/" - + "usr/lib/python3/dist-packages", - "/snap/kde-frameworks-5-102-qt-5-15-8-core22-sd/current/" - + "usr/lib/$CRAFT_ARCH_TRIPLET", - "/gobject-introspection", - ] + "PYTHONPATH": ":".join( + "/snap/kde-frameworks-5-102-qt-5-15-8-core22-sd/current/" + + "usr/lib/python3.10", + "/snap/kde-frameworks-5-102-qt-5-15-8-core22-sd/current/" + + "usr/lib/python3/dist-packages", + "/snap/kde-frameworks-5-102-qt-5-15-8-core22-sd/current/" + + "usr/lib/$CRAFT_ARCH_TRIPLET", + "/gobject-introspection", ) + "${PYTHONPATH:+:$PYTHONPATH}" }, From 366f15eb1eb545e2c44c74239bb59bd577802cf8 Mon Sep 17 00:00:00 2001 From: Scarlett Moore Date: Thu, 16 Feb 2023 10:39:52 -0700 Subject: [PATCH 49/50] kde-neon-extension:use join for pythonpath. --- tests/unit/extensions/test_kde_neon.py | 44 ++++++++++++++------------ 1 file changed, 24 insertions(+), 20 deletions(-) diff --git a/tests/unit/extensions/test_kde_neon.py b/tests/unit/extensions/test_kde_neon.py index 5fd3fa1487..bfaeedfff3 100644 --- a/tests/unit/extensions/test_kde_neon.py +++ b/tests/unit/extensions/test_kde_neon.py @@ -231,22 +231,24 @@ def assert_get_part_snippet(kde_neon_instance): }, { "PYTHONPATH": ":".join( - "/snap/kde-frameworks-5-102-qt-5-15-8-core22-sd/current/" - + "usr/lib/python3.10", - "/snap/kde-frameworks-5-102-qt-5-15-8-core22-sd/current/" - + "usr/lib/python3/dist-packages", - "/snap/kde-frameworks-5-102-qt-5-15-8-core22-sd/current/" - + "usr/lib/$CRAFT_ARCH_TRIPLET", - "/gobject-introspection", + [ + "/snap/kde-frameworks-5-102-qt-5-15-8-core22-sd/current/" + + "usr/lib/python3.10", + "/snap/kde-frameworks-5-102-qt-5-15-8-core22-sd/current/" + + "usr/lib/python3/dist-packages", + "/snap/kde-frameworks-5-102-qt-5-15-8-core22-sd/current/" + + "usr/lib/$CRAFT_ARCH_TRIPLET", + "/gobject-introspection", + ] ) + "${PYTHONPATH:+:$PYTHONPATH}" }, - # { - # "SNAPCRAFT_CMAKE_ARGS": ( - # "-DCMAKE_FIND_ROOT_PATH=" - # + "/snap/kde-frameworks-5-102-qt-5-15-8-core22-sd/current" - # ) - # }, + { + "SNAPCRAFT_CMAKE_ARGS": ( + "-DCMAKE_FIND_ROOT_PATH=" + + "/snap/kde-frameworks-5-102-qt-5-15-8-core22-sd/current" + ) + }, ] } @@ -308,13 +310,15 @@ def test_get_part_snippet_with_external_sdk(kde_neon_extension_with_build_snap): }, { "PYTHONPATH": ":".join( - "/snap/kde-frameworks-5-102-qt-5-15-8-core22-sd/current/" - + "usr/lib/python3.10", - "/snap/kde-frameworks-5-102-qt-5-15-8-core22-sd/current/" - + "usr/lib/python3/dist-packages", - "/snap/kde-frameworks-5-102-qt-5-15-8-core22-sd/current/" - + "usr/lib/$CRAFT_ARCH_TRIPLET", - "/gobject-introspection", + [ + "/snap/kde-frameworks-5-102-qt-5-15-8-core22-sd/current/" + + "usr/lib/python3.10", + "/snap/kde-frameworks-5-102-qt-5-15-8-core22-sd/current/" + + "usr/lib/python3/dist-packages", + "/snap/kde-frameworks-5-102-qt-5-15-8-core22-sd/current/" + + "usr/lib/$CRAFT_ARCH_TRIPLET", + "/gobject-introspection", + ] ) + "${PYTHONPATH:+:$PYTHONPATH}" }, From dc7160f0b35429b59e1b2cc8c63107b79885dac6 Mon Sep 17 00:00:00 2001 From: Sergio Schvezov Date: Thu, 16 Feb 2023 15:54:17 -0300 Subject: [PATCH 50/50] update tests, remove uneeded exports - remove PYTHONPATH, it is not in the SDK - GETTEXT is also not in the SDK - Simplify string operations Signed-off-by: Sergio Schvezov --- snapcraft/extensions/kde_neon.py | 21 +--- tests/unit/extensions/test_kde_neon.py | 132 +++++++++---------------- 2 files changed, 49 insertions(+), 104 deletions(-) diff --git a/snapcraft/extensions/kde_neon.py b/snapcraft/extensions/kde_neon.py index 4cc4603ebe..dfd61366bf 100644 --- a/snapcraft/extensions/kde_neon.py +++ b/snapcraft/extensions/kde_neon.py @@ -199,14 +199,6 @@ def get_part_snippet(self) -> Dict[str, Any]: ], ), }, - # { - # "GETTEXTDATADIRS": prepend_to_env( - # "GETTEXTDATADIRS", - # [ - # f"/snap/{sdk_snap}/current/usr/share/gettext-current", - # ], - # ), - # }, { "ACLOCAL_PATH": prepend_to_env( "ACLOCAL_PATH", @@ -215,22 +207,11 @@ def get_part_snippet(self) -> Dict[str, Any]: ], ), }, - { - "PYTHONPATH": prepend_to_env( - "PYTHONPATH", - [ - f"/snap/{sdk_snap}/current/usr/lib/python3.10", - f"/snap/{sdk_snap}/current/usr/lib/python3/dist-packages", - f"/snap/{sdk_snap}/current/usr/lib/$CRAFT_ARCH_TRIPLET" - "/gobject-introspection", - ], - ), - }, { "SNAPCRAFT_CMAKE_ARGS": prepend_to_env( "SNAPCRAFT_CMAKE_ARGS", [ - f"{cmake_args}", + cmake_args, ], ), }, diff --git a/tests/unit/extensions/test_kde_neon.py b/tests/unit/extensions/test_kde_neon.py index bfaeedfff3..57add69535 100644 --- a/tests/unit/extensions/test_kde_neon.py +++ b/tests/unit/extensions/test_kde_neon.py @@ -177,8 +177,10 @@ def assert_get_part_snippet(kde_neon_instance): assert kde_neon_instance.get_part_snippet() == { "build-environment": [ { - "PATH": "/snap/kde-frameworks-5-102-qt-5-15-8-core22-sd/current/" - + "usr/bin${PATH:+:$PATH}" + "PATH": ( + "/snap/kde-frameworks-5-102-qt-5-15-8-core22-sd/current/" + "usr/bin${PATH:+:$PATH}" + ) }, { "XDG_DATA_DIRS": ( @@ -191,15 +193,15 @@ def assert_get_part_snippet(kde_neon_instance): "LD_LIBRARY_PATH": ":".join( [ "/snap/kde-frameworks-5-102-qt-5-15-8-core22-sd/current/" - + "lib/$CRAFT_ARCH_TRIPLET", + "lib/$CRAFT_ARCH_TRIPLET", "/snap/kde-frameworks-5-102-qt-5-15-8-core22-sd/current/" - + "usr/lib/$CRAFT_ARCH_TRIPLET", + "usr/lib/$CRAFT_ARCH_TRIPLET", "/snap/kde-frameworks-5-102-qt-5-15-8-core22-sd/current/" - + "usr/lib", + "usr/lib", "/snap/kde-frameworks-5-102-qt-5-15-8-core22-sd/current/" - + "usr/lib/vala-current", + "usr/lib/vala-current", "/snap/kde-frameworks-5-102-qt-5-15-8-core22-sd/current/" - + "usr/lib/$CRAFT_ARCH_TRIPLET/pulseaudio", + "usr/lib/$CRAFT_ARCH_TRIPLET/pulseaudio", ] ) + "${LD_LIBRARY_PATH:+:$LD_LIBRARY_PATH}" @@ -207,46 +209,26 @@ def assert_get_part_snippet(kde_neon_instance): { "PKG_CONFIG_PATH": ( "/snap/kde-frameworks-5-102-qt-5-15-8-core22-sd/current/" - + "usr/lib/$CRAFT_ARCH_TRIPLET/pkgconfig:" + "usr/lib/$CRAFT_ARCH_TRIPLET/pkgconfig:" "/snap/kde-frameworks-5-102-qt-5-15-8-core22-sd/current/" - + "usr/lib/pkgconfig:" + "usr/lib/pkgconfig:" "/snap/kde-frameworks-5-102-qt-5-15-8-core22-sd/current/" - + "usr/share/pkgconfig" + "usr/share/pkgconfig" ) + "${PKG_CONFIG_PATH:+:$PKG_CONFIG_PATH}" }, - # { - # "GETTEXTDATADIRS": ( - # "/snap/kde-frameworks-5-102-qt-5-15-8-core22-sd/current/" - # + "usr/share/gettext-current" - # ) - # + "${GETTEXTDATADIRS:+:$GETTEXTDATADIRS}" - # }, { "ACLOCAL_PATH": ( "/snap/kde-frameworks-5-102-qt-5-15-8-core22-sd/current/" - + "usr/share/aclocal" - ) - + "${ACLOCAL_PATH:+:$ACLOCAL_PATH}" - }, - { - "PYTHONPATH": ":".join( - [ - "/snap/kde-frameworks-5-102-qt-5-15-8-core22-sd/current/" - + "usr/lib/python3.10", - "/snap/kde-frameworks-5-102-qt-5-15-8-core22-sd/current/" - + "usr/lib/python3/dist-packages", - "/snap/kde-frameworks-5-102-qt-5-15-8-core22-sd/current/" - + "usr/lib/$CRAFT_ARCH_TRIPLET", - "/gobject-introspection", - ] + "usr/share/aclocal" ) - + "${PYTHONPATH:+:$PYTHONPATH}" + + "${ACLOCAL_PATH:+:$ACLOCAL_PATH}" }, { "SNAPCRAFT_CMAKE_ARGS": ( "-DCMAKE_FIND_ROOT_PATH=" - + "/snap/kde-frameworks-5-102-qt-5-15-8-core22-sd/current" + "/snap/kde-frameworks-5-102-qt-5-15-8-core22-sd/current" + "${SNAPCRAFT_CMAKE_ARGS:+:$SNAPCRAFT_CMAKE_ARGS}" ) }, ] @@ -257,28 +239,30 @@ def test_get_part_snippet_with_external_sdk(kde_neon_extension_with_build_snap): assert kde_neon_extension_with_build_snap.get_part_snippet() == { "build-environment": [ { - "PATH": "/snap/kde-frameworks-5-102-qt-5-15-8-core22-sd/current/" - + "usr/bin${PATH:+:$PATH}" + "PATH": ( + "/snap/kde-frameworks-5-102-qt-5-15-8-core22-sd/current/" + "usr/bin${PATH:+:$PATH}" + ) }, { "XDG_DATA_DIRS": ( "$SNAPCRAFT_STAGE/usr/share:/snap/kde-frameworks-5-102-qt-5-15-8-core22-sd" - + "/current/usr/share:/usr/share${XDG_DATA_DIRS:+:$XDG_DATA_DIRS}" + "/current/usr/share:/usr/share${XDG_DATA_DIRS:+:$XDG_DATA_DIRS}" ) }, { "LD_LIBRARY_PATH": ":".join( [ "/snap/kde-frameworks-5-102-qt-5-15-8-core22-sd/current/" - + "lib/$CRAFT_ARCH_TRIPLET", + "lib/$CRAFT_ARCH_TRIPLET", "/snap/kde-frameworks-5-102-qt-5-15-8-core22-sd/current/" - + "usr/lib/$CRAFT_ARCH_TRIPLET", + "usr/lib/$CRAFT_ARCH_TRIPLET", "/snap/kde-frameworks-5-102-qt-5-15-8-core22-sd/current/" - + "usr/lib", + "usr/lib", "/snap/kde-frameworks-5-102-qt-5-15-8-core22-sd/current/" - + "usr/lib/vala-current", + "usr/lib/vala-current", "/snap/kde-frameworks-5-102-qt-5-15-8-core22-sd/current/" - + "usr/lib/$CRAFT_ARCH_TRIPLET/pulseaudio", + "usr/lib/$CRAFT_ARCH_TRIPLET/pulseaudio", ] ) + "${LD_LIBRARY_PATH:+:$LD_LIBRARY_PATH}" @@ -286,46 +270,26 @@ def test_get_part_snippet_with_external_sdk(kde_neon_extension_with_build_snap): { "PKG_CONFIG_PATH": ( "/snap/kde-frameworks-5-102-qt-5-15-8-core22-sd/current/" - + "usr/lib/$CRAFT_ARCH_TRIPLET/pkgconfig:" + "usr/lib/$CRAFT_ARCH_TRIPLET/pkgconfig:" "/snap/kde-frameworks-5-102-qt-5-15-8-core22-sd/current/" - + "usr/lib/pkgconfig:" + "usr/lib/pkgconfig:" "/snap/kde-frameworks-5-102-qt-5-15-8-core22-sd/current/" - + "usr/share/pkgconfig" + "usr/share/pkgconfig" ) + "${PKG_CONFIG_PATH:+:$PKG_CONFIG_PATH}" }, - # { - # "GETTEXTDATADIRS": ( - # "/snap/kde-frameworks-5-102-qt-5-15-8-core22-sd/current/" - # + "usr/share/gettext-current" - # ) - # + "${GETTEXTDATADIRS:+:$GETTEXTDATADIRS}" - # }, { "ACLOCAL_PATH": ( "/snap/kde-frameworks-5-102-qt-5-15-8-core22-sd/current/" - + "usr/share/aclocal" + "usr/share/aclocal" ) + "${ACLOCAL_PATH:+:$ACLOCAL_PATH}" }, - { - "PYTHONPATH": ":".join( - [ - "/snap/kde-frameworks-5-102-qt-5-15-8-core22-sd/current/" - + "usr/lib/python3.10", - "/snap/kde-frameworks-5-102-qt-5-15-8-core22-sd/current/" - + "usr/lib/python3/dist-packages", - "/snap/kde-frameworks-5-102-qt-5-15-8-core22-sd/current/" - + "usr/lib/$CRAFT_ARCH_TRIPLET", - "/gobject-introspection", - ] - ) - + "${PYTHONPATH:+:$PYTHONPATH}" - }, { "SNAPCRAFT_CMAKE_ARGS": ( "-DCMAKE_FIND_ROOT_PATH=" - + "/snap/kde-frameworks-5-102-qt-5-15-8-core22-sd/current" + "/snap/kde-frameworks-5-102-qt-5-15-8-core22-sd/current" + "${SNAPCRAFT_CMAKE_ARGS:+:$SNAPCRAFT_CMAKE_ARGS}" ) }, ] @@ -343,7 +307,7 @@ def test_get_parts_snippet(kde_neon_extension): "make-parameters": ["PLATFORM_PLUG=kde-frameworks-5-102-qt-5-15-8-core22"], "build-packages": ["g++"], "build-snaps": ["kde-frameworks-5-102-qt-5-15-8-core22-sd/current/stable"], - } + } } @@ -367,19 +331,19 @@ def test_get_parts_snippet_with_external_sdk_different_channel( ): source = get_extensions_data_dir() / "desktop" / "command-chain" assert ( - kde_neon_extension_with_default_build_snap_from_latest_edge.get_parts_snippet() - == { - "kde-neon-extension/sdk": { - "source": str(source), - "source-subdir": "kde-neon", - "plugin": "make", - "make-parameters": [ - "PLATFORM_PLUG=kde-frameworks-5-102-qt-5-15-8-core22" - ], - "build-packages": ["g++"], - "build-snaps": [ - "kde-frameworks-5-102-qt-5-15-8-core22-sd/current/stable" - ], - } - } + kde_neon_extension_with_default_build_snap_from_latest_edge.get_parts_snippet() + == { + "kde-neon-extension/sdk": { + "source": str(source), + "source-subdir": "kde-neon", + "plugin": "make", + "make-parameters": [ + "PLATFORM_PLUG=kde-frameworks-5-102-qt-5-15-8-core22" + ], + "build-packages": ["g++"], + "build-snaps": [ + "kde-frameworks-5-102-qt-5-15-8-core22-sd/current/stable" + ], + } + } )