From b12f45be95e99690f068d0c4480ef98971851123 Mon Sep 17 00:00:00 2001 From: Mat Kelly Date: Tue, 12 Jan 2016 11:49:44 -0500 Subject: [PATCH] Tie-in with dmgbuild for #213 --- build/Info.plist | 2 +- bundledApps/MAKEFILE.sh | 96 +++++++++++++++++++++++++++++++---------- requirements.txt | 3 +- 3 files changed, 76 insertions(+), 25 deletions(-) diff --git a/build/Info.plist b/build/Info.plist index 8ef4bd98..6c230cdc 100644 --- a/build/Info.plist +++ b/build/Info.plist @@ -3,7 +3,7 @@ CFBundleShortVersionString - 2015.11.09 + 2016.01.12 NSHumanReadableCopyright Mat Kelly CFBundleExecutable diff --git a/bundledApps/MAKEFILE.sh b/bundledApps/MAKEFILE.sh index 6f57e0bb..009dec4c 100644 --- a/bundledApps/MAKEFILE.sh +++ b/bundledApps/MAKEFILE.sh @@ -39,30 +39,80 @@ if [ -d "$DIRECTORY" ]; then done fi +read -p "Would you like to install binary, create dmg, or both? (i/d/b) " ans + +case "$ans" in + i|d|b) + ;; + *) + echo "Invalid choice, choose one of i/d/b" + exit + ;; +esac + + + +createBinary () +{ + pyinstaller ./bundledApps/WAIL.py --onefile --windowed --clean --icon="./build/icons/whale_1024.icns" + # Replace default version and icon information from pyinstaller + cp ./build/Info.plist ./dist/WAIL.app/Contents/Info.plist + # Copy the bundledApps and support directories to inside WAIL.app/ + cp -r ./bundledApps ./support ./build ./config ./archives ./archiveIndexes ./dist/WAIL.app/ + #pkgbuild --install-location=/Applications --component ./dist/WAIL.app ~/Downloads/WAIL.pkg +} + +deleteBinary () +{ + rm -rf /Applications/WAIL.app +} + +mvProducts () +{ + mv ./dist/WAIL.app /Applications/ + mv ./dist/WAIL /Applications/WAIL_cli +} + +cleanupByproducts () +{ + # Remove installation remnants + rm -r ./dist + rm -r ./build/WAIL +} + +buildDiskImage () +{ + # Create a dmg + dmgbuild -s ./build/dmgbuild_settings.py "WAIL" WAIL.dmg +} + +tweakOS () +{ + # Instruct the system to update the version string + defaults read /Applications/WAIL.app/Contents/Info.plist > /dev/null + + # Associate defined file types with WAIL + /System/Library/Frameworks/CoreServices.framework/Versions/A/Frameworks/LaunchServices.framework/Versions/A/Support/lsregister -f /Applications/WAIL.app +} + +createBinary +deleteBinary # Remove previous version +mvProducts +cleanupByproducts + +# install binary, create dmg, or both? (i/d/b) + +# Just build dmg, delete binary, no system tweaks required +if [ $ans = "b" ] || [ $ans = "d" ]; then + buildDiskImage + if [ $ans = "b" ]; then + deleteBinary + fi +fi -pyinstaller ./bundledApps/WAIL.py --onefile --windowed --clean --icon="./build/icons/whale_1024.icns" - -# Replace default version and icon information from pyinstaller -cp ./build/Info.plist ./dist/WAIL.app/Contents/Info.plist - -# Copy the bundledApps and support directories to inside WAIL.app/ -cp -r ./bundledApps ./support ./build ./config ./archives ./archiveIndexes ./dist/WAIL.app/ - -#pkgbuild --install-location=/Applications --component ./dist/WAIL.app ~/Downloads/WAIL.pkg - -rm -rf /Applications/WAIL.app -mv ./dist/WAIL.app /Applications/ -mv ./dist/WAIL /Applications/WAIL_cli - -# Remove installation remnants -rm -r ./dist -rm -r ./build/WAIL - -# Instruct the system to update the version string -defaults read /Applications/WAIL.app/Contents/Info.plist > /dev/null - -# Associate defined file types with WAIL -/System/Library/Frameworks/CoreServices.framework/Versions/A/Frameworks/LaunchServices.framework/Versions/A/Support/lsregister -f /Applications/WAIL.app +if [ $ans = "i" ] || [ $ans = "d" ]; then # Tweak system for binary + tweakOS +fi #killall Finder #cleanup diff --git a/requirements.txt b/requirements.txt index 9e75b03a..a17aa4e3 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,3 +1,4 @@ requests wxPython -pystache \ No newline at end of file +pystache +dmgbuild \ No newline at end of file