mirror of
https://github.com/Syncplay/syncplay
synced 2024-12-12 09:55:31 +00:00
2aa73122ab
- macOS build: add arch checker for the bundle - Actions macOS: restrict env to universal2 step - Actions macOS: universal2 for zope.interface - Actions macOS: universal2 for cffi and cryptography - macOS build: ad-hoc sign again bundle after altering it - macOS build: symlink instead of copy libshiboken6 - vendor.Qt: restrict warnings to QT_VERBOSE - GHA: re-enable all jobs - GHA macOS: use Python installer to build universal2 app - Actions macOS: build Python with pyenv - Older pyenv version is used... - Abandon pyenv action - Bump image to macOS-12 - One more attempt with pyenv - Try with the official Python installer - Must run as root - Switch back to python3 calls - Manually update PATH - Momentarily disable other jobs - Restore app cleaner - ui: add support for PySide6 - vendor.Qt: "support" PySide6 - Update vendored Qt.py to 1.3.7 - Update requirements_gui
115 lines
2.8 KiB
Python
115 lines
2.8 KiB
Python
import os
|
|
import platform
|
|
import shutil
|
|
|
|
from glob import glob
|
|
|
|
pyver = platform.python_version_tuple()[0] + '.' + platform.python_version_tuple()[1]
|
|
|
|
# Clean resources
|
|
|
|
PATH = 'dist/Syncplay.app/Contents/Resources/'
|
|
|
|
to_be_kept = []
|
|
to_be_deleted = []
|
|
|
|
for f in glob(f'{PATH}/qt*'):
|
|
if not any({k in f for k in to_be_kept}):
|
|
to_be_deleted.append(f)
|
|
|
|
for p in to_be_deleted:
|
|
if os.path.exists(p):
|
|
if os.path.isdir(p):
|
|
shutil.rmtree(p, ignore_errors=True)
|
|
else:
|
|
os.remove(p)
|
|
|
|
# Clean PySide6 folder
|
|
|
|
PATH = f'dist/Syncplay.app/Contents/Resources/lib/python{pyver}/PySide6'
|
|
|
|
shutil.rmtree(f'{PATH}/examples', ignore_errors=True)
|
|
shutil.rmtree(f'{PATH}/include', ignore_errors=True)
|
|
|
|
to_be_kept = ['QtCore', 'QtGui', 'QtWidgets']
|
|
to_be_deleted = []
|
|
|
|
for f in glob(f'{PATH}/Qt*'):
|
|
if not any({k in f for k in to_be_kept}):
|
|
to_be_deleted.append(f)
|
|
|
|
for a in glob(f'{PATH}/*.app'):
|
|
to_be_deleted.append(a)
|
|
|
|
to_be_deleted.remove(f'{PATH}/Qt')
|
|
to_be_deleted.extend([f'{PATH}/lupdate', f'{PATH}/qmllint', f'{PATH}/lrelease'])
|
|
|
|
for p in to_be_deleted:
|
|
if os.path.exists(p):
|
|
if os.path.isdir(p):
|
|
shutil.rmtree(p, ignore_errors=True)
|
|
else:
|
|
os.remove(p)
|
|
|
|
# Clean PySide6/Qt folder
|
|
|
|
PATH = f'dist/Syncplay.app/Contents/Resources/lib/python{pyver}/PySide6/Qt'
|
|
|
|
to_be_deleted.extend([f'{PATH}/qml', f'{PATH}/translations'])
|
|
|
|
for p in to_be_deleted:
|
|
if os.path.exists(p):
|
|
if os.path.isdir(p):
|
|
shutil.rmtree(p, ignore_errors=True)
|
|
else:
|
|
os.remove(p)
|
|
|
|
# Clean PySide6/Qt/lib folder
|
|
|
|
PATH = f'dist/Syncplay.app/Contents/Resources/lib/python{pyver}/PySide6/Qt/lib'
|
|
|
|
to_be_kept = ['QtCore', 'QtDBus', 'QtGui', 'QtWidgets']
|
|
to_be_deleted = [f'{PATH}/metatypes']
|
|
|
|
for f in glob(f'{PATH}/Qt*'):
|
|
if not any({k in f for k in to_be_kept}):
|
|
to_be_deleted.append(f)
|
|
|
|
for p in to_be_deleted:
|
|
if os.path.exists(p):
|
|
if os.path.isdir(p):
|
|
shutil.rmtree(p, ignore_errors=True)
|
|
else:
|
|
os.remove(p)
|
|
|
|
# Clean PySide6/Qt/plugins folder
|
|
|
|
PATH = f'dist/Syncplay.app/Contents/Resources/lib/python{pyver}/PySide6/Qt/plugins'
|
|
|
|
to_be_kept = ['platforms', 'styles']
|
|
to_be_deleted = []
|
|
|
|
for f in glob(f'{PATH}/*'):
|
|
if not any({k in f for k in to_be_kept}):
|
|
to_be_deleted.append(f)
|
|
|
|
for p in to_be_deleted:
|
|
if os.path.exists(p):
|
|
if os.path.isdir(p):
|
|
shutil.rmtree(p, ignore_errors=True)
|
|
else:
|
|
os.remove(p)
|
|
|
|
# symlink .so from shiboken6 to PySide6 folder
|
|
|
|
cwd = os.getcwd()
|
|
|
|
FROM = f'dist/Syncplay.app/Contents/Resources/lib/python{pyver}/shiboken6'
|
|
TO = f'dist/Syncplay.app/Contents/Resources/lib/python{pyver}/PySide6'
|
|
|
|
fn = os.path.basename(glob(f'{FROM}/libshiboken6*.dylib')[0])
|
|
|
|
os.chdir(TO)
|
|
os.symlink(f'../shiboken6/{fn}', f'./{fn}')
|
|
os.chdir(cwd)
|