summaryrefslogtreecommitdiff
path: root/Mac
diff options
context:
space:
mode:
authorNed Deily <nad@python.org>2018-12-10 22:05:14 -0500
committerNed Deily <nad@python.org>2018-12-11 15:47:04 -0500
commit8aa057aaabf710eda53cf90a77e23d2f127346a2 (patch)
tree0be6c634b61947d21d20a2db0a2a2e62fd9b4a28 /Mac
parentd55a896cd63e72e2848c48226d031d612539ea2a (diff)
downloadcpython-git-8aa057aaabf710eda53cf90a77e23d2f127346a2.tar.gz
macOS installer build: mitigate hdiutil resource busy bug
Diffstat (limited to 'Mac')
-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 806f660bd6..5d11bbb10e 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"))