Добавлена сборка AppImage

This commit is contained in:
2025-05-02 03:39:13 +03:00
parent a7821361cb
commit 780782f369
15 changed files with 102 additions and 2 deletions

8
.gitignore vendored
View File

@@ -8,3 +8,11 @@ db.sqlite
# Docs # Docs
docs/ docs/
# AppImage
AppDir/.DirIcon
AppDir/usr/
dist/python*
dist/packages/
dist/appimagetool*.AppImage
dist/ClanStat-*.AppImage

3
.gitmodules vendored Normal file
View File

@@ -0,0 +1,3 @@
[submodule "3rdparty/colors.sh"]
path = 3rdparty/colors.sh
url = https://git.a2s.su/iiiypuk/colors.sh.git

1
3rdparty/colors.sh vendored Submodule

Submodule 3rdparty/colors.sh added at b4c1b5e3ee

5
AppDir/AppRun Executable file
View File

@@ -0,0 +1,5 @@
#!/bin/sh
export PYTHONPATH="${PYTHONPATH}:${APPDIR}/usr/lib/python3.13/site-packages"
${APPDIR}/usr/bin/python3.13 -m ClanStat $1

6
AppDir/app.desktop Normal file
View File

@@ -0,0 +1,6 @@
[Desktop Entry]
Type=Application
Name=ClanStat
Icon=shield
Terminal=false
Categories=Utility;

BIN
AppDir/shield.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 22 KiB

View File

@@ -7,7 +7,7 @@ from .actions import get_top_wins, get_top_donates
async def main(): async def main():
"""Запускак клиента Telegram""" """Запуск клиента Telegram"""
await client.start() await client.start()
logger.info('Клиент Telegram запущен') logger.info('Клиент Telegram запущен')

0
dist/.gitkeep vendored Normal file
View File

View File

@@ -1,5 +1,5 @@
loguru==0.7.2 loguru==0.7.2
pdoc==15.0.1
Pyrogram==2.0.106 Pyrogram==2.0.106
python-dotenv==1.0.1 python-dotenv==1.0.1
TgCrypto==1.2.5 TgCrypto==1.2.5
psycopg2==2.9.10

77
scripts/make-appimage.sh Executable file
View File

@@ -0,0 +1,77 @@
#!/bin/sh
# Импортирует скрипт с определениями цветов
source ../3rdparty/colors.sh/colors.sh
APPDIR="../AppDir"
GIT_HASH=$(git rev-parse --short HEAD)
# Скачивает x86_64 AppImageTool
download_appimage_tool() {
echo -e "${CYAN}Загрузка AppImageTool...${NC}"
wget -q --show-progress https://github.com/AppImage/appimagetool/releases/download/continuous/appimagetool-x86_64.AppImage
chmod +x appimagetool-x86_64.AppImage
}
# Скачивает March Any Linux Python
download_python() {
wget -q --show-progress https://github.com/niess/python-appimage/releases/download/python3.13/python3.13.3-cp313-cp313-manylinux2014_x86_64.AppImage
chmod +x python3.13.3-cp313-cp313-manylinux2014_x86_64.AppImage
mv python3.13.3-cp313-cp313-manylinux2014_x86_64.AppImage python3.13
mkdir -p ${APPDIR}/usr/bin/
cp ./python3.13 ${APPDIR}/usr/bin/python3.13
}
# Загружает Python зависимости проекта
get_requirements() {
./python3.13 -m pip install --target=$(pwd)/packages -r ../requirements.txt > /dev/null 2>&1
}
# Копирует записимости в AppDir
copy_requirements() {
mkdir -p ${APPDIR}/usr/lib/python3.13/site-packages/
cp -r packages/* ${APPDIR}/usr/lib/python3.13/site-packages/
}
# Копирует приложение в AppDir
copy_app_files() {
echo -e "${GREEN}Копирование файлов ...${NC}"
rm -rf ${APPDIR}/usr/lib/python3.13/site-packages/ClanStat
cp -r ../ClanStat ${APPDIR}/usr/lib/python3.13/site-packages/ClanStat
rm -rf ${APPDIR}/usr/lib/python3.13/site-packages/ClanStat/__pycache__
}
# Выполянет сборку AppImage
make_appimage() {
echo -e "${GREEN}Сборка AppImage...${NC}"
./appimagetool-x86_64.AppImage ${APPDIR} > /dev/null 2>&1
mv ./ClanStat-x86_64.AppImage ./ClanStat-${GIT_HASH}-x86_64.AppImage
echo -e "${RED}Сборка AppImage заверщена${NC}"
}
# Основная функция
main() {
clear
echo -e "${YELLOW}Подготовка к сборке AppImage...${NC}"
if [ ! -f "appimagetool-x86_64.AppImage" ]; then
download_appimage_tool
fi
if [ ! -f "python3.13" ]; then
download_python
get_requirements
copy_requirements
fi
copy_app_files
make_appimage
}
# Запускает основную функцию
main