diff options
author | Ned Deily <nad@python.org> | 2018-12-10 22:05:14 -0500 |
---|---|---|
committer | Ned Deily <nad@python.org> | 2018-12-11 15:56:50 -0500 |
commit | 56f86fcc44f7d74c68b6fa508328d61ce973eebc (patch) | |
tree | 6b03cb62cb2f37c224721fab658276e9354d6712 /Mac/BuildScript/build-installer.py | |
parent | 97568761a6adb64d750fb0ea68484f67ae5e54f7 (diff) | |
download | cpython-git-56f86fcc44f7d74c68b6fa508328d61ce973eebc.tar.gz |
macOS installer build: mitigate hdiutil resource busy bug
Diffstat (limited to 'Mac/BuildScript/build-installer.py')
-rwxr-xr-x | Mac/BuildScript/build-installer.py | 23 |
1 files changed, 17 insertions, 6 deletions
diff --git a/Mac/BuildScript/build-installer.py b/Mac/BuildScript/build-installer.py index b1dede4920..6fc07ad3d3 100755 --- a/Mac/BuildScript/build-installer.py +++ b/Mac/BuildScript/build-installer.py @@ -1533,16 +1533,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")) |