mirror of
https://github.com/barry-ran/QtScrcpy.git
synced 2025-07-28 19:58:38 +00:00
feat: mac package dmg
This commit is contained in:
parent
905880530f
commit
4f013e58b5
6 changed files with 117 additions and 3 deletions
55
ci/mac/package/package.py
Normal file
55
ci/mac/package/package.py
Normal file
|
@ -0,0 +1,55 @@
|
|||
import dmgbuild
|
||||
import os
|
||||
import json
|
||||
import sys
|
||||
|
||||
current_file_path = os.path.dirname(os.path.realpath(__file__))
|
||||
dmg_settings_path = '%s/dmg-settings.json' % current_file_path
|
||||
dmg_background_img = '%s/dmg-background.jpg' % current_file_path
|
||||
app_path = '%s/../../build/QtScrcpy.app' % current_file_path
|
||||
dmg_path = '%s/../../build/QtScrcpy.dmg' % current_file_path
|
||||
app_name = 'QtScrcpy'
|
||||
|
||||
def console_print(msg):
|
||||
print(msg)
|
||||
sys.stdout.flush()
|
||||
|
||||
def generate_dmg_info():
|
||||
with open(dmg_settings_path, 'w') as file:
|
||||
info = {
|
||||
'title': app_name,
|
||||
'icon-size': 120,
|
||||
'background': dmg_background_img,
|
||||
'format': 'UDZO',
|
||||
'compression-level': 9,
|
||||
'window': {
|
||||
'position': {'x': 400, 'y': 200},
|
||||
'size': {'width': 780, 'height': 480}
|
||||
},
|
||||
'contents': [
|
||||
{
|
||||
'x': 223,
|
||||
'y': 227,
|
||||
'type': 'file',
|
||||
'path': app_path
|
||||
},
|
||||
{
|
||||
'x': 550,
|
||||
'y': 227,
|
||||
'type': 'link',
|
||||
'path': '/Applications'
|
||||
}
|
||||
]
|
||||
}
|
||||
json.dump(info, file)
|
||||
|
||||
if __name__ == '__main__':
|
||||
console_print('generate dmg info')
|
||||
generate_dmg_info()
|
||||
console_print('build dmg: %s' % dmg_path)
|
||||
dmgbuild.build_dmg(dmg_path, app_name, dmg_settings_path)
|
||||
if not os.path.exists(dmg_path):
|
||||
console_print('fail to create %s' % dmg_path)
|
||||
sys.exit(1)
|
||||
|
||||
sys.exit(0)
|
Loading…
Add table
Add a link
Reference in a new issue