Skip to content

Commit

Permalink
Change Linux AppImage to Python3.9.
Browse files Browse the repository at this point in the history
Remove Torch Tests.
And create a little script which prepares a directory with just the needed project files for Papagayo-NG to save space.
  • Loading branch information
Stefan Murawski committed Aug 10, 2021
1 parent 0825db3 commit 4efe61e
Show file tree
Hide file tree
Showing 2 changed files with 40 additions and 6 deletions.
14 changes: 8 additions & 6 deletions build/linux-appimage/build.sh
Expand Up @@ -3,10 +3,10 @@
# https://github.com/AppImage/AppImageKit/wiki/Bundling-Python-apps

SCRIPTPATH=$(cd `dirname "$0"`; pwd)
SOURCES_DIR="${SCRIPTPATH}/../../"
SOURCES_DIR="${SCRIPTPATH}/../../app_image_build/"

#PYTHON_APPIMAGE_URL="https://github.com/niess/python-appimage/releases/download/python3.10/python3.10.0-cp310-cp310-manylinux2010_x86_64.AppImage"
PYTHON_APPIMAGE_URL="https://github.com/niess/python-appimage/releases/download/python3.7/python3.7.11-cp37-cp37m-manylinux2010_x86_64.AppImage"
PYTHON_APPIMAGE_URL="https://github.com/niess/python-appimage/releases/download/python3.9/python3.9.6-cp39-cp39-manylinux2014_x86_64.AppImage"
PYTHON_APPIMAGE_FILENAME=`basename "${PYTHON_APPIMAGE_URL}"`

# Detect package management system.
Expand All @@ -32,7 +32,9 @@ chmod +x "${PYTHON_APPIMAGE_FILENAME}"
./squashfs-root/AppRun -m pip install torch==1.9.0+cpu -f https://download.pytorch.org/whl/torch_stable.html
./squashfs-root/AppRun -m pip install -r "${SOURCES_DIR}requirements.txt"
#./squashfs-root/AppRun -m pip install $(grep -ivE "allosaurus" "${SOURCES_DIR}requirements.txt")
rm squashfs-root/opt/python3.7/lib/python3.7/site-packages/PySide2/Qt/lib/libQt5WebEngineCore.so.5
rm squashfs-root/opt/python3.9/lib/python3.9/site-packages/PySide2/Qt/lib/libQt5WebEngineCore.so.5
rm -rf ./squashfs-root/opt/python3.9/lib/python3.9/site-packages/torch/test


#find "${SOURCES_DIR}" -type f -not -iname '*/not-from-here/*' -exec cp -rf '{}' '/dest/{}' ';'
rsync -av --progress "${SOURCES_DIR}" "squashfs-root/opt/papagayo-ng" --exclude build
Expand All @@ -46,15 +48,15 @@ cp "${SOURCES_DIR}/rsrc/papagayo-ng.png" squashfs-root/
rm squashfs-root/usr/share/metainfo/*

# Change AppRun so that it launches papagayo-ng
sed -i -e 's|/opt/python3.7/bin/python3.7|/usr/bin/papagayo-ng|g' ./squashfs-root/AppRun
sed -i -e 's|/opt/python3.9/bin/python3.9|/usr/bin/papagayo-ng|g' ./squashfs-root/AppRun

# Convert back into an AppImage
wget -c https://github.com/$(wget -q https://github.com/probonopd/go-appimage/releases -O - | grep "appimagetool-.*-x86_64.AppImage" | head -n 1 | cut -d '"' -f 2)
chmod +x appimagetool-*.AppImage
#
#
# The following line does not work quite yet due to https://github.com/probonopd/go-appimage/issues/30
# ./appimagetool-*-x86_64.AppImage deploy squashfs-root/usr/share/applications/taguette.desktop
./appimagetool-*-x86_64.AppImage squashfs-root/ # Replace "1" with the actual version/build number
mv Papagayo_NG-*-x86_64.AppImage ../
cd ..
rm -rf build
rm -rf build
32 changes: 32 additions & 0 deletions prepare_appimage_build_dir.py
@@ -0,0 +1,32 @@
import os
import shutil


def main():
source_dir = os.getcwd()
new_dir = os.path.join(os.getcwd(), "app_image_build")
if not os.path.exists(new_dir):
os.makedirs(new_dir)
else:
shutil.rmtree(new_dir)
os.makedirs(new_dir)
list_of_files = ["papagayo-ng.py", "Rhubarb.py", "AboutBoxQT.py",
"MouthViewQT.py", "utilities.py", "SettingsQT.py",
"PronunciationDialogQT.py", "SoundPlayerNew.py",
"SoundPlayerOSX.py", "SoundPlayerQT.py",
"WaveformViewRewrite.py", "papagayongrcc.py",
"LipsyncDoc.py", "LipsyncFrameQT.py",
"auto_recognition.py", "SoundPlayer.py", "gpl.txt",
"papagayo-ng.ico", "ipa_cmu.json", "version_information.txt", "file_version_info.txt",
"qt-icons.qrc", "readme.md", "about_markdown.html",
"rsrc/", "breakdowns/", "phonemes/", "requirements.txt"]

for file_name in list_of_files:
if file_name.endswith(r"/"):
shutil.copytree(os.path.join(source_dir, file_name), os.path.join(new_dir, file_name))
else:
shutil.copy(os.path.join(source_dir, file_name), os.path.join(new_dir, file_name))


if __name__ == "__main__":
main()

0 comments on commit 4efe61e

Please sign in to comment.