Skip to content

Commit

Permalink
Fix linux installer (#58)
Browse files Browse the repository at this point in the history
* Split up pyinstaller hooks

Add linux shared object libraries

* Added debug output

* Fixed glob

* Removed print statements

* print amulet_editor hidden imports

For some reason on linux a singular module is not being included

* Added debug output in build process

* Added libegl to ubuntu

* Reformatted
  • Loading branch information
gentlegiantJGC authored Aug 31, 2023
1 parent 74f5bab commit fa87d18
Show file tree
Hide file tree
Showing 4 changed files with 33 additions and 15 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/python-build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -47,14 +47,14 @@ jobs:
- name: Install Ubuntu dependencies
if: matrix.cfg.os == 'ubuntu-latest'
run: |
sudo apt-get install ruby-dev build-essential
sudo apt-get install ruby-dev build-essential libegl1-mesa libegl1-mesa-dev
sudo gem i fpm -f
- name: Create Installer
run: |
pip install git+https://github.com/Amulet-Team/python-build-tool.git
pip install --upgrade --upgrade-strategy eager -e .
pbt freeze
pbt freeze --debug
pbt installer
- name: Upload Release Asset
Expand Down
7 changes: 7 additions & 0 deletions src/amulet_editor/__pyinstaller/hook-OpenGL.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
from PyInstaller.utils.hooks import (
collect_submodules,
)

hiddenimports = [
*collect_submodules("OpenGL"), # On my linux install not everything was included.
]
17 changes: 17 additions & 0 deletions src/amulet_editor/__pyinstaller/hook-PySide6.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
import glob
import os
from PyInstaller.utils.hooks import (
collect_data_files,
collect_submodules,
)

import PySide6

hiddenimports = collect_submodules("PySide6")
binaries = [
(path, ".")
for path in glob.glob(
os.path.join(glob.escape(PySide6.__path__[0]), "Qt", "lib", "*.so*")
)
]
datas = collect_data_files("PySide6", includes=["*.pyi", "py.typed"])
20 changes: 7 additions & 13 deletions src/amulet_editor/__pyinstaller/hook-amulet_editor.py
Original file line number Diff line number Diff line change
@@ -1,16 +1,10 @@
try:
from PyInstaller.utils.hooks import (
collect_data_files,
copy_metadata,
collect_submodules,
)
except ImportError as e:
raise ImportError(
"This is part of the build pipeline. It cannot be imported at runtime."
) from e
from PyInstaller.utils.hooks import (
collect_data_files,
copy_metadata,
collect_submodules,
)

datas = [
*collect_data_files("PySide6", includes=["*.pyi", "py.typed"]),
*collect_data_files("amulet_editor", excludes=["**/*.ui", "**/*.c", "**/*.pyx"]),
*collect_data_files(
"amulet_editor.plugins",
Expand All @@ -22,6 +16,6 @@

hiddenimports = [
*collect_submodules("amulet_editor", lambda name: name != "amulet_editor.plugins"),
*collect_submodules("PySide6"),
*collect_submodules("OpenGL"), # On my linux install not everything was included.
"PySide6",
"OpenGL",
]

0 comments on commit fa87d18

Please sign in to comment.