Skip to content

Commit

Permalink
Fix dmg packaging (#46)
Browse files Browse the repository at this point in the history
* Fix dmg background image and icon locations
* Fix application name and title
* Fix macos build version metadata
  • Loading branch information
SergeBakharev authored Nov 9, 2024
1 parent 3f30f66 commit d08c2a6
Show file tree
Hide file tree
Showing 5 changed files with 30 additions and 13 deletions.
3 changes: 0 additions & 3 deletions .github/workflows/release.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -80,9 +80,6 @@ jobs:

- name: Build release
run: poetry run python scripts/build.py --os macos

- name: Debug
run: ls ./dist

- name: Install create-dmg
run: brew install create-dmg
Expand Down
4 changes: 2 additions & 2 deletions carveracontroller/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -3527,7 +3527,7 @@ def load(self, filepath):
self.loading_file = False
if f:
f.close()
Clock.schedule_once(partial(self.load_error, tr._('Openning file error:') + '\n\'%s\'\n' % (filepath) + tr._('Please make sure the GCode file is valid')), 0)
Clock.schedule_once(partial(self.load_error, tr._('Opening file error:') + '\n\'%s\'\n' % (filepath) + tr._('Please make sure the GCode file is valid')), 0)
return

Clock.schedule_once(self.load_end, 0)
Expand Down Expand Up @@ -3610,7 +3610,7 @@ def on_stop(self):
def build(self):
self.settings_cls = SettingsWithSidebar
self.use_kivy_settings = True
self.title = tr._('Carvera Controller')
self.title = tr._('Carvera Controller Community')

return Makera(ctl_version=VERSION)

Expand Down
Binary file added packaging_assets/dmg_background.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
17 changes: 16 additions & 1 deletion scripts/build.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
logger = logging.getLogger(__name__)

# ------ Build config ------
APP_NAME = "CarveraController-Community"
APP_NAME = "Carvera-Controller-Community"
PACKAGE_NAME = "carveracontroller"
ASSETS_FOLDER = "packaging_assets"

Expand Down Expand Up @@ -150,6 +150,14 @@ def revise_appimage_definition():
yaml.dump(appimage_def, file)


def fix_macos_version_string(version)-> None:
command = f"plutil -replace CFBundleShortVersionString -string {version} dist/*.app/Contents/Info.plist"
result = subprocess.run(command, shell=True, capture_output=False, text=True)
if result.returncode != 0:
logger.error(f"Error executing command: {command}")
logger.error(f"stderr: {result.stderr}")
sys.exit(result.returncode)

def main():
parser = argparse.ArgumentParser()
parser.add_argument(
Expand Down Expand Up @@ -195,6 +203,13 @@ def main():

if appimage:
run_appimage_builder()

if os == "macos":
# Need to manually revise the version string due to
# https://github.com/pyinstaller/pyinstaller/issues/6943
import PyInstaller.utils.osx as osxutils
fix_macos_version_string(get_version_info())
osxutils.sign_binary(f"dist/{PACKAGE_NAME}.app", deep=True)

if __name__ == "__main__":
main()
19 changes: 12 additions & 7 deletions scripts/create-dmg.sh
Original file line number Diff line number Diff line change
Expand Up @@ -3,16 +3,21 @@
echo "Remove previous build if exists ..."
rm -rf ./dist/carveracontroller-community.dmg

echo "Create DMG ..."
# rename .app
mv "./dist/carveracontroller.app" "./dist/Carvera Controller Community.app"

echo "Creating DMG ..."
create-dmg \
--volname "carveracontroller-community" \
--volname "carvera-controller-community" \
--background "packaging_assets/dmg_background.jpg" \
--volicon "packaging_assets/icon-src.icns" \
--window-pos 200 200 \
--window-size 460 160 \
--icon "carveracontroller.app" 256 256 \
--window-size 640 324 \
--icon "Carvera Controller Community.app" 130 130 \
--icon-size 64 \
--hide-extension "carveracontroller.app" \
--app-drop-link 325 80 \
--hide-extension "Carvera Controller Community.app" \
--app-drop-link 510 130 \
--format UDBZ \
--no-internet-enable \
"./dist/carveracontroller-community.dmg" \
"./dist/carveracontroller.app"
"./dist/Carvera Controller Community.app"

0 comments on commit d08c2a6

Please sign in to comment.