summaryrefslogtreecommitdiffstats
path: root/Mac/BuildScript/build-installer.py
diff options
context:
space:
mode:
authorNed Deily <nad@python.org>2018-12-27 21:38:41 (GMT)
committerMiss Islington (bot) <31488909+miss-islington@users.noreply.github.com>2018-12-27 21:38:41 (GMT)
commit0133f9fc9e8a35b223341d7b5641ac2f16ff2a19 (patch)
treee4baae14073f75973094000c07ee00203c75cd65 /Mac/BuildScript/build-installer.py
parenta936639b22ca548c00690de6a2964f223f6787cb (diff)
downloadcpython-0133f9fc9e8a35b223341d7b5641ac2f16ff2a19.zip
cpython-0133f9fc9e8a35b223341d7b5641ac2f16ff2a19.tar.gz
cpython-0133f9fc9e8a35b223341d7b5641ac2f16ff2a19.tar.bz2
macOS installer build: mitigate hdiutil resource busy bug (GH-11333)
Diffstat (limited to 'Mac/BuildScript/build-installer.py')
-rwxr-xr-xMac/BuildScript/build-installer.py23
1 files changed, 17 insertions, 6 deletions
diff --git a/Mac/BuildScript/build-installer.py b/Mac/BuildScript/build-installer.py
index d550208..2e3a61e 100755
--- a/Mac/BuildScript/build-installer.py
+++ b/Mac/BuildScript/build-installer.py
@@ -1518,16 +1518,27 @@ def buildDMG():
imagepath = imagepath + '.dmg'
os.mkdir(outdir)
+
+ # Try to mitigate race condition in certain versions of macOS, e.g. 10.9,
+ # when hdiutil create fails with "Resource busy". For now, just retry
+ # the create a few times and hope that it eventually works.
+
volname='Python %s'%(getFullVersion())
- runCommand("hdiutil create -format UDRW -volname %s -srcfolder %s %s"%(
+ cmd = ("hdiutil create -format UDRW -volname %s -srcfolder %s -size 100m %s"%(
shellQuote(volname),
shellQuote(os.path.join(WORKDIR, 'installer')),
shellQuote(imagepath + ".tmp.dmg" )))
-
- # Try to mitigate race condition in certain versions of macOS, e.g. 10.9,
- # when hdiutil fails with "Resource busy"
-
- time.sleep(10)
+ for i in range(5):
+ fd = os.popen(cmd, 'r')
+ data = fd.read()
+ xit = fd.close()
+ if not xit:
+ break
+ sys.stdout.write(data)
+ print(" -- retrying hdiutil create")
+ time.sleep(5)
+ else:
+ raise RuntimeError("command failed: %s"%(commandline,))
if not os.path.exists(os.path.join(WORKDIR, "mnt")):
os.mkdir(os.path.join(WORKDIR, "mnt"))