18
18
19
19
import sys , re , os , platform , shutil , stat , subprocess , os .path
20
20
from argparse import ArgumentParser
21
- from ds_store import DSStore
22
- from mac_alias import Alias
23
21
from pathlib import Path
24
22
from subprocess import PIPE , run
25
23
from typing import List , Optional
@@ -385,7 +383,7 @@ def deployPlugins(appBundleInfo: ApplicationBundleInfo, deploymentInfo: Deployme
385
383
386
384
ap = ArgumentParser (description = """Improved version of macdeployqt.
387
385
388
- Outputs a ready-to-deploy app in a folder "dist" and optionally wraps it in a .dmg file.
386
+ Outputs a ready-to-deploy app in a folder "dist" and optionally wraps it in a .zip file.
389
387
Note, that the "dist" folder will be deleted before deploying on each run.
390
388
391
389
Optionally, Qt translation files (.qm) can be added to the bundle.""" )
@@ -395,7 +393,6 @@ ap.add_argument("appname", nargs=1, metavar="appname", help="name of the app bei
395
393
ap .add_argument ("-verbose" , nargs = "?" , const = True , help = "Output additional debugging information" )
396
394
ap .add_argument ("-no-plugins" , dest = "plugins" , action = "store_false" , default = True , help = "skip plugin deployment" )
397
395
ap .add_argument ("-no-strip" , dest = "strip" , action = "store_false" , default = True , help = "don't run 'strip' on the binaries" )
398
- ap .add_argument ("-dmg" , nargs = "?" , const = "" , metavar = "basename" , help = "create a .dmg disk image" )
399
396
ap .add_argument ("-translations-dir" , nargs = 1 , metavar = "path" , default = None , help = "Path to Qt's translations. Base translations will automatically be added to the bundle's resources." )
400
397
ap .add_argument ("-zip" , nargs = "?" , const = "" , metavar = "zip" , help = "create a .zip containing the app bundle" )
401
398
@@ -418,12 +415,9 @@ if os.path.exists("dist"):
418
415
print ("+ Removing existing dist folder +" )
419
416
shutil .rmtree ("dist" )
420
417
421
- if os .path .exists (appname + ".dmg" ):
422
- print ("+ Removing existing DMG +" )
423
- os .unlink (appname + ".dmg" )
424
-
425
- if os .path .exists (appname + ".temp.dmg" ):
426
- os .unlink (appname + ".temp.dmg" )
418
+ if os .path .exists (appname + ".zip" ):
419
+ print ("+ Removing existing .zip +" )
420
+ os .unlink (appname + ".zip" )
427
421
428
422
# ------------------------------------------------
429
423
@@ -498,100 +492,9 @@ with open(os.path.join(applicationBundle.resourcesPath, "qt.conf"), "wb") as f:
498
492
499
493
# ------------------------------------------------
500
494
501
- print ("+ Generating .DS_Store +" )
502
-
503
- output_file = os .path .join ("dist" , ".DS_Store" )
504
-
505
- ds = DSStore .open (output_file , 'w+' )
506
-
507
- ds ['.' ]['bwsp' ] = {
508
- 'WindowBounds' : '{{300, 280}, {500, 343}}' ,
509
- 'PreviewPaneVisibility' : False ,
510
- }
511
-
512
- icvp = {
513
- 'gridOffsetX' : 0.0 ,
514
- 'textSize' : 12.0 ,
515
- 'viewOptionsVersion' : 1 ,
516
- 'backgroundImageAlias' : b'\x00 \x00 \x00 \x00 \x02 \x1e \x00 \x02 \x00 \x00 \x00 \x00 \x00 \x00 \x00 \x00 \x00 \x00 \x00 \x00 \x00 \x00 \x00 \x00 \x00 \x00 \x00 \x00 \x00 \x00 \x00 \x00 \x00 \x00 \x00 \x00 \x00 \x00 \xd1 \x94 \\ \xb0 H+\x00 \x05 \x00 \x00 \x00 \x98 \x0f background.tiff\x00 \x00 \x00 \x00 \x00 \x00 \x00 \x00 \x00 \x00 \x00 \x00 \x00 \x00 \x00 \x00 \x00 \x00 \x00 \x00 \x00 \x00 \x00 \x00 \x00 \x00 \x00 \x00 \x00 \x00 \x00 \x00 \x00 \x00 \x00 \x00 \x00 \x00 \x00 \x00 \x00 \x00 \x00 \x00 \x00 \x00 \x00 \x00 \x00 \x00 \x00 \x99 \xd1 9\xb0 \xf8 \x00 \x00 \x00 \x00 \x00 \x00 \x00 \x00 \xff \xff \xff \xff \x00 \x00 \r \x02 \x00 \x00 \x00 \x00 \x00 \x00 \x00 \x00 \x00 \x00 \x00 \x00 \x00 \x00 \x00 \x0b .background\x00 \x00 \x10 \x00 \x08 \x00 \x00 \xd1 \x94 \\ \xb0 \x00 \x00 \x00 \x11 \x00 \x08 \x00 \x00 \xd1 9\xb0 \xf8 \x00 \x00 \x00 \x01 \x00 \x04 \x00 \x00 \x00 \x98 \x00 \x0e \x00 \x00 \x0f \x00 b\x00 a\x00 c\x00 k\x00 g\x00 r\x00 o\x00 u\x00 n\x00 d\x00 .\x00 t\x00 i\x00 f\x00 f\x00 \x0f \x00 \x02 \x00 \x00 \x00 \x12 \x00 \x1c /.background/background.tiff\x00 \x14 \x01 \x06 \x00 \x00 \x00 \x00 \x01 \x06 \x00 \x02 \x00 \x00 \x0c Macintosh HD\x00 \x00 \x00 \x00 \x00 \x00 \x00 \x00 \x00 \x00 \x00 \x00 \x00 \x00 \x00 \xce \x97 \xab \xc3 H+\x00 \x00 \x01 \x88 [\x88 \x00 \x00 \x00 \x00 \x00 \x00 \x00 \x00 \x00 \x00 \x00 \x00 \x00 \x00 \x00 \x00 \x00 \x00 \x00 \x00 \x00 \x00 \x00 \x00 \x00 \x00 \x00 \x00 \x00 \x00 \x00 \x00 \x00 \x00 \x00 \x00 \x00 \x00 \x00 \x00 \x00 \x00 \x00 \x00 \x00 \x00 \x00 \x00 \x00 \x00 \x00 \x00 \x00 \x00 \x00 \x00 \x00 \x00 \x00 \x00 \x00 \x00 \x00 \x00 \x02 u\xab \x8d \xd1 \x94 \\ \xb0 devrddsk\xff \xff \xff \xff \x00 \x00 \t \x00 \x00 \x00 \x00 \x00 \x00 \x00 \x00 \x00 \x00 \x00 \x00 \x00 \x00 \x00 \x07 bitcoin\x00 \x00 \x10 \x00 \x08 \x00 \x00 \xce \x97 \xab \xc3 \x00 \x00 \x00 \x11 \x00 \x08 \x00 \x00 \xd1 \x94 \\ \xb0 \x00 \x00 \x00 \x01 \x00 \x14 \x01 \x88 [\x88 \x00 \x16 \xa9 \t \x00 \x08 \xfa R\x00 \x08 \xfa Q\x00 \x02 d\x8e \x00 \x0e \x00 \x02 \x00 \x00 \x00 \x0f \x00 \x1a \x00 \x0c \x00 M\x00 a\x00 c\x00 i\x00 n\x00 t\x00 o\x00 s\x00 h\x00 \x00 H\x00 D\x00 \x13 \x00 \x01 /\x00 \x00 \x15 \x00 \x02 \x00 \x14 \xff \xff \x00 \x00 \xff \xff \x00 \x00 ' ,
517
- 'backgroundColorBlue' : 1.0 ,
518
- 'iconSize' : 96.0 ,
519
- 'backgroundColorGreen' : 1.0 ,
520
- 'arrangeBy' : 'none' ,
521
- 'showIconPreview' : True ,
522
- 'gridSpacing' : 100.0 ,
523
- 'gridOffsetY' : 0.0 ,
524
- 'showItemInfo' : False ,
525
- 'labelOnBottom' : True ,
526
- 'backgroundType' : 2 ,
527
- 'backgroundColorRed' : 1.0
528
- }
529
- alias = Alias ().from_bytes (icvp ['backgroundImageAlias' ])
530
- alias .volume .name = appname
531
- alias .volume .posix_path = '/Volumes/' + appname
532
- icvp ['backgroundImageAlias' ] = alias .to_bytes ()
533
- ds ['.' ]['icvp' ] = icvp
534
-
535
- ds ['.' ]['vSrn' ] = ('long' , 1 )
536
-
537
- ds ['Applications' ]['Iloc' ] = (370 , 156 )
538
- ds ['Bitcoin-Qt.app' ]['Iloc' ] = (128 , 156 )
539
-
540
- ds .flush ()
541
- ds .close ()
542
-
543
- # ------------------------------------------------
544
-
545
495
if platform .system () == "Darwin" :
546
496
subprocess .check_call (f"codesign --deep --force --sign - { target } " , shell = True )
547
497
548
- print ("+ Installing background.tiff +" )
549
-
550
- bg_path = os .path .join ('dist' , '.background' , 'background.tiff' )
551
- os .mkdir (os .path .dirname (bg_path ))
552
-
553
- tiff_path = os .path .join ('contrib' , 'macdeploy' , 'background.tiff' )
554
- shutil .copy2 (tiff_path , bg_path )
555
-
556
- # ------------------------------------------------
557
-
558
- print ("+ Generating symlink for /Applications +" )
559
-
560
- os .symlink ("/Applications" , os .path .join ('dist' , "Applications" ))
561
-
562
- # ------------------------------------------------
563
-
564
- if config .dmg is not None :
565
-
566
- print ("+ Preparing .dmg disk image +" )
567
-
568
- if verbose :
569
- print ("Determining size of \" dist\" ..." )
570
- size = 0
571
- for path , dirs , files in os .walk ("dist" ):
572
- for file in files :
573
- size += os .path .getsize (os .path .join (path , file ))
574
- size += int (size * 0.15 )
575
-
576
- if verbose :
577
- print ("Creating temp image for modification..." )
578
-
579
- tempname : str = appname + ".temp.dmg"
580
-
581
- run (["hdiutil" , "create" , tempname , "-srcfolder" , "dist" , "-format" , "UDRW" , "-size" , str (size ), "-volname" , appname ], check = True , text = True )
582
-
583
- if verbose :
584
- print ("Attaching temp image..." )
585
- output = run (["hdiutil" , "attach" , tempname , "-readwrite" ], check = True , text = True , stdout = PIPE ).stdout
586
-
587
- print ("+ Finalizing .dmg disk image +" )
588
-
589
- run (["hdiutil" , "detach" , f"/Volumes/{ appname } " ], text = True )
590
-
591
- run (["hdiutil" , "convert" , tempname , "-format" , "UDZO" , "-o" , appname , "-imagekey" , "zlib-level=9" ], check = True , text = True )
592
-
593
- os .unlink (tempname )
594
-
595
498
# ------------------------------------------------
596
499
597
500
if config .zip is not None :
0 commit comments