Skip to content

Commit

Permalink
chore(merge): 7.5.6 into merge/7.5.6
Browse files Browse the repository at this point in the history
Signed-off-by: Callahan Kovacs <[email protected]>
  • Loading branch information
mr-cal committed Aug 16, 2024
2 parents b6e647c + 654871d commit 1b97ef7
Show file tree
Hide file tree
Showing 3 changed files with 23 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
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 1b97ef7

Please sign in to comment.