-
Notifications
You must be signed in to change notification settings - Fork 448
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 meta: strip ${SNAP} from .desktop icon #2541
Conversation
A lot of snaps are hacking the desktop file of their projects to insert a snap-relative path for their icon of the form `${SNAP}/path/to/icon.png`. The current Appstream implementation does not understand this format so this commit strips the `${SNAP}` from the start of the path if it is present before continuing as before. Signed-off-by: Daniel Llewellyn <daniel@bowlhat.net>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for the fix, could you add a test case for that?
Desktop files might include an icon path definition with a `${SNAP}` prefix. This commit adds a test to ensure that snapcraft correctly handles this scenario. Signed-off-by: Daniel Llewellyn <daniel@bowlhat.net>
Test is added :-) |
Codecov Report
@@ Coverage Diff @@
## master #2541 +/- ##
==========================================
+ Coverage 88.96% 88.97% +<.01%
==========================================
Files 204 204
Lines 13948 13950 +2
Branches 2109 2110 +1
==========================================
+ Hits 12409 12412 +3
+ Misses 1093 1092 -1
Partials 446 446
Continue to review full report at Codecov.
|
Bad spelling: applicatins != applications. Signed-off-by: Daniel Llewellyn <daniel@bowlhat.net>
seems the unit test I added is failing. I guess I still need to do some more work... |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Your test spotted the issue! You can thank them!
Add trailing slash to string to-be-stripped (`${SNAP}/`) in appstream code. Signed-off-by: Daniel Llewellyn <daniel@bowlhat.net>
Return an absolute icon path when stripping `${SNAP}`. Signed-off-by: Daniel Llewellyn <daniel@bowlhat.net>
Co-Authored-By: Sergio Schvezov <sergio.schvezov@canonical.com>
looks like tests are still failing :-( |
The path was not being found previously. Tests highlighted the issue and now I've fixed the function to return the expected values. The tests correctly pass now, and haven't been changed. Signed-off-by: Daniel Llewellyn <daniel@bowlhat.net>
Signed-off-by: Daniel Llewellyn <daniel@bowlhat.net>
- remove extra line accidentally added to `snapcraft/extractors/appstream.py`. - undelete accidentally removed assertion in `tests/unit/test_meta.py` Signed-off-by: Daniel Llewellyn <daniel@bowlhat.net>
Signed-off-by: Daniel Llewellyn <daniel@bowlhat.net>
A lot of snaps are hacking the desktop file of their projects to insert a snap-relative path for their icon of the form `${SNAP}/path/to/icon.png`, ensure this is taken into account while checking if the icon exists. Signed-off-by: Daniel Llewellyn <daniel@bowlhat.net>
A lot of snaps are hacking the desktop file of their projects to insert a snap-relative path for their icon of the form
${SNAP}/path/to/icon.png
. The current .desktop extractor implementation does not understand this format so this commit strips the${SNAP}
from the start of the path if it is present before continuing as before.Signed-off-by: Daniel Llewellyn daniel@bowlhat.net
./runtests.sh static
?./runtests.sh tests/unit
?