forked from Boria138/PortProtonQt
chore(build): return QtSvg to appimage
Signed-off-by: Boris Yumankulov <boria138@altlinux.org>
This commit is contained in:
@@ -9,9 +9,9 @@ script:
|
|||||||
- cp -r lib AppDir/usr
|
- cp -r lib AppDir/usr
|
||||||
- rm -rf AppDir/usr/local/lib/python3.10/dist-packages/PySide6/Qt/qml/
|
- rm -rf AppDir/usr/local/lib/python3.10/dist-packages/PySide6/Qt/qml/
|
||||||
- rm -f AppDir/usr/local/lib/python3.10/dist-packages/PySide6/{assistant,designer,linguist,lrelease,lupdate}
|
- rm -f AppDir/usr/local/lib/python3.10/dist-packages/PySide6/{assistant,designer,linguist,lrelease,lupdate}
|
||||||
- rm -f AppDir/usr/local/lib/python3.10/dist-packages/PySide6/{Qt3DAnimation*,Qt3DCore*,Qt3DExtras*,Qt3DInput*,Qt3DLogic*,Qt3DRender*,QtBluetooth*,QtCharts*,QtConcurrent*,QtDataVisualization*,QtDesigner*,QtExampleIcons*,QtGraphs*,QtGraphsWidgets*,QtHelp*,QtHttpServer*,QtLocation*,QtMultimedia*,QtMultimediaWidgets*,QtNetworkAuth*,QtNfc*,QtOpenGL*,QtOpenGLWidgets*,QtPdf*,QtPdfWidgets*,QtPositioning*,QtPrintSupport*,QtQml*,QtQuick*,QtQuick3D*,QtQuickControls2*,QtQuickTest*,QtQuickWidgets*,QtRemoteObjects*,QtScxml*,QtSensors*,QtSerialBus*,QtSerialPort*,QtSpatialAudio*,QtSql*,QtStateMachine*,QtSvg*,QtSvgWidgets*,QtTest*,QtTextToSpeech*,QtUiTools*,QtWebChannel*,QtWebEngineCore*,QtWebEngineQuick*,QtWebEngineWidgets*,QtWebSockets*,QtWebView*,QtXml*}
|
- rm -f AppDir/usr/local/lib/python3.10/dist-packages/PySide6/{Qt3DAnimation*,Qt3DCore*,Qt3DExtras*,Qt3DInput*,Qt3DLogic*,Qt3DRender*,QtBluetooth*,QtCharts*,QtConcurrent*,QtDataVisualization*,QtDesigner*,QtExampleIcons*,QtGraphs*,QtGraphsWidgets*,QtHelp*,QtHttpServer*,QtLocation*,QtMultimedia*,QtMultimediaWidgets*,QtNetworkAuth*,QtNfc*,QtOpenGL*,QtOpenGLWidgets*,QtPdf*,QtPdfWidgets*,QtPositioning*,QtPrintSupport*,QtQml*,QtQuick*,QtQuick3D*,QtQuickControls2*,QtQuickTest*,QtQuickWidgets*,QtRemoteObjects*,QtScxml*,QtSensors*,QtSerialBus*,QtSerialPort*,QtSpatialAudio*,QtSql*,QtStateMachine*,QtSvgWidgets*,QtTest*,QtTextToSpeech*,QtUiTools*,QtWebChannel*,QtWebEngineCore*,QtWebEngineQuick*,QtWebEngineWidgets*,QtWebSockets*,QtWebView*,QtXml*}
|
||||||
- shopt -s extglob
|
- shopt -s extglob
|
||||||
- rm -rf AppDir/usr/local/lib/python3.10/dist-packages/PySide6/Qt/lib/!(libQt6Core*|libQt6DBus*|libQt6Egl*|libQt6Gui*|libQt6Network*|libQt6Wayland*|libQt6Widgets*|libQt6XcbQpa*|libicudata*|libicui18n*|libicuuc*)
|
- rm -rf AppDir/usr/local/lib/python3.10/dist-packages/PySide6/Qt/lib/!(libQt6Core*|libQt6DBus*|libQt6Egl*|libQt6Gui*|libQt6Network*|libQt6Svg*|libQt6Wayland*|libQt6Widgets*|libQt6XcbQpa*|libicudata*|libicui18n*|libicuuc*)
|
||||||
AppDir:
|
AppDir:
|
||||||
path: ./AppDir
|
path: ./AppDir
|
||||||
after_bundle:
|
after_bundle:
|
||||||
|
|||||||
@@ -21,21 +21,25 @@ class PySide6DependencyAnalyzer:
|
|||||||
# Системные библиотеки, которые нужно всегда оставлять
|
# Системные библиотеки, которые нужно всегда оставлять
|
||||||
self.system_libs = {
|
self.system_libs = {
|
||||||
'libQt6XcbQpa', 'libQt6Wayland', 'libQt6Egl',
|
'libQt6XcbQpa', 'libQt6Wayland', 'libQt6Egl',
|
||||||
'libicudata', 'libicuuc', 'libicui18n', 'libQt6DBus'
|
'libicudata', 'libicuuc', 'libicui18n', 'libQt6DBus',
|
||||||
|
'libQt6Svg'
|
||||||
|
}
|
||||||
|
|
||||||
|
self.critical_modules = {
|
||||||
|
'QtSvg',
|
||||||
}
|
}
|
||||||
|
|
||||||
self.real_dependencies = {}
|
self.real_dependencies = {}
|
||||||
self.used_modules_code = set()
|
self.used_modules_code = set()
|
||||||
self.used_modules_ldd = set()
|
self.used_modules_ldd = set()
|
||||||
self.all_required_modules = set()
|
self.all_required_modules = set()
|
||||||
|
|
||||||
# Определяем корень проекта
|
# Определяем корень проекта
|
||||||
if project_root is None:
|
if project_root is None:
|
||||||
# Корень проекта - две директории выше от скрипта
|
# Корень проекта - две директории выше от скрипта
|
||||||
self.project_root = Path(__file__).parent.parent
|
self.project_root = Path(__file__).parent.parent
|
||||||
else:
|
else:
|
||||||
self.project_root = project_root
|
self.project_root = project_root
|
||||||
|
|
||||||
self.venv_path = self.project_root / ".venv"
|
self.venv_path = self.project_root / ".venv"
|
||||||
self.build_path = self.project_root / "build-aux"
|
self.build_path = self.project_root / "build-aux"
|
||||||
|
|
||||||
@@ -60,9 +64,9 @@ class PySide6DependencyAnalyzer:
|
|||||||
self.project_root / "venv",
|
self.project_root / "venv",
|
||||||
self.project_root / ".virtualenv",
|
self.project_root / ".virtualenv",
|
||||||
]
|
]
|
||||||
|
|
||||||
pyside6_path = None
|
pyside6_path = None
|
||||||
|
|
||||||
# Пробуем найти PySide6 в venv
|
# Пробуем найти PySide6 в venv
|
||||||
for venv in venv_candidates:
|
for venv in venv_candidates:
|
||||||
if venv.exists():
|
if venv.exists():
|
||||||
@@ -78,7 +82,7 @@ class PySide6DependencyAnalyzer:
|
|||||||
break
|
break
|
||||||
if pyside6_path:
|
if pyside6_path:
|
||||||
break
|
break
|
||||||
|
|
||||||
if not pyside6_path:
|
if not pyside6_path:
|
||||||
print(f"Предупреждение: PySide6 не найден в venv, проверяем AppDir...")
|
print(f"Предупреждение: PySide6 не найден в venv, проверяем AppDir...")
|
||||||
# Если не нашли в venv, пробуем в AppDir
|
# Если не нашли в venv, пробуем в AppDir
|
||||||
@@ -304,8 +308,10 @@ class PySide6DependencyAnalyzer:
|
|||||||
|
|
||||||
# Модули для удаления
|
# Модули для удаления
|
||||||
if removable_modules:
|
if removable_modules:
|
||||||
modules_list = ','.join([f"{mod}*" for mod in sorted(removable_modules)])
|
removable_filtered = [m for m in removable_modules if m not in self.critical_modules]
|
||||||
cleanup_lines.append(f" - rm -f AppDir/usr/local/lib/python3.10/dist-packages/PySide6/{{{modules_list}}}")
|
if removable_filtered:
|
||||||
|
modules_list = ','.join([f"{mod}*" for mod in sorted(removable_filtered)])
|
||||||
|
cleanup_lines.append(f" - rm -f AppDir/usr/local/lib/python3.10/dist-packages/PySide6/{{{modules_list}}}")
|
||||||
|
|
||||||
# Генерируем команду для удаления нативных библиотек с сохранением нужных
|
# Генерируем команду для удаления нативных библиотек с сохранением нужных
|
||||||
required_libs = set()
|
required_libs = set()
|
||||||
@@ -324,22 +330,22 @@ class PySide6DependencyAnalyzer:
|
|||||||
])
|
])
|
||||||
|
|
||||||
import re
|
import re
|
||||||
|
|
||||||
# Ищем весь блок команд очистки PySide6 (от первой rm до AppDir:)
|
# Ищем весь блок команд очистки PySide6 (от первой rm до AppDir:)
|
||||||
# Паттерн: после " - cp -r lib AppDir/usr\n" идут команды rm, а затем "AppDir:"
|
# Паттерн: после " - cp -r lib AppDir/usr\n" идут команды rm, а затем "AppDir:"
|
||||||
pattern = r'( - cp -r lib AppDir/usr\n)((?: - (?:rm|shopt).*\n)*?)(?=AppDir:)'
|
pattern = r'( - cp -r lib AppDir/usr\n)((?: - (?:rm|shopt).*\n)*?)(?=AppDir:)'
|
||||||
|
|
||||||
match = re.search(pattern, recipe_content)
|
match = re.search(pattern, recipe_content)
|
||||||
|
|
||||||
if not match:
|
if not match:
|
||||||
print("ПРЕДУПРЕЖДЕНИЕ: Не удалось найти блок очистки в рецепте")
|
print("ПРЕДУПРЕЖДЕНИЕ: Не удалось найти блок очистки в рецепте")
|
||||||
print("Добавляем команды очистки перед блоком AppDir:")
|
print("Добавляем команды очистки перед блоком AppDir:")
|
||||||
|
|
||||||
# Просто вставим команды перед AppDir:
|
# Просто вставим команды перед AppDir:
|
||||||
appdir_pos = recipe_content.find('AppDir:')
|
appdir_pos = recipe_content.find('AppDir:')
|
||||||
if appdir_pos != -1:
|
if appdir_pos != -1:
|
||||||
new_content = (
|
new_content = (
|
||||||
recipe_content[:appdir_pos] +
|
recipe_content[:appdir_pos] +
|
||||||
'\n'.join(cleanup_lines) + '\n' +
|
'\n'.join(cleanup_lines) + '\n' +
|
||||||
recipe_content[appdir_pos:]
|
recipe_content[appdir_pos:]
|
||||||
)
|
)
|
||||||
@@ -347,15 +353,14 @@ class PySide6DependencyAnalyzer:
|
|||||||
else:
|
else:
|
||||||
print("ОШИБКА: Не найден блок AppDir: в рецепте")
|
print("ОШИБКА: Не найден блок AppDir: в рецепте")
|
||||||
return ""
|
return ""
|
||||||
|
|
||||||
# Создаем замену - группа 1 (cp -r lib) + новые команды очистки
|
# Создаем замену - группа 1 (cp -r lib) + новые команды очистки
|
||||||
replacement = r'\1' + '\n'.join(cleanup_lines) + '\n'
|
replacement = r'\1' + '\n'.join(cleanup_lines) + '\n'
|
||||||
|
|
||||||
updated_recipe = re.sub(pattern, replacement, recipe_content, count=1)
|
updated_recipe = re.sub(pattern, replacement, recipe_content, count=1)
|
||||||
|
|
||||||
return updated_recipe
|
return updated_recipe
|
||||||
|
|
||||||
|
|
||||||
def main():
|
def main():
|
||||||
parser = argparse.ArgumentParser(description='Анализ зависимостей PySide6 модулей с использованием ldd')
|
parser = argparse.ArgumentParser(description='Анализ зависимостей PySide6 модулей с использованием ldd')
|
||||||
parser.add_argument('project_path', nargs='?', default='.',
|
parser.add_argument('project_path', nargs='?', default='.',
|
||||||
|
|||||||
Reference in New Issue
Block a user