[nostalgia/studio] Add command for bundling Mac app
	
		
			
	
		
	
	
		
	
		
			All checks were successful
		
		
	
	
		
			
				
	
				Build / build (push) Successful in 1m15s
				
			
		
		
	
	
				
					
				
			
		
			All checks were successful
		
		
	
	Build / build (push) Successful in 1m15s
				
			This commit is contained in:
		
							
								
								
									
										36
									
								
								util/scripts/pkg-dmg.py
									
									
									
									
									
										Executable file
									
								
							
							
						
						
									
										36
									
								
								util/scripts/pkg-dmg.py
									
									
									
									
									
										Executable file
									
								
							@@ -0,0 +1,36 @@
 | 
			
		||||
#! /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}/Nostalgia Studio.app')
 | 
			
		||||
os.symlink('/Applications', f'{dmg_dir}/Applications')
 | 
			
		||||
run(['hdiutil', 'create', '-srcfolder', dmg_dir, dmg])
 | 
			
		||||
		Reference in New Issue
	
	Block a user