File tree 1 file changed +17
-6
lines changed
1 file changed +17
-6
lines changed Original file line number Diff line number Diff line change @@ -1533,16 +1533,27 @@ def buildDMG():
1533
1533
imagepath = imagepath + '.dmg'
1534
1534
1535
1535
os .mkdir (outdir )
1536
+
1537
+ # Try to mitigate race condition in certain versions of macOS, e.g. 10.9,
1538
+ # when hdiutil create fails with "Resource busy". For now, just retry
1539
+ # the create a few times and hope that it eventually works.
1540
+
1536
1541
volname = 'Python %s' % (getFullVersion ())
1537
- runCommand ("hdiutil create -format UDRW -volname %s -srcfolder %s %s" % (
1542
+ cmd = ("hdiutil create -format UDRW -volname %s -srcfolder %s -size 100m %s" % (
1538
1543
shellQuote (volname ),
1539
1544
shellQuote (os .path .join (WORKDIR , 'installer' )),
1540
1545
shellQuote (imagepath + ".tmp.dmg" )))
1541
-
1542
- # Try to mitigate race condition in certain versions of macOS, e.g. 10.9,
1543
- # when hdiutil fails with "Resource busy"
1544
-
1545
- time .sleep (10 )
1546
+ for i in range (5 ):
1547
+ fd = os .popen (cmd , 'r' )
1548
+ data = fd .read ()
1549
+ xit = fd .close ()
1550
+ if not xit :
1551
+ break
1552
+ sys .stdout .write (data )
1553
+ print (" -- retrying hdiutil create" )
1554
+ time .sleep (5 )
1555
+ else :
1556
+ raise RuntimeError ("command failed: %s" % (commandline ,))
1546
1557
1547
1558
if not os .path .exists (os .path .join (WORKDIR , "mnt" )):
1548
1559
os .mkdir (os .path .join (WORKDIR , "mnt" ))
You can’t perform that action at this time.
0 commit comments