Amulet-Team / Amulet-Map-Editor

A new Minecraft world editor and converter that supports all versions since Java 1.12 and Bedrock 1.7.
https://www.amuletmc.com/
1.73k stars 122 forks source link

Distrobute Amulet as a flatpak #525

Open GamzeeRakoon opened 2 years ago

GamzeeRakoon commented 2 years ago

Is your feature request related to a problem? Please describe. its very annoying to install Amulet on linux without using the terminal and it taking a very long time to compile, with a flatpak you it will be very easy to install Amulet and you wont need to worry about what distro someone is using because flatpaks work on almost all populair distros see https://flatpak.org/setup/

Describe the solution you'd like add an Amulet as an Flatpak https://github.com/flathub/flathub/wiki/App-Submission

Describe alternatives you've considered provide an .deb and or .rpm file which are both distro limited but better then nothing

oneechanhax commented 2 years ago

I made a very simple build script. It doesn't do proper build sandboxing but I did it mainly for .file/general clutter containment and sandboxing. Build at your own risk!!! You may try flatpak-pip-generator but I had issues around numpy being weird with amulet-nbt so I gave up with the sandboxing.

$ cat com.amulet.AmuletMC.json
{
    "app-id": "com.amulet.AmuletMC",
    "runtime": "org.freedesktop.Platform",
    "runtime-version": "21.08",
    "sdk": "org.freedesktop.Sdk",
    "command": "amuletmc-flatpak-entry.sh",
    "finish-args": [
        "--socket=x11",
        "--socket=wayland",
        "--device=dri",
        "--filesystem=~/.minecraft/saves",
        "--filesystem=~/.var/app/org.polymc.PolyMC/data/polymc/instances"
    ],
    "modules": [{
        "name": "python3-amulet-map-editor",
        "buildsystem": "simple",
        "build-commands": [
           "pip3 install --verbose --prefix=/app amulet-map-editor"
        ],
        "build-options": {
           "build-args": [ "--share=network" ]
        },
        "sources": []
    }, {
        "name": "amuletmc-flatpak-entry",
        "buildsystem": "simple",
        "build-commands": [
            "install -D amuletmc-flatpak-entry.sh /app/bin/amuletmc-flatpak-entry.sh"
        ],
        "sources": [{
            "type": "file",
            "path": "amuletmc-flatpak-entry.sh"
        }]
    }]
}
$ cat amuletmc-flatpak-entry.sh
#!/bin/bash
export PYTHONPATH="/app"

python3 -m amulet_map_editor

Ran with flatpak-builder --user --install --force-clean tmp/ com.amulet.AmuletMC.json GPL3 pls

Also, Im not sure if the install script is broken, permissions, or my gpu but I do get an error when the 3d editor is opened. Could be how its installed to a nonstandard folder but I don't know much about how python likes its file layouts with pip.

<class 'wx._glcanvas.GLAttributes'> returned a result with an error set
NotImplementedError

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
  File "/app/lib/python3.9/site-packages/amulet_map_editor/api/framework/pages/world_page.py", line 155, in _enable_active
    self._extensions[self.GetSelection()].enable()
  File "/app/lib/python3.9/site-packages/amulet_map_editor/programs/edit/edit.py", line 50, in enable
    self._canvas = EditCanvas(self, self._world, self._close_self_callback)
  File "/app/lib/python3.9/site-packages/amulet_map_editor/programs/edit/api/canvas/edit_canvas.py", line 92, in __init__
    super().__init__(parent, world)
  File "/app/lib/python3.9/site-packages/amulet_map_editor/programs/edit/api/canvas/base_edit_canvas.py", line 58, in __init__
    super().__init__(parent)
  File "/app/lib/python3.9/site-packages/amulet_map_editor/api/opengl/canvas/event_canvas.py", line 12, in __init__
    super().__init__(parent)
  File "/app/lib/python3.9/site-packages/amulet_map_editor/api/opengl/canvas/canvas.py", line 23, in __init__
    display_attributes = wx.glcanvas.GLAttributes()
SystemError: <class 'wx._glcanvas.GLAttributes'> returned a result with an error set

/app/bin/amuletmc-flatpak-entry.sh: line 4:     3 Segmentation fault      (core dumped) python3 -m amulet_map_editor
kargaroc commented 1 year ago

This is sorely needed on systems where the bundled python interpreter is too new

PixelRave commented 1 year ago

Having a flatpak would make this much easier to distribute to Linux. On top of automatic updates. It would be a no brainier to use.

gentlegiantJGC commented 1 year ago

We are in the process of rebuilding Amulet in Qt (a different UI library) and I will implement this there. We are not currently implementing new functionality for the current Amulet implementation.

We have this which should be able to make these files https://github.com/Amulet-Team/python-build-tool

