jasper/util/scripts/pkg-dmg.py
Gary Talent 71b1e79d61 Squashed 'deps/nostalgia/' changes from 26fe266b..0de428a2
0de428a2 [studio/applib] Cleanup
8a52df4f [nostalgia/gfx] More cleanup
efec6eb3 [nostalgia/gfx/studio/palette] Add RGB key shortcuts for focusing color channels
56eeb249 [nostalgia/gfx/opengl] More cleanup
ae81f6b3 [ox/std] Make Span::operator[] const
c1108301 [nostalgia/gfx] Cleanup
83fbe6ac [keel,turbine,studio] Fix some install mistakes
80b45283 [nostalgia/gfx] Cleanup
0fa39433 [nostalgia] Add release note about Mac menubar using Cmd
cae75350 [nostalgia] Fix typos in release notes
df878323 [studio] Add build date to About
d585794c [nostalgia/gfx/studio/tilesheet] Fix Insert tile command
20965854 [nostalgia/gfx/studio/tilesheet] Cleanup
02383a4a [ox/std] Cleanup
185a7628 [nostalgia] Make pkg-dmg delete bundle after archive created
b722b4f7 [nostalgia] Update release notes
459ab5aa [studio] Remove ability to re-order Editor tabs
565f621c [nostalgia/gfx/studio/tilesheet] Fix Delete Tile functionality
9589ca91 [keel] Cleanup
164db500 [keel] Cleanup
cbfb167d [nostalgia] Remove unused project directory
e7b83be8 [nostalgia] Update release notes
649da5fc [nostalgia/sample_project] Delete Scenes directory
aa095f76 [studio] Make Delete key initiate deletion of selected directory
bb99c99f [studio] Make deleting a directory close files in that directory
7f0dcdd2 [nostalgia/gfx/studio/tilesheet] Cleanup
6029ad5d [nostalgia/studio] Add command for bundling Mac app

git-subtree-dir: deps/nostalgia
git-subtree-split: 0de428a2e588d3360b98aa7e00c2498d5a54019b
2025-05-14 22:31:06 -05:00

38 lines
848 B
Python
Executable File

#! /usr/bin/env python3
import os
import shutil
import subprocess
import sys
def rm(path: str):
file_exists = os.path.exists(path)
is_link = os.path.islink(path)
is_dir = os.path.isdir(path)
if (file_exists or is_link) and not is_dir:
os.remove(path)
elif os.path.isdir(path):
shutil.rmtree(path)
def mkdir_p(path: str):
if not os.path.exists(path):
os.mkdir(path)
def run(args: list[str]):
if subprocess.run(args).returncode != 0:
sys.exit(1)
dmg_dir = 'dist/darwin-arm64-release/NostalgiaStudio'
dmg = f'{dmg_dir}.dmg'
rm(dmg)
rm(dmg_dir)
mkdir_p(dmg_dir)
shutil.copytree('dist/darwin-arm64-release/NostalgiaStudio.app', f'{dmg_dir}/NostalgiaStudio.app')
os.symlink('/Applications', f'{dmg_dir}/Applications')
run(['hdiutil', 'create', '-srcfolder', dmg_dir, dmg])
rm(dmg_dir)