-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmake_dist_macos.command
executable file
·104 lines (84 loc) · 3.91 KB
/
make_dist_macos.command
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
APP_NAME=MediaPlayerSE
APP_ICON=app.icns
cd "$(dirname "$0")"
rm -R "dist/$APP_NAME" 2>/dev/null
rm -R "dist/$APP_NAME.app" 2>/dev/null
rm -R "dist/$APP_NAME.dmg" 2>/dev/null
echo
echo '****************************************'
echo 'Checking requirements...'
echo '****************************************'
pip install -r requirements_macos.txt
pip install -r requirements_dist.txt
echo
echo '****************************************'
echo 'Running pyinstaller...'
echo '****************************************'
# pyinstaller --noupx -w -i "$APP_ICON" -n "$APP_NAME" -D main.py --exclude-module _bootlocale
pyinstaller "${APP_NAME}_macos.spec"
echo
echo '****************************************'
echo 'Copying resources...'
echo '****************************************'
cp resources/main.ui "dist/$APP_NAME.app/Contents/Resources/"
cp resources/main.rcc "dist/$APP_NAME.app/Contents/Resources/"
cp resources/style.css "dist/$APP_NAME.app/Contents/Resources/"
cp resources/mediainfos.ui "dist/$APP_NAME.app/Contents/Resources/"
cp resources/mediainfo "dist/$APP_NAME.app/Contents/Resources/"
echo
echo '****************************************'
echo 'Optimizing application...'
echo '****************************************'
rm "dist/$APP_NAME.app/Contents/Frameworks/libcrypto.3.dylib"
rm "dist/$APP_NAME.app/Contents/Frameworks/libssl.3.dylib"
rm "dist/$APP_NAME.app/Contents/Resources/libcrypto.3.dylib"
rm "dist/$APP_NAME.app/Contents/Resources/libssl.3.dylib"
rm -R "dist/$APP_NAME.app/Contents/Frameworks/PyQt5/uic"
rm -R "dist/$APP_NAME.app/Contents/Resources/PyQt5/uic"
rm -R "dist/$APP_NAME.app/Contents/Frameworks/PyQt5/Qt5/translations"
rm -R "dist/$APP_NAME.app/Contents/Resources/PyQt5/Qt5/translations"
rm -R "dist/$APP_NAME.app/Contents/Frameworks/PyQt5/Qt5/lib/QtQml.framework"
rm -R "dist/$APP_NAME.app/Contents/Frameworks/PyQt5/Qt5/lib/QtQmlModels.framework"
rm -R "dist/$APP_NAME.app/Contents/Frameworks/PyQt5/Qt5/lib/QtQuick.framework"
rm -R "dist/$APP_NAME.app/Contents/Frameworks/PyQt5/Qt5/lib/QtSvg.framework"
rm -R "dist/$APP_NAME.app/Contents/Frameworks/PyQt5/Qt5/lib/QtWebSockets.framework"
rm "dist/$APP_NAME.app/Contents/Frameworks/QtQml"
rm "dist/$APP_NAME.app/Contents/Frameworks/QtQmlModels"
rm "dist/$APP_NAME.app/Contents/Frameworks/QtQuick"
rm "dist/$APP_NAME.app/Contents/Frameworks/QtSvg"
rm "dist/$APP_NAME.app/Contents/Frameworks/QtWebSockets"
rm "dist/$APP_NAME.app/Contents/Resources/QtQml"
rm "dist/$APP_NAME.app/Contents/Resources/QtQmlModels"
rm "dist/$APP_NAME.app/Contents/Resources/QtQuick"
rm "dist/$APP_NAME.app/Contents/Resources/QtSvg"
rm "dist/$APP_NAME.app/Contents/Resources/QtWebSockets"
rm -R "dist/$APP_NAME.app/Contents/Frameworks/PyQt5/Qt5/plugins/generic"
rm -R "dist/$APP_NAME.app/Contents/Frameworks/PyQt5/Qt5/plugins/iconengines"
rm -R "dist/$APP_NAME.app/Contents/Frameworks/PyQt5/Qt5/plugins/imageformats"
rm -R "dist/$APP_NAME.app/Contents/Frameworks/PyQt5/Qt5/plugins/platformthemes"
rm -R "dist/$APP_NAME.app/Contents/Frameworks/PyQt5/Qt5/plugins/platforms/libqminimal.dylib"
rm -R "dist/$APP_NAME.app/Contents/Frameworks/PyQt5/Qt5/plugins/platforms/libqoffscreen.dylib"
rm -R "dist/$APP_NAME.app/Contents/Frameworks/PyQt5/Qt5/plugins/platforms/libqwebgl.dylib"
# echo
# echo '****************************************'
# echo 'Creating ZIP...'
# echo '****************************************'
# cd dist
# rm "$APP_NAME-macos.zip" 2>/dev/null
# zip -q -r "$APP_NAME-macos.zip" "$APP_NAME.app"
# cd ..
echo
echo '****************************************'
echo 'Creating DMG...'
echo '****************************************'
mkdir dist/dmg
mv "dist/$APP_NAME.app" dist/dmg/
ln -s /Applications "dist/dmg/Applications"
hdiutil create -fs HFSX -format UDZO "dist/$APP_NAME.dmg" -imagekey zlib-level=9 -srcfolder "dist/dmg" -volname "$APP_NAME"
mv "dist/dmg/$APP_NAME.app" dist/
rm -R dist/dmg
echo
echo '****************************************'
echo 'Done.'
echo '****************************************'
echo