nl255 commented 8 months ago

Having a flatpak would also make it much easier to run on the Steam Deck.

JakobDev commented 7 months ago

Any news on this?

I have experience in Flatpak, so I can help you, if you want.

nl255 commented 7 months ago

I will say that I was unable to install this normally on the Steam Deck at all since it requires so many packages (gcc, all sorts of headers and -dev library packages, etc) to be installed that I eventually gave up even after disabling the read only filesystem and installing a bunch of stuff with pacman.

Xalalau commented 6 months ago

I made a very simple build script. It doesn't do proper build sandboxing but I did it mainly for .file/general clutter containment and sandboxing. Build at your own risk!!! You may try flatpak-pip-generator but I had issues around numpy being weird with amulet-nbt so I gave up with the sandboxing.

$ cat com.amulet.AmuletMC.json
{
    "app-id": "com.amulet.AmuletMC",
    "runtime": "org.freedesktop.Platform",
    "runtime-version": "21.08",
    "sdk": "org.freedesktop.Sdk",
    "command": "amuletmc-flatpak-entry.sh",
    "finish-args": [
        "--socket=x11",
        "--socket=wayland",
        "--device=dri",
        "--filesystem=~/.minecraft/saves",
        "--filesystem=~/.var/app/org.polymc.PolyMC/data/polymc/instances"
    ],
    "modules": [{
        "name": "python3-amulet-map-editor",
        "buildsystem": "simple",
        "build-commands": [
           "pip3 install --verbose --prefix=/app amulet-map-editor"
        ],
        "build-options": {
           "build-args": [ "--share=network" ]
        },
        "sources": []
    }, {
        "name": "amuletmc-flatpak-entry",
        "buildsystem": "simple",
        "build-commands": [
            "install -D amuletmc-flatpak-entry.sh /app/bin/amuletmc-flatpak-entry.sh"
        ],
        "sources": [{
            "type": "file",
            "path": "amuletmc-flatpak-entry.sh"
        }]
    }]
}
$ cat amuletmc-flatpak-entry.sh
#!/bin/bash
export PYTHONPATH="/app"

python3 -m amulet_map_editor

Ran with flatpak-builder --user --install --force-clean tmp/ com.amulet.AmuletMC.json GPL3 pls

Also, Im not sure if the install script is broken, permissions, or my gpu but I do get an error when the 3d editor is opened. Could be how its installed to a nonstandard folder but I don't know much about how python likes its file layouts with pip.

<class 'wx._glcanvas.GLAttributes'> returned a result with an error set
NotImplementedError

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
  File "/app/lib/python3.9/site-packages/amulet_map_editor/api/framework/pages/world_page.py", line 155, in _enable_active
    self._extensions[self.GetSelection()].enable()
  File "/app/lib/python3.9/site-packages/amulet_map_editor/programs/edit/edit.py", line 50, in enable
    self._canvas = EditCanvas(self, self._world, self._close_self_callback)
  File "/app/lib/python3.9/site-packages/amulet_map_editor/programs/edit/api/canvas/edit_canvas.py", line 92, in __init__
    super().__init__(parent, world)
  File "/app/lib/python3.9/site-packages/amulet_map_editor/programs/edit/api/canvas/base_edit_canvas.py", line 58, in __init__
    super().__init__(parent)
  File "/app/lib/python3.9/site-packages/amulet_map_editor/api/opengl/canvas/event_canvas.py", line 12, in __init__
    super().__init__(parent)
  File "/app/lib/python3.9/site-packages/amulet_map_editor/api/opengl/canvas/canvas.py", line 23, in __init__
    display_attributes = wx.glcanvas.GLAttributes()
SystemError: <class 'wx._glcanvas.GLAttributes'> returned a result with an error set

/app/bin/amuletmc-flatpak-entry.sh: line 4:     3 Segmentation fault      (core dumped) python3 -m amulet_map_editor

The SystemError: <class 'wx._glcanvas.GLAttributes'> returned a result with an error set issue was solved here: https://github.com/Amulet-Team/Amulet-Map-Editor/issues/449

bokov commented 3 weeks ago

We are in the process of rebuilding Amulet in Qt (a different UI library) and I will implement this there. We are not currently implementing new functionality for the current Amulet implementation.

We have this which should be able to make these files https://github.com/Amulet-Team/python-build-tool

Sorry for being dense and needing things spelled out. I'm not used to dealing with multiple versions of Python.

Is the current workaround to follow the steps in https://github.com/Amulet-Team/Amulet-Map-Editor/issues/525#issuecomment-1013959025 ? If so, how does the python-build-tool fit into this?

Or do you recommend downloading the latest development snapshot of your QT version? If so, which repo/branch is that?

Thank you.

gentlegiantJGC commented 3 weeks ago

Check out #1070