Skip to content

Commit

Permalink
Feature: Linux users could not run Mu using Flatpak
Browse files Browse the repository at this point in the history
Solution: Add a manifest file for flatpak-builder

Known issues:
- Icon does not display correctly on my KDE desktop
- Mu does not detect device vendor and properties, failing to connect via serial (overriding the code makes it work).
  • Loading branch information
hoh committed Jul 29, 2022
1 parent 528fac6 commit 8d9148d
Show file tree
Hide file tree
Showing 4 changed files with 127 additions and 0 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ var/
*.egg-info/
.installed.cfg
*.egg
.flatpak-builder

# Bluemix vendored packages
vendor/
Expand Down
42 changes: 42 additions & 0 deletions flatpak/mu.codewith.Editor.appdata.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
<?xml version="1.0" encoding="UTF-8"?>
<component type="desktop-application">
<id>mu.codewith.Editor</id>
<metadata_license>CC-BY-SA</metadata_license>
<name>Mu Editor</name>
<summary>A simple editor for beginner Python programmers</summary>
<description>
<p>
Mu is a simple code editor for beginner programmers based on extensive feedback from teachers and learners.
Having said that, Mu is for anyone who wants to use a simple "no frills" editor.
</p>
<p>Mu is a modal editor with modes for many different ways to use Python to create cool and interesting things.</p>
<p>
Mu is written in Python and works on Windows, macOS, Linux and Raspberry Pi. The project's public facing website is https://codewith.mu/.
We celebrate the work done by users of mu at https://madewith.mu/.
</p>
</description>
<url type="homepage">https://codewith.mu/</url>
<url type="bugtracker">https://github.com/mu-editor/mu/issues/</url>
<url type="help">https://codewith.mu/en/howto/1.1/</url>
<launchable type="desktop-id">mu.codewith.Editor.desktop</launchable>
<releases>
<release version="1.1.1" date="2022-02-22">
<description>
<p>
This is the first stable release of the 1.1.* version of Mu.
</p>
</description>
</release>
</releases>
<project_license>GPL-3.0-or-later</project_license>
<developer_name>Nicholas H.Tollervey</developer_name>
<screenshots>
<screenshot type="default">
<image type="source">https://codewith.mu/img/en/tutorials/mu_ui.png</image>
</screenshot>
<screenshot>
<image type="source">https://codewith.mu/img/en/tutorials/mode_selector1-1.png</image>
</screenshot>
</screenshots>
<content_rating type="oars-1.1"/>
</component>
10 changes: 10 additions & 0 deletions flatpak/mu.codewith.Editor.desktop
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
[Desktop Entry]
Name=Mu Editor
GenericName=A simple editor for beginner Python programmers
Exec=/app/python-build-standalone/install/bin/mu-editor
Terminal=false
Icon=mu.codewith.Editor
Type=Application
Categories=Development;IDE;
X-Desktop-File-Install-Version=1.1.1
StartupWMClass=mu-editor
74 changes: 74 additions & 0 deletions flatpak/mu.codewith.Editor.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,74 @@
# Build using `flatpak-builder --user --install --force-clean build-dir mu.codewith.Editor.yml`.
# Then run using `flatpak run mu.codewith.Editor`.

app-id: mu.codewith.Editor

runtime: org.freedesktop.Platform
runtime-version: '21.08'
sdk: org.freedesktop.Sdk

command: /app/python-build-standalone/install/bin/mu-editor

finish-args:
- --filesystem=home
# X11/Wayland
- --share=ipc
- --socket=x11
- --socket=wayland
- --device=dri
- --socket=pulseaudio
# Network access for Mu users
- --share=network
# MicroPython devices connect over USB
- --device=all

modules:
# Use python-build-standalone since this is what `pup` uses for Windows and macOS.
# This should make the builds more homogenous across platforms.
- name: python-build-standalone
buildsystem: simple
build-options:
build-args:
- --share=network
build-commands:
- cp -pr . /app/python-build-standalone
sources:
- type: archive
url: https://github.com/indygreg/python-build-standalone/releases/download/20220630/cpython-3.8.13+20220630-x86_64-unknown-linux-gnu-lto-full.tar.zst
sha256: 217fd3deccdc59e074800a2d90ea9176395d1630e1e24f84c062e6d5bf3e03a3

- name: mu
buildsystem: simple
build-options:
build-args:
- --share=network
build-commands:
- /app/python-build-standalone/install/bin/pip install --upgrade pip
- /app/python-build-standalone/install/bin/pip install .
- /app/python-build-standalone/install/bin/pip install pyserial
# Prefetch wheels used in the user virtual environment.
# Changes directory to `cd /tmp` in order to avoid importing `mu.wheels`
# from the git repository.
- cd /tmp && /app/python-build-standalone/install/bin/python3 -m mu.wheels
sources:
- type: archive
url: https://github.com/mu-editor/mu/archive/refs/tags/v1.1.1.tar.gz
sha256: 6ea06d09ba0ed15a2bdd87b62ad1c18a0b1edc7000956209720fcc4ad290458e

- name: desktop-integration
buildsystem: simple
build-options:
build-args:
- --share=network
build-commands:
- install -Dm644 -t /app/share/applications mu.codewith.Editor.desktop
- install -Dm644 -t /app/share/metainfo mu.codewith.Editor.appdata.xml
- install -Dm644 -t /app/share/icons/hicolor/scalable/apps mu.codewith.Editor.svg
sources:
- type: file
path: mu.codewith.Editor.desktop
- type: file
path: mu.codewith.Editor.appdata.xml
- type: file
path: mu.codewith.Editor.svg

0 comments on commit 8d9148d

Please sign in to comment.