Initial macos-package-build commit

This commit is contained in:
NoisyCoil 2022-10-23 18:13:51 +02:00
parent 7936cb85be
commit 6d4f4aef49
4 changed files with 146 additions and 102 deletions

2
desktop/poetry.lock generated
View File

@ -739,7 +739,7 @@ testing = ["coverage (>=5.0.3)", "zope.event", "zope.testing"]
[metadata] [metadata]
lock-version = "1.1" lock-version = "1.1"
python-versions = ">=3.7,<3.11" python-versions = ">=3.7,<3.11"
content-hash = "7a9668ef487d9cdc4760a9b6cd28cd99dc76b06069186db4f14f9b6f1c4f57d6" content-hash = "d6ad676f3ecea349558ed78d2a764826a485adab6f6535818553666b580c2367"
[metadata.files] [metadata.files]
attrs = [ attrs = [

View File

@ -19,6 +19,7 @@ pytest = "*"
pytest-faulthandler = "*" pytest-faulthandler = "*"
pytest-qt = "*" pytest-qt = "*"
cx_freeze = "*" cx_freeze = "*"
importlib-metadata = "*"
[build-system] [build-system]
requires = ["poetry-core>=1.0.0"] requires = ["poetry-core>=1.0.0"]

View File

@ -63,7 +63,7 @@ def main():
@main.command() @main.command()
def cleanup_build(): def cleanup_build():
"""Delete unused PySide2 stuff to save space""" """Delete unused PySide6 stuff to save space"""
app_path = get_app_path() app_path = get_app_path()
before_size = get_size(app_path) before_size = get_size(app_path)
@ -74,24 +74,18 @@ def cleanup_build():
"QtQuickParticles", "QtQuickParticles",
"QtRemoteObjects", "QtRemoteObjects",
"Qt3DInput", "Qt3DInput",
"QtPdfWidgets",
"QtScriptTools",
"QtNetworkAuth", "QtNetworkAuth",
"QtDataVisualization", "QtDataVisualization",
"QtWebEngineCore", "QtWebEngineCore",
"Qt3DQuickRender", "Qt3DQuickRender",
"Qt3DQuickExtras", "Qt3DQuickExtras",
"QtQuick3DRender",
"QtDesigner", "QtDesigner",
"QtNfc", "QtNfc",
"QtQuick3DAssetImport", "QtQuick3DAssetImport",
"QtBodymovin",
"QtWebEngineWidgets", "QtWebEngineWidgets",
"QtQuickWidgets", "QtQuickWidgets",
"Qt3DQuickInput", "Qt3DQuickInput",
"Qt3DQuickScene2D", "Qt3DQuickScene2D",
"QtUiPlugin",
"QtPdf",
"Qt3DRender", "Qt3DRender",
"QtQuick3DRuntimeRender", "QtQuick3DRuntimeRender",
"QtHelp", "QtHelp",
@ -100,13 +94,10 @@ def cleanup_build():
"QtWebSockets", "QtWebSockets",
"QtQuick3DUtils", "QtQuick3DUtils",
"QtQuickTemplates2", "QtQuickTemplates2",
"QtScript",
"QtPositioningQuick", "QtPositioningQuick",
"Qt3DCore", "Qt3DCore",
"QtLocation",
"QtXml", "QtXml",
"QtSerialPort", "QtSerialPort",
"QtWebView",
"QtQuick", "QtQuick",
"QtScxml", "QtScxml",
"QtQml", "QtQml",
@ -115,9 +106,7 @@ def cleanup_build():
"QtMultimedia", "QtMultimedia",
"QtQmlWorkerScript", "QtQmlWorkerScript",
"QtVirtualKeyboard", "QtVirtualKeyboard",
"QtPurchasing",
"QtOpenGL", "QtOpenGL",
"QtWebEngine",
"Qt3DQuick", "Qt3DQuick",
"QtTest", "QtTest",
"QtPositioning", "QtPositioning",
@ -127,7 +116,6 @@ def cleanup_build():
"QtQuickShapes", "QtQuickShapes",
"QtQuickTest", "QtQuickTest",
"QtNetwork", "QtNetwork",
"QtXmlPatterns",
"QtSvg", "QtSvg",
"QtDesignerComponents", "QtDesignerComponents",
"QtMultimediaWidgets", "QtMultimediaWidgets",
@ -135,27 +123,58 @@ def cleanup_build():
"Qt3DQuickAnimation", "Qt3DQuickAnimation",
"QtSensors", "QtSensors",
"Qt3DAnimation", "Qt3DAnimation",
"QtRepParser",
"QtTextToSpeech",
"QtGamepad",
"QtSerialBus",
"QtSql", "QtSql",
"QtConcurrent" "QtConcurrent",
"QtChartsQml",
"QtDataVisualizationQml",
"QtLabsAnimation",
"QtLabsFolderListModel",
"QtLabsQmlModels",
"QtLabsSettings",
"QtLabsSharedImage",
"QtLabsWavefrontMesh",
"QtOpenGLWidgets",
"QtQmlCore",
"QtQmlLocalStorage",
"QtQmlXmlListModel",
"QtQuick3DAssetUtils",
"QtQuick3DEffects",
"QtQuick3DGlslParser",
"QtQuick3DHelpers",
"QtQuick3DIblBaker",
"QtQuick3DParticleEffects",
"QtQuick3DParticles",
"QtQuickControls2Impl",
"QtQuickDialogs2",
"QtQuickDialogs2QuickImpl",
"QtQuickDialogs2Utils",
"QtQuickLayouts",
"QtQuickTimeline",
"QtRemoteObjectsQml",
"QtScxmlQml",
"QtSensorsQuick",
"QtShaderTools",
"QtStateMachine",
"QtStateMachineQml",
"QtSvgWidgets",
"QtUiTools",
"QtWebEngineQuick",
"QtWebEngineQuickDelegatesQml"
]: ]:
shutil.rmtree( shutil.rmtree(
f"{app_path}/Contents/MacOS/lib/PySide2/Qt/lib/{framework}.framework" f"{app_path}/Contents/MacOS/lib/PySide6/Qt/lib/{framework}.framework"
) )
print( print(
f"Deleted: {app_path}/Contents/MacOS/lib/PySide2/Qt/lib/{framework}.framework" f"Deleted: {app_path}/Contents/MacOS/lib/PySide6/Qt/lib/{framework}.framework"
) )
try: try:
os.remove(f"{app_path}/Contents/MacOS/lib/PySide2/{framework}.abi3.so") os.remove(f"{app_path}/Contents/MacOS/lib/PySide6/{framework}.abi3.so")
print(f"Deleted: {app_path}/Contents/MacOS/lib/PySide2/{framework}.abi3.so") print(f"Deleted: {app_path}/Contents/MacOS/lib/PySide6/{framework}.abi3.so")
except FileNotFoundError: except FileNotFoundError:
pass pass
try: try:
os.remove(f"{app_path}/Contents/MacOS/lib/PySide2/{framework}.pyi") os.remove(f"{app_path}/Contents/MacOS/lib/PySide6/{framework}.pyi")
print(f"Deleted: {app_path}/Contents/MacOS/lib/PySide2/{framework}.pyi") print(f"Deleted: {app_path}/Contents/MacOS/lib/PySide6/{framework}.pyi")
except FileNotFoundError: except FileNotFoundError:
pass pass
@ -176,28 +195,31 @@ def cleanup_build():
# Move frameworks from Resources/lib into Frameworks # Move frameworks from Resources/lib into Frameworks
os.makedirs(f"{app_path}/Contents/Frameworks", exist_ok=True) os.makedirs(f"{app_path}/Contents/Frameworks", exist_ok=True)
for framework_filename in glob.glob( for framework_filename in glob.glob(
f"{app_path}/Contents/Resources/lib/PySide2/Qt/lib/Qt*.framework" f"{app_path}/Contents/Resources/lib/PySide6/Qt/lib/Qt*.framework"
): ):
basename = os.path.basename(framework_filename) basename = os.path.basename(framework_filename)
os.rename(framework_filename, f"{app_path}/Contents/Frameworks/{basename}") os.rename(framework_filename, f"{app_path}/Contents/Frameworks/{basename}")
run( run(
["ln", "-s", f"../../../../../Frameworks/{basename}"], ["ln", "-s", f"../../../../../Frameworks/{basename}"],
cwd=f"{app_path}/Contents/Resources/lib/PySide2/Qt/lib", cwd=f"{app_path}/Contents/Resources/lib/PySide6/Qt/lib",
) )
if os.path.exists(f"{app_path}/Contents/Frameworks/{basename}/Resources"): if os.path.exists(f"{app_path}/Contents/Frameworks/{basename}/Resources"):
if not os.path.exists(f"{app_path}/Contents/Frameworks/{basename}/Versions/A/Resources"):
os.rename( os.rename(
f"{app_path}/Contents/Frameworks/{basename}/Resources", f"{app_path}/Contents/Frameworks/{basename}/Resources",
f"{app_path}/Contents/Frameworks/{basename}/Versions/5/Resources", f"{app_path}/Contents/Frameworks/{basename}/Versions/A/Resources",
) )
else:
shutil.rmtree(f"{app_path}/Contents/Frameworks/{basename}/Resources")
run( run(
["ln", "-s", "Versions/5/Resources"], ["ln", "-s", "Versions/A/Resources"],
cwd=f"{app_path}/Contents/Frameworks/{basename}", cwd=f"{app_path}/Contents/Frameworks/{basename}",
) )
try: try:
run( run(
["ln", "-s", "5", "Current"], ["ln", "-s", "A", "Current"],
cwd=f"{app_path}/Contents/Frameworks/{basename}/Versions", cwd=f"{app_path}/Contents/Frameworks/{basename}/Versions",
) )
except: except:
@ -205,27 +227,49 @@ def cleanup_build():
# Move Qt plugins # Move Qt plugins
os.rename( os.rename(
f"{app_path}/Contents/Resources/lib/PySide2/Qt/plugins", f"{app_path}/Contents/Resources/lib/PySide6/Qt/plugins",
f"{app_path}/Contents/Frameworks/plugins", f"{app_path}/Contents/Frameworks/plugins",
) )
run( run(
["ln", "-s", "../../../../Frameworks/plugins"], ["ln", "-s", "../../../../Frameworks/plugins"],
cwd=f"{app_path}/Contents/Resources/lib/PySide2/Qt", cwd=f"{app_path}/Contents/Resources/lib/PySide6/Qt",
) )
print("> Delete more unused PySide2 stuff to save space") print("> Delete more unused PySide6 stuff to save space")
for filename in [ for filename in [
f"{app_path}/Contents/Resources/lib/PySide2/Designer.app", f"{app_path}/Contents/Resources/lib/PySide6/Designer.app",
f"{app_path}/Contents/Resources/lib/PySide2/examples", f"{app_path}/Contents/Resources/lib/PySide6/examples",
f"{app_path}/Contents/Resources/lib/PySide2/glue", f"{app_path}/Contents/Resources/lib/PySide6/glue",
f"{app_path}/Contents/Resources/lib/PySide2/include", f"{app_path}/Contents/Resources/lib/PySide6/include",
f"{app_path}/Contents/Resources/lib/PySide2/pyside2-lupdate", f"{app_path}/Contents/Resources/lib/PySide6/lupdate",
f"{app_path}/Contents/Resources/lib/PySide2/rcc", f"{app_path}/Contents/Resources/lib/PySide6/libpyside6.abi3.6.4.dylib",
f"{app_path}/Contents/Resources/lib/PySide2/uic", f"{app_path}/Contents/Resources/lib/PySide6/Qt/qml",
f"{app_path}/Contents/Resources/lib/PySide2/libpyside2.abi3.5.15.dylib", f"{app_path}/Contents/Resources/lib/shiboken6/libshiboken6.abi3.6.4.dylib",
f"{app_path}/Contents/Resources/lib/PySide2/Qt/qml", f"{app_path}/Contents/Resources/lib/PySide6/Assistant.app",
f"{app_path}/Contents/Resources/lib/shiboken2/libshiboken2.abi3.5.15.dylib", f"{app_path}/Contents/Resources/lib/PySide6/Linguist.app",
f"{app_path}/Contents/Resources/lib/shiboken2/docs", f"{app_path}/Contents/Resources/lib/PySide6/libpyside6qml.abi3.6.4.dylib",
f"{app_path}/Contents/Resources/lib/PySide6/lrelease",
f"{app_path}/Contents/Resources/lib/PySide6/qmlformat",
f"{app_path}/Contents/Resources/lib/PySide6/qmllint",
f"{app_path}/Contents/Resources/lib/PySide6/qmlls",
f"{app_path}/Contents/MacOS/QtBluetooth",
f"{app_path}/Contents/MacOS/QtConcurrent",
f"{app_path}/Contents/MacOS/QtDesigner",
f"{app_path}/Contents/MacOS/QtNetworkAuth",
f"{app_path}/Contents/MacOS/QtNfc",
f"{app_path}/Contents/MacOS/QtOpenGL",
f"{app_path}/Contents/MacOS/QtOpenGLWidgets",
f"{app_path}/Contents/MacOS/QtPositioning",
f"{app_path}/Contents/MacOS/QtQuick3D",
f"{app_path}/Contents/MacOS/QtQuick3DRuntimeRender",
f"{app_path}/Contents/MacOS/QtQuick3DUtils",
f"{app_path}/Contents/MacOS/QtShaderTools",
f"{app_path}/Contents/MacOS/QtStateMachine",
f"{app_path}/Contents/MacOS/QtSvgWidgets",
f"{app_path}/Contents/MacOS/QtWebChannel",
f"{app_path}/Contents/MacOS/QtWebEngineCore",
f"{app_path}/Contents/MacOS/QtWebEngineQuick",
f"{app_path}/Contents/MacOS/QtXml",
]: ]:
if os.path.isfile(filename) or os.path.islink(filename): if os.path.isfile(filename) or os.path.islink(filename):
os.remove(filename) os.remove(filename)
@ -250,11 +294,10 @@ def codesign(app_path):
glob.glob(f"{app_path}/Contents/Resources/lib/**/*.so", recursive=True), glob.glob(f"{app_path}/Contents/Resources/lib/**/*.so", recursive=True),
glob.glob(f"{app_path}/Contents/Resources/lib/**/*.dylib", recursive=True), glob.glob(f"{app_path}/Contents/Resources/lib/**/*.dylib", recursive=True),
[ [
f"{app_path}/Contents/Frameworks/QtCore.framework/Versions/5/QtCore", f"{app_path}/Contents/Frameworks/QtCore.framework/Versions/A/QtCore",
f"{app_path}/Contents/Frameworks/QtDBus.framework/Versions/5/QtDBus", f"{app_path}/Contents/Frameworks/QtDBus.framework/Versions/A/QtDBus",
f"{app_path}/Contents/Frameworks/QtGui.framework/Versions/5/QtGui", f"{app_path}/Contents/Frameworks/QtGui.framework/Versions/A/QtGui",
f"{app_path}/Contents/Frameworks/QtMacExtras.framework/Versions/5/QtMacExtras", f"{app_path}/Contents/Frameworks/QtWidgets.framework/Versions/A/QtWidgets",
f"{app_path}/Contents/Frameworks/QtWidgets.framework/Versions/5/QtWidgets",
f"{app_path}/Contents/Resources/lib/Python", f"{app_path}/Contents/Resources/lib/Python",
f"{app_path}/Contents/Resources/lib/onionshare/resources/tor/meek-client", f"{app_path}/Contents/Resources/lib/onionshare/resources/tor/meek-client",
f"{app_path}/Contents/Resources/lib/onionshare/resources/tor/obfs4proxy", f"{app_path}/Contents/Resources/lib/onionshare/resources/tor/obfs4proxy",

View File

@ -102,7 +102,7 @@ if platform.system() == "Darwin" or platform.system() == "Linux":
from_name.__doc__ = importlib_metadata.PathDistribution.from_name.__doc__ from_name.__doc__ = importlib_metadata.PathDistribution.from_name.__doc__
cx_Freeze.module.DistributionCache = DistributionCache #cx_Freeze.module.DistributionCache = DistributionCache
# Discover the version # Discover the version
@ -123,20 +123,20 @@ if platform.system() == "Windows":
exec_icon = os.path.join("onionshare", "resources", "onionshare.ico") exec_icon = os.path.join("onionshare", "resources", "onionshare.ico")
elif platform.system() == "Darwin": elif platform.system() == "Darwin":
import PySide2 import PySide6
import shiboken2 import shiboken6
include_msvcr = False include_msvcr = False
gui_base = None gui_base = None
exec_icon = None exec_icon = None
include_files += [ include_files += [
( (
os.path.join(PySide2.__path__[0], "libpyside2.abi3.5.15.dylib"), os.path.join(PySide6.__path__[0], "libpyside6.abi3.6.4.dylib"),
"libpyside2.abi3.5.15.dylib", "libpyside6.abi3.6.4.dylib",
), ),
( (
os.path.join(shiboken2.__path__[0], "libshiboken2.abi3.5.15.dylib"), os.path.join(shiboken6.__path__[0], "libshiboken6.abi3.6.4.dylib"),
"libshiboken2.abi3.5.15.dylib", "libshiboken6.abi3.6.4.dylib",
), ),
] ]
@ -170,53 +170,53 @@ setup(
"jinja2.ext", "jinja2.ext",
"onionshare", "onionshare",
"onionshare_cli", "onionshare_cli",
"PySide2", "PySide6",
"PySide2.QtCore", "PySide6.QtCore",
"PySide2.QtGui", "PySide6.QtGui",
"PySide2.QtWidgets", "PySide6.QtWidgets",
], ],
"excludes": [ "excludes": [
"test", "test",
"tkinter", "tkinter",
"PySide2.Qt3DAnimation", "PySide6.Qt3DAnimation",
"PySide2.Qt3DCore", "PySide6.Qt3DCore",
"PySide2.Qt3DExtras", "PySide6.Qt3DExtras",
"PySide2.Qt3DInput", "PySide6.Qt3DInput",
"PySide2.Qt3DLogic", "PySide6.Qt3DLogic",
"PySide2.Qt3DRender", "PySide6.Qt3DRender",
"PySide2.QtCharts", "PySide6.QtCharts",
"PySide2.QtConcurrent", "PySide6.QtConcurrent",
"PySide2.QtDataVisualization", "PySide6.QtDataVisualization",
"PySide2.QtHelp", "PySide6.QtHelp",
"PySide2.QtLocation", "PySide6.QtLocation",
"PySide2.QtMultimedia", "PySide6.QtMultimedia",
"PySide2.QtMultimediaWidgets", "PySide6.QtMultimediaWidgets",
"PySide2.QtNetwork", "PySide6.QtNetwork",
"PySide2.QtOpenGL", "PySide6.QtOpenGL",
"PySide2.QtOpenGLFunctions", "PySide6.QtOpenGLFunctions",
"PySide2.QtPositioning", "PySide6.QtPositioning",
"PySide2.QtPrintSupport", "PySide6.QtPrintSupport",
"PySide2.QtQml", "PySide6.QtQml",
"PySide2.QtQuick", "PySide6.QtQuick",
"PySide2.QtQuickControls2", "PySide6.QtQuickControls2",
"PySide2.QtQuickWidgets", "PySide6.QtQuickWidgets",
"PySide2.QtRemoteObjects", "PySide6.QtRemoteObjects",
"PySide2.QtScript", "PySide6.QtScript",
"PySide2.QtScriptTools", "PySide6.QtScriptTools",
"PySide2.QtScxml", "PySide6.QtScxml",
"PySide2.QtSensors", "PySide6.QtSensors",
"PySide2.QtSerialPort", "PySide6.QtSerialPort",
"PySide2.QtSql", "PySide6.QtSql",
"PySide2.QtTest", "PySide6.QtTest",
"PySide2.QtTextToSpeech", "PySide6.QtTextToSpeech",
"PySide2.QtUiTools", "PySide6.QtUiTools",
"PySide2.QtWebChannel", "PySide6.QtWebChannel",
"PySide2.QtWebEngine", "PySide6.QtWebEngine",
"PySide2.QtWebEngineCore", "PySide6.QtWebEngineCore",
"PySide2.QtWebEngineWidgets", "PySide6.QtWebEngineWidgets",
"PySide2.QtWebSockets", "PySide6.QtWebSockets",
"PySide2.QtXml", "PySide6.QtXml",
"PySide2.QtXmlPatterns", "PySide6.QtXmlPatterns",
], ],
"include_files": include_files, "include_files": include_files,
"include_msvcr": include_msvcr, "include_msvcr": include_msvcr,