Skip to content

Commit

Permalink
snap: remove hardcoded paths for snap
Browse files Browse the repository at this point in the history
  • Loading branch information
soumyaDghosh committed Jan 15, 2024
1 parent 5509026 commit 5299834
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 13 deletions.
2 changes: 1 addition & 1 deletion meson.build
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ subdir('po')



install_subdir('data/weather_icons', install_dir: '/app/share/icons/hicolor/scalable')
install_subdir('data/weather_icons', install_dir: get_option('datadir') / 'icons/hicolor/scalable')

gnome.post_install(
glib_compile_schemas: true,
Expand Down
15 changes: 4 additions & 11 deletions snap/snapcraft.yaml
Original file line number Diff line number Diff line change
@@ -1,33 +1,26 @@
name: mousam # you probably want to 'snapcraft register <name>'
base: core22 # the base snap is the execution environment for this snap
name: mousam
base: core22
adopt-info: mousam
grade: stable # must be 'stable' to release into candidate/stable channels
confinement: strict # use 'strict' once you have the right plugs and slots
grade: stable
confinement: strict
architectures:
- build-on: amd64
- build-on: arm64
- build-on: armhf
parts:
mousam:
# See 'snapcraft plugins'
plugin: meson
source: https://github.com/amit9838/weather.git
#source-tag: 'v1.0.0'
meson-parameters: [ --prefix=/snap/mousam/current/usr ]
override-pull: |
craftctl default
patch -p1 < $CRAFT_PROJECT_DIR/snap/mousam.patch
pip install --prefix=$CRAFT_PART_INSTALL/usr requests==2.30.0
override-build: |
craftctl default
chmod +x $CRAFT_PART_INSTALL/snap/mousam/current/usr/bin/weather
sed -e '1c#!/usr/bin/python3' -i $CRAFT_PART_INSTALL/usr/local/bin/*
sed -e '1c#!/usr/bin/env python3' -i ${CRAFT_PART_INSTALL}/snap/mousam/current/usr/bin/weather
mkdir -p $CRAFT_PART_INSTALL/meta/gui
cp -r $CRAFT_PART_INSTALL/snap/mousam/current/usr/share/icons $CRAFT_PART_INSTALL/meta/gui/
for i in `find $CRAFT_PART_INSTALL/meta/gui/icons -name "*.svg" -o -name "*.png"`; do
mv $i "`dirname $i`/snap.$CRAFT_PROJECT_NAME.`basename $i`"
done
parse-info: [ usr/share/appdata/io.github.amit9838.weather.appdata.xml ]
organize:
snap/mousam/current: .
Expand Down
3 changes: 2 additions & 1 deletion src/constants.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
icon_loc = "/app/share/icons/hicolor/scalable/weather_icons/"
import os
icon_loc = "/app/share/icons/hicolor/scalable/weather_icons/" if not os.getenv('SNAP') else f"{os.getenv('SNAP')}/usr/share/icons/hicolor/scalable/weather_icons/"

icons = {
"0": icon_loc + "clear-day.svg",
Expand Down

0 comments on commit 5299834

Please sign in to comment.