Merge pull request #1880 from onionshare/fix-macos-silicon-build

Adds packages in zip_include_packages as well
This commit is contained in:
Micah Lee 2024-02-28 07:54:23 -08:00 committed by GitHub
commit 0d7f55dc0e
3 changed files with 90 additions and 69 deletions

View File

@ -238,8 +238,6 @@ Make the Apple Silicon app bundle:
```sh ```sh
/Library/Frameworks/Python.framework/Versions/3.11/bin/poetry run python ./setup-freeze.py bdist_mac /Library/Frameworks/Python.framework/Versions/3.11/bin/poetry run python ./setup-freeze.py bdist_mac
rm -rf build/OnionShare.app/Contents/Resources/lib
mv build/exe.macosx-10.9-universal2-3.11/lib build/OnionShare.app/Contents/Resources/
/Library/Frameworks/Python.framework/Versions/3.11/bin/poetry run python ./scripts/build-macos.py cleanup-build /Library/Frameworks/Python.framework/Versions/3.11/bin/poetry run python ./scripts/build-macos.py cleanup-build
``` ```

View File

@ -167,12 +167,15 @@ def cleanup_build():
"QtWebEngineQuick", "QtWebEngineQuick",
"QtWebEngineQuickDelegatesQml", "QtWebEngineQuickDelegatesQml",
]: ]:
try:
shutil.rmtree( shutil.rmtree(
f"{app_path}/Contents/MacOS/lib/PySide6/Qt/lib/{framework}.framework" f"{app_path}/Contents/MacOS/lib/PySide6/Qt/lib/{framework}.framework"
) )
print( print(
f"Deleted: {app_path}/Contents/MacOS/lib/PySide6/Qt/lib/{framework}.framework" f"Deleted: {app_path}/Contents/MacOS/lib/PySide6/Qt/lib/{framework}.framework"
) )
except FileNotFoundError:
pass
try: try:
os.remove(f"{app_path}/Contents/MacOS/lib/PySide6/{framework}.abi3.so") os.remove(f"{app_path}/Contents/MacOS/lib/PySide6/{framework}.abi3.so")
print(f"Deleted: {app_path}/Contents/MacOS/lib/PySide6/{framework}.abi3.so") print(f"Deleted: {app_path}/Contents/MacOS/lib/PySide6/{framework}.abi3.so")

View File

@ -57,18 +57,8 @@ elif platform.system() == "Linux":
print("Install the patchelf package") print("Install the patchelf package")
sys.exit() sys.exit()
setup(
name="onionshare", build_exe_options = {
version=version,
description="Securely and anonymously share files, host websites, and chat with friends using the Tor network",
packages=find_packages(
where=".",
include=["onionshare"],
exclude=["package", "screenshots", "scripts", "tests"],
),
options={
# build_exe, for Windows and macOS
"build_exe": {
"packages": [ "packages": [
"cffi", "cffi",
"engineio", "engineio",
@ -79,6 +69,7 @@ setup(
"onionshare", "onionshare",
"onionshare_cli", "onionshare_cli",
"PySide6", "PySide6",
"shiboken6",
"PySide6.QtCore", "PySide6.QtCore",
"PySide6.QtGui", "PySide6.QtGui",
"PySide6.QtWidgets", "PySide6.QtWidgets",
@ -128,7 +119,36 @@ setup(
], ],
"include_files": include_files, "include_files": include_files,
"include_msvcr": include_msvcr, "include_msvcr": include_msvcr,
}, }
# If Mac Silicon, the dependencies need to be in zip_include_packages
if platform.system() == "Darwin" and platform.processor() == "arm":
build_exe_options["zip_include_packages"] = [
"cffi",
"engineio",
"engineio.async_drivers.gevent",
"engineio.async_drivers.gevent_uwsgi",
"gevent",
"jinja2.ext",
"PySide6",
"shiboken6",
"PySide6.QtCore",
"PySide6.QtGui",
"PySide6.QtWidgets",
]
setup(
name="onionshare",
version=version,
description="Securely and anonymously share files, host websites, and chat with friends using the Tor network",
packages=find_packages(
where=".",
include=["onionshare"],
exclude=["package", "screenshots", "scripts", "tests"],
),
options={
# build_exe, for Windows and macOS
"build_exe": build_exe_options,
# bdist_mac, making the macOS app bundle # bdist_mac, making the macOS app bundle
"bdist_mac": { "bdist_mac": {
"iconfile": os.path.join("onionshare", "resources", "onionshare.icns"), "iconfile": os.path.join("onionshare", "resources", "onionshare.icns"),