From 7cad0b2658a6ed74698ee2a6f6a0c8924ccf9518 Mon Sep 17 00:00:00 2001 From: wereii <8504482+wereii@users.noreply.github.com> Date: Wed, 16 Mar 2022 20:26:33 +0100 Subject: [PATCH 1/2] AppImage build --- appimage/AppRun | 19 +++++++++ appimage/Makefile | 67 ++++++++++++++++++++++++++++++ appimage/README.md | 19 +++++++++ appimage/org.pyfa.pyfa.appdata.xml | 17 ++++++++ appimage/pyfa | 3 ++ appimage/pyfa.desktop | 7 ++++ requirements.txt | 2 +- 7 files changed, 133 insertions(+), 1 deletion(-) create mode 100644 appimage/AppRun create mode 100644 appimage/Makefile create mode 100644 appimage/README.md create mode 100644 appimage/org.pyfa.pyfa.appdata.xml create mode 100755 appimage/pyfa create mode 100644 appimage/pyfa.desktop diff --git a/appimage/AppRun b/appimage/AppRun new file mode 100644 index 000000000..fbcfb2257 --- /dev/null +++ b/appimage/AppRun @@ -0,0 +1,19 @@ +#! /bin/bash -i + +# Export APPRUN if running from an extracted image +self="$(readlink -f -- $0)" +here="${self%/*}" +APPDIR="${APPDIR:-${here}}" + +# Export TCl/Tk +export TCL_LIBRARY="${APPDIR}/usr/share/tcltk/tcl8.4" +export TK_LIBRARY="${APPDIR}/usr/share/tcltk/tk8.4" +export TKPATH="${TK_LIBRARY}" + +# Export SSL certificate +export SSL_CERT_FILE="${APPDIR}/opt/_internal/certs.pem" + +# Call the entry point +#! /bin/bash -i + +${APPDIR}/usr/bin/pyfa "$@" diff --git a/appimage/Makefile b/appimage/Makefile new file mode 100644 index 000000000..47dc38169 --- /dev/null +++ b/appimage/Makefile @@ -0,0 +1,67 @@ +APPIMAGETOOL:=appimagetool-x86_64.AppImage +APPIMAGETOOL_URL:=https://github.com/AppImage/AppImageKit/releases/download/13/appimagetool-x86_64.AppImage + +PYTHON_APPIMAGE=python3.8.12-cp38-cp38-manylinux2014_x86_64.AppImage +PYTHON_APPIMAGE_URL=https://github.com/niess/python-appimage/releases/download/python3.8/$(PYTHON_APPIMAGE) + +DEPLOY_DIR=AppDir/opt/pyfa + +ROOT_DIR:=$(shell dirname $(realpath $(firstword $(MAKEFILE_LIST)))) +PYFA_DIR:=$(realpath $(ROOT_DIR)/..) +EVE_DB:=$(DEPLOY_DIR)/eve.db + +# Relative to Pyfa/ dir +PROJECT_FILES=README.md LICENSE eos graphs gui imgs locale scripts service staticdata utils version.yml config.py db_update.py pyfa.py +PROJECT_SOURCES=$(patsubst %, $(DEPLOY_DIR)/%, $(PROJECT_FILES)) + +# Just so the final appimage is rebuilt when these change +APPIMAGE_FILES=AppRun org.pyfa.pyfa.appdata.xml pyfa pyfa.desktop +APPIMAGE_SOURCES=$(patsubst %, $(ROOT_DIR)/%, $(APPIMAGE_FILES)) + + +Pyfa-x86_64.AppImage: $(PROJECT_SOURCES) | $(APPIMAGETOOL) static deps $(EVE_DB) + ./$(APPIMAGETOOL) AppDir + +$(EVE_DB): $(PYFA_DIR)/eos $(PYFA_DIR)/db_update.py deps + AppDir/usr/bin/python -s $(DEPLOY_DIR)/db_update.py + +.PHONY: deps +deps: $(DEPLOY_DIR) $(PYFA_DIR)/requirements.txt + AppDir/usr/bin/python -s -m pip install -U pip setuptools wheel + AppDir/usr/bin/python -s -m pip install -r $(PYFA_DIR)/requirements.txt + +.PHONY: static +static: $(DEPLOY_DIR) $(APPIMAGE_SOURCES) + cp $(ROOT_DIR)/AppRun AppDir/ + cp $(ROOT_DIR)/pyfa.desktop AppDir/ + cp $(ROOT_DIR)/pyfa.desktop AppDir/usr/share/applications/ + cp $(ROOT_DIR)/org.pyfa.pyfa.appdata.xml AppDir/usr/share/metainfo/ + chmod +x $(ROOT_DIR)/pyfa && cp $(ROOT_DIR)/pyfa AppDir/usr/bin/ + +# Rule to copy generated PROJECT_SOURCES +$(DEPLOY_DIR)/%: $(PYFA_DIR)/% $(DEPLOY_DIR) + cp -r $< $@ + +# Prepare Python base AppImage, stripping Python metadata +$(DEPLOY_DIR): $(PYTHON_APPIMAGE) + ./$(PYTHON_APPIMAGE) --appimage-extract + mv squashfs-root AppDir + rm AppDir/python*.desktop + rm AppDir/usr/share/applications/*.desktop + rm AppDir/usr/share/metainfo/*.appdata.xml + mkdir -p $(DEPLOY_DIR) + +$(PYTHON_APPIMAGE): + curl -LO $(PYTHON_APPIMAGE_URL) + chmod +x $(PYTHON_APPIMAGE) + + +$(APPIMAGETOOL): + curl -LO $(APPIMAGETOOL_URL) + chmod +x $(APPIMAGETOOL) + +clean: + rm -rf AppDir + +clean-all: clean + rm -rf *.AppImage \ No newline at end of file diff --git a/appimage/README.md b/appimage/README.md new file mode 100644 index 000000000..5d6840a5a --- /dev/null +++ b/appimage/README.md @@ -0,0 +1,19 @@ +## Pyfa As AppImage + +Needed for building: + +- Linux distro, currently tested is Arch/Manjaro +- make, curl +- patience, first time building wxPython can take about 10 minutes + +Steps: + +```sh +cd appimage +mkdir build +cd build +make -f ../Makefile +``` + +If everything goes alright, build directory should contain `Pyfa-x86_64.AppImage`. + diff --git a/appimage/org.pyfa.pyfa.appdata.xml b/appimage/org.pyfa.pyfa.appdata.xml new file mode 100644 index 000000000..98a532f95 --- /dev/null +++ b/appimage/org.pyfa.pyfa.appdata.xml @@ -0,0 +1,17 @@ + + + org.pyfa.pyfa + MIT + GPL-3 + Pyfa + Pyfa + +

