Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

desktop: stop renaming desktop file #5150

Open
wants to merge 1 commit into
base: feature/desktop-files
Choose a base branch
from

Conversation

soumyaDghosh
Copy link
Contributor

With snapd 2.66, it supports custom desktop file names. This patch allows it to happen from snapcraft side.

  • Have you followed the guidelines for contributing?
  • Have you signed the CLA?
  • Have you successfully run tox run -m lint?
  • Have you successfully run tox run -e test-py310? (supported versions: py39, py310, py311, py312)

@soumyaDghosh soumyaDghosh force-pushed the stop-rename-desktop-file branch from dffe5e6 to af19add Compare November 22, 2024 19:33
Copy link
Collaborator

@mr-cal mr-cal left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do you know what effect this will have when running a snap on a system with snapd<2.66?

@soumyaDghosh
Copy link
Contributor Author

Do you know what effect this will have when running a snap on a system with snapd<2.66?

As I tested before, snapd will install the file with a <snap_name>, which snapd will do here also if the desktop file names aren't explicitly mentioned before hand. It was never really an issue to fix with.

@soumyaDghosh
Copy link
Contributor Author

I think I'll need to fix the spread tests too.

@soumyaDghosh soumyaDghosh force-pushed the stop-rename-desktop-file branch from af19add to 32dea06 Compare November 22, 2024 21:38
Copy link

codecov bot commented Nov 22, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Please upload report for BASE (feature/desktop-files@c7d11ac). Learn more about missing BASE report.

Additional details and impacted files
@@                   Coverage Diff                    @@
##             feature/desktop-files    #5150   +/-   ##
========================================================
  Coverage                         ?   89.71%           
========================================================
  Files                            ?      342           
  Lines                            ?    22641           
  Branches                         ?        0           
========================================================
  Hits                             ?    20312           
  Misses                           ?     2329           
  Partials                         ?        0           

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.


🚨 Try these New Features:

@soumyaDghosh soumyaDghosh force-pushed the stop-rename-desktop-file branch 2 times, most recently from 7b7c0d5 to 2883282 Compare November 23, 2024 05:17
With snapd 2.66, it supports custom desktop file names. This patch allows it to happen from snapcraft side.
@soumyaDghosh soumyaDghosh force-pushed the stop-rename-desktop-file branch from 2883282 to 99f4e85 Compare November 23, 2024 05:23
@soumyaDghosh soumyaDghosh requested a review from mr-cal November 23, 2024 05:27
@mr-cal mr-cal changed the base branch from main to feature/desktop-files November 25, 2024 15:44
Copy link
Collaborator

@mr-cal mr-cal left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

After discussing during the Starcraft clinic, this should be a safe change to make. The only environment that wouldn't locate these new files is unity 8.

Approving to land in a feature branch so it can be published and tested before landing on main. Landing on main will require a new PR and approvals.

@mr-cal mr-cal requested a review from a team November 25, 2024 15:48
target = gui_dir / f"{self._app_name}.desktop"
desktop_filename = os.path.basename(self._filename)

# Stop renaming the desktop file. From snapd 2.66 onwards,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this comment is very good, but I think we should drop the first sentence - it's awkward and potentially confusing to refer to something the code no longer does

# in the format of {SNAP_NAME}_{APP_NAME}.desktop
# https://snapcraft.io/docs/desktop-interface
target = gui_dir / desktop_filename
if not (desktop_filename.endswith(".desktop")):
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

you can replace this code with a with_suffix(".desktop") call

>>> Path("file").with_suffix(".desktop")
PosixPath('file.desktop')
>>> Path("file.desktop").with_suffix(".desktop")
PosixPath('file.desktop')


prime_dir = Path(f"{new_dir}/meta/gui")

yield prime_dir
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
yield prime_dir
return prime_dir

@soumyaDghosh
Copy link
Contributor Author

This PR has a blocker

  • snap store frontend still doesn't understand the desktop-file-ids attribute

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants