Migrate from PyInstaller to cx_Freeze for OSX

This commit is contained in:
Micah Lee 2016-09-04 19:21:09 -07:00
parent 79938e9518
commit db9d81ba90
No known key found for this signature in database
GPG key ID: 403C2657CD994F73
6 changed files with 123 additions and 150 deletions

18
install/Info.plist Normal file
View file

@ -0,0 +1,18 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>CFBundleDevelopmentRegion</key>
<string>English</string>
<key>CFBundleExecutable</key>
<string>onionshare-gui</string>
<key>CFBundleIdentifier</key>
<string>com.micahflee.onionshare</string>
<key>NSHighResolutionCapable</key>
<true/>
<key>CFBundleShortVersionString</key>
<string>{VERSION}</string>
<key>CFBundleIconFile</key>
<string>icon.icns</string>
</dict>
</plist>

View file

@ -5,19 +5,27 @@ cd $ROOT
# deleting dist
echo Deleting dist folder
rm -rf $ROOT/dist &>/dev/null 2>&1
rm -rf $ROOT/build $ROOT/dist &>/dev/null 2>&1
# build the .app
echo Building OnionShare.app
pyinstaller install/pyinstaller.spec
python3 setup.py bdist_mac
if [ "$1" = "--sign" ]; then
SIGNING_IDENTITY_APP="3rd Party Mac Developer Application: Micah Lee"
SIGNING_IDENTITY_INSTALLER="3rd Party Mac Developer Installer: Micah Lee"
if [ "$1" = "--release" ]; then
mkdir -p dist
APP_PATH="build/OnionShare.app"
PKG_PATH="dist/OnionShare.pkg"
IDENTITY_NAME_APPLICATION="Developer ID Application: Micah Lee"
IDENTITY_NAME_INSTALLER="Developer ID Installer: Micah Lee"
# codesign the .app
codesign -vvvv --deep -s "$SIGNING_IDENTITY_APP" dist/OnionShare.app
echo "Codesigning the app bundle"
codesign --deep -s "$IDENTITY_NAME_APPLICATION" "$APP_PATH"
# build .pkg
productbuild --component dist/OnionShare.app /Applications dist/OnionShare.pkg --sign "$SIGNING_IDENTITY_INSTALLER"
echo "Creating an installer"
productbuild --sign "$IDENTITY_NAME_INSTALLER" --component "$APP_PATH" /Applications "$PKG_PATH"
echo "Cleaning up"
rm -rf "$APP_PATH"
echo "All done, your installer is in: $PKG_PATH"
fi

View file

@ -1,62 +0,0 @@
# -*- mode: python -*-
import platform
system = platform.system()
version = open('resources/version.txt').read().strip()
block_cipher = None
a = Analysis(
['scripts/onionshare-gui'],
pathex=['.'],
binaries=None,
datas=[
('../resources/images/*', 'images'),
('../resources/locale/*', 'locale'),
('../resources/html/*', 'html'),
('../resources/version.txt', '.'),
('../resources/wordlist.txt', '.')
],
hiddenimports=[],
hookspath=[],
runtime_hooks=[],
excludes=[],
win_no_prefer_redirects=False,
win_private_assemblies=False,
cipher=block_cipher)
pyz = PYZ(
a.pure, a.zipped_data,
cipher=block_cipher)
exe = EXE(
pyz,
a.scripts,
exclude_binaries=True,
name='onionshare',
debug=False,
strip=False,
upx=True,
console=False)
coll = COLLECT(
exe,
a.binaries,
a.zipfiles,
a.datas,
strip=False,
upx=True,
name='onionshare')
if system == 'Darwin':
app = BUNDLE(
coll,
name='OnionShare.app',
icon='install/onionshare.icns',
bundle_identifier='com.micahflee.onionshare',
info_plist={
'CFBundleShortVersionString': version,
'NSHighResolutionCapable': 'True'
}
)