Working on the macOS cx_Freeze

This commit is contained in:
Micah Lee 2023-09-28 16:28:40 -07:00
parent 35e288e60f
commit ed90261833
No known key found for this signature in database
GPG Key ID: 403C2657CD994F73
2 changed files with 18 additions and 92 deletions

View File

@ -178,98 +178,37 @@ def cleanup_build():
except FileNotFoundError:
pass
print("> Move files around so Apple will notarize")
# https://github.com/marcelotduarte/cx_Freeze/issues/594
# https://gist.github.com/TechnicalPirate/259a9c24878fcad948452cb148af2a2c#file-custom_bdist_mac-py-L415
# Move lib from MacOS into Resources
os.rename(
f"{app_path}/Contents/MacOS/lib",
f"{app_path}/Contents/Resources/lib",
)
run(
["ln", "-s", "../Resources/lib"],
cwd=f"{app_path}/Contents/MacOS",
)
# Move frameworks from Resources/lib into Frameworks
os.makedirs(f"{app_path}/Contents/Frameworks", exist_ok=True)
for framework_filename in glob.glob(
f"{app_path}/Contents/Resources/lib/PySide6/Qt/lib/Qt*.framework"
):
basename = os.path.basename(framework_filename)
os.rename(framework_filename, f"{app_path}/Contents/Frameworks/{basename}")
run(
["ln", "-s", f"../../../../../Frameworks/{basename}"],
cwd=f"{app_path}/Contents/Resources/lib/PySide6/Qt/lib",
)
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(
f"{app_path}/Contents/Frameworks/{basename}/Resources",
f"{app_path}/Contents/Frameworks/{basename}/Versions/A/Resources",
)
else:
shutil.rmtree(f"{app_path}/Contents/Frameworks/{basename}/Resources")
run(
["ln", "-s", "Versions/A/Resources"],
cwd=f"{app_path}/Contents/Frameworks/{basename}",
)
try:
run(
["ln", "-s", "A", "Current"],
cwd=f"{app_path}/Contents/Frameworks/{basename}/Versions",
)
except:
pass
# Move Qt plugins
os.rename(
f"{app_path}/Contents/Resources/lib/PySide6/Qt/plugins",
f"{app_path}/Contents/Frameworks/plugins",
)
run(
["ln", "-s", "../../../../Frameworks/plugins"],
cwd=f"{app_path}/Contents/Resources/lib/PySide6/Qt",
)
print("> Delete more unused PySide6 stuff to save space")
for filename in [
f"{app_path}/Contents/Resources/lib/PySide6/Designer.app",
f"{app_path}/Contents/Resources/lib/PySide6/examples",
f"{app_path}/Contents/Resources/lib/PySide6/glue",
f"{app_path}/Contents/Resources/lib/PySide6/include",
f"{app_path}/Contents/Resources/lib/PySide6/lupdate",
f"{app_path}/Contents/Resources/lib/PySide6/libpyside6.abi3.6.4.dylib",
f"{app_path}/Contents/Resources/lib/PySide6/Qt/qml",
f"{app_path}/Contents/Resources/lib/shiboken6/libshiboken6.abi3.6.4.dylib",
f"{app_path}/Contents/Resources/lib/PySide6/Assistant.app",
f"{app_path}/Contents/Resources/lib/PySide6/Linguist.app",
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",
f"{app_path}/Contents/Resources/lib/QtBluetooth",
f"{app_path}/Contents/Resources/lib/QtConcurrent",
f"{app_path}/Contents/Resources/lib/QtDesigner",
f"{app_path}/Contents/Resources/lib/QtNetworkAuth",
f"{app_path}/Contents/Resources/lib/QtNfc",
f"{app_path}/Contents/Resources/lib/QtOpenGL",
f"{app_path}/Contents/Resources/lib/QtOpenGLWidgets",
f"{app_path}/Contents/Resources/lib/QtPositioning",
f"{app_path}/Contents/Resources/lib/QtQuick3D",
f"{app_path}/Contents/Resources/lib/QtQuick3DRuntimeRender",
f"{app_path}/Contents/Resources/lib/QtQuick3DUtils",
f"{app_path}/Contents/Resources/lib/QtShaderTools",
f"{app_path}/Contents/Resources/lib/QtStateMachine",
f"{app_path}/Contents/Resources/lib/QtSvgWidgets",
f"{app_path}/Contents/Resources/lib/QtWebChannel",
f"{app_path}/Contents/Resources/lib/QtWebEngineCore",
f"{app_path}/Contents/Resources/lib/QtWebEngineQuick",
f"{app_path}/Contents/Resources/lib/QtXml",
]:
if os.path.isfile(filename) or os.path.islink(filename):
os.remove(filename)

View File

@ -44,22 +44,9 @@ if platform.system() == "Windows":
exec_icon = os.path.join("onionshare", "resources", "onionshare.ico")
elif platform.system() == "Darwin":
import PySide6
import shiboken6
include_msvcr = False
gui_base = None
exec_icon = None
include_files += [
(
os.path.join(PySide6.__path__[0], "libpyside6.abi3.6.5.dylib"),
"libpyside6.abi3.6.5.dylib",
),
(
os.path.join(shiboken6.__path__[0], "libshiboken6.abi3.6.5.dylib"),
"libshiboken6.abi3.6.5.dylib",
),
]
elif platform.system() == "Linux":
include_msvcr = False