Python Fitting Assitant for EVE Online +

+
+ pyfa.desktop + https://github.com/pyfa-org/Pyfa + + pyfa + +
diff --git a/appimage/pyfa b/appimage/pyfa new file mode 100755 index 000000000..5f5c7db49 --- /dev/null +++ b/appimage/pyfa @@ -0,0 +1,3 @@ +#! /bin/bash + +${APPDIR}/usr/bin/python3.8 -s "${APPDIR}/opt/pyfa/pyfa.py" "$@" \ No newline at end of file diff --git a/appimage/pyfa.desktop b/appimage/pyfa.desktop new file mode 100644 index 000000000..ea56f901a --- /dev/null +++ b/appimage/pyfa.desktop @@ -0,0 +1,7 @@ +[Desktop Entry] +Type=Application +Name=Pyfa +Exec=pyfa +Comment=Python Fitting Assistant for EVE: Online +Icon=python +Categories=Game; \ No newline at end of file diff --git a/requirements.txt b/requirements.txt index 4a95eb125..20f1c128c 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,4 +1,4 @@ -wxPython == 4.0.6 +wxPython <4.1 logbook >= 1.0.0 numpy == 1.19.2 matplotlib == 3.2.2 From e17fe434eeafcf82ec1d8546ff446fe4e48552da Mon Sep 17 00:00:00 2001 From: Tomas S <8504482+wereii@users.noreply.github.com> Date: Thu, 17 Mar 2022 12:02:19 +0100 Subject: [PATCH 2/2] Update with GTK3 Info --- appimage/README.md | 1 + 1 file changed, 1 insertion(+) diff --git a/appimage/README.md b/appimage/README.md index 5d6840a5a..6555b0ad6 100644 --- a/appimage/README.md +++ b/appimage/README.md @@ -4,6 +4,7 @@ Needed for building: - Linux distro, currently tested is Arch/Manjaro - make, curl +- GTK3 libraries are needed (`gtk3` for Arch based, `libgtk-3-dev` for debian based) - patience, first time building wxPython can take about 10 minutes Steps: