diff --git a/setup/installer/osx/app/main.py b/setup/installer/osx/app/main.py index e7c38b65fb..e21a66e510 100644 --- a/setup/installer/osx/app/main.py +++ b/setup/installer/osx/app/main.py @@ -654,8 +654,14 @@ class Py2App(object): shutil.copytree(d, appdir, symlinks=True) subprocess.check_call(['/Users/kovid/sign.sh', appdir]) os.symlink('/Applications', os.path.join(tdir, 'Applications')) - subprocess.check_call(['/usr/bin/hdiutil', 'create', '-srcfolder', tdir, - '-volname', volname, '-format', format, dmg]) + size_in_mb = int(subprocess.check_output(['du', '-s', '-k', tdir]).decode('utf-8').split()[0]) / 1024. + cmd = ['/usr/bin/hdiutil', 'create', '-srcfolder', tdir, '-volname', volname, '-format', format] + if 190 < size_in_mb < 250: + # We need -size 255m because of a bug in hdiutil. When the size of + # srcfolder is close to 200MB hdiutil fails with + # diskimages-helper: resize request is above maximum size allowed. + cmd += ['-size', '255m'] + subprocess.check_call(cmd + [dmg]) shutil.rmtree(tdir) if internet_enable: subprocess.check_call(['/usr/bin/hdiutil', 'internet-enable', '-yes', dmg])