Skip to content

Commit

Permalink
chore(merge): 7.5.6 into 'main' (#4979)
Browse files Browse the repository at this point in the history
Bring `7.5.6` into `main` and add release notes.
  • Loading branch information
mr-cal authored Aug 16, 2024
2 parents b6e647c + 037c230 commit 3e83dfd
Show file tree
Hide file tree
Showing 4 changed files with 42 additions and 24 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/cla-check.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ on: [pull_request]

jobs:
cla-check:
runs-on: ubuntu-22.04
runs-on: ubuntu-latest
steps:
- name: Check if CLA signed
uses: canonical/has-signed-canonical-cla@v1
19 changes: 19 additions & 0 deletions docs/reference/changelog.rst
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,24 @@ Changelog
For a complete list of commits, check out the `X.Y.Z`_ release on GitHub.


7.5.6 (2024-Aug-15)
-------------------

Core
====

Bases
#####

core22
""""""

* Fix a regression where icons would not be configured and installed for snaps
with no ``apps`` defined in their ``snapcraft.yaml``.

For a complete list of commits, check out the `7.5.6`_ release on GitHub.


8.3.2 (2024-Aug-05)
-------------------

Expand Down Expand Up @@ -1001,6 +1019,7 @@ For a complete list of commits, check out the `8.0.0`_ release on GitHub.
.. _#4909: https://github.com/canonical/snapcraft/issues/4909
.. _#4942: https://github.com/canonical/snapcraft/issues/4942

.. _7.5.6: https://github.com/canonical/snapcraft/releases/tag/7.5.6
.. _8.0.0: https://github.com/canonical/snapcraft/releases/tag/8.0.0
.. _8.0.1: https://github.com/canonical/snapcraft/releases/tag/8.0.1
.. _8.0.2: https://github.com/canonical/snapcraft/releases/tag/8.0.2
Expand Down
28 changes: 13 additions & 15 deletions snapcraft/parts/setup_assets.py
Original file line number Diff line number Diff line change
Expand Up @@ -78,9 +78,6 @@ def setup_assets(
if kernel_yaml.exists():
_copy_file(kernel_yaml, meta_dir / "kernel.yaml")

if not project.apps:
return

icon_path = _finalize_icon(
project.icon, assets_dir=assets_dir, gui_dir=gui_dir, prime_dir=prime_dir
)
Expand All @@ -93,19 +90,20 @@ def setup_assets(

emit.debug(f"relative icon path: {relative_icon_path!r}")

for app_name, app in project.apps.items():
_validate_command_chain(
app.command_chain, name=f"app {app_name!r}", prime_dir=prime_dir
)

if app.desktop:
desktop_file = DesktopFile(
snap_name=project.name,
app_name=app_name,
filename=app.desktop,
prime_dir=prime_dir,
if project.apps:
for app_name, app in project.apps.items():
_validate_command_chain(
app.command_chain, name=f"app {app_name!r}", prime_dir=prime_dir
)
desktop_file.write(gui_dir=gui_dir, icon_path=relative_icon_path)

if app.desktop:
desktop_file = DesktopFile(
snap_name=project.name,
app_name=app_name,
filename=app.desktop,
prime_dir=prime_dir,
)
desktop_file.write(gui_dir=gui_dir, icon_path=relative_icon_path)


def copy_assets(
Expand Down
17 changes: 9 additions & 8 deletions tests/unit/parts/test_setup_assets.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.

import os
import shutil
import textwrap
from pathlib import Path
Expand Down Expand Up @@ -397,26 +396,28 @@ def test_setup_assets_icon_in_assets_dir(self, desktop_file, yaml_data, new_dir)
)

# icon file exists
Path("prime/snap/gui/icon.svg").is_file()
assert Path("prime/snap/gui/icon.svg").is_file()

def test_setup_assets_no_apps(self, desktop_file, yaml_data, new_dir):
def test_setup_assets_configure_icon_no_apps(
self, desktop_file, yaml_data, new_dir
):
"""Configure icon when no `apps` are defined."""
desktop_file("prime/test.desktop")
Path("prime/usr/share/icons").mkdir(parents=True)
Path("prime/usr/share/icons/icon.svg").touch()
Path("snap/gui").mkdir()
Path("snap/gui").mkdir(parents=True)
Path("snap/gui/icon.svg").touch()

# define project
project = models.Project.unmarshal(yaml_data({"adopt-info": "part"}))

# setting up assets does not crash
setup_assets(
project,
assets_dir=Path("snap"),
project_dir=Path.cwd(),
prime_dirs={None: Path("prime")},
)

assert os.listdir("prime/meta/gui") == []
# icon file exists
assert Path("prime/snap/gui/icon.svg").is_file()

def test_setup_assets_remote_icon(self, desktop_file, yaml_data, new_dir):
# create primed tree (no icon)
Expand Down

0 comments on commit 3e83dfd

Please sign in to comment.