Esempio n. 1
0
 def makedmg(self, d, volname, destdir="dist", internet_enable=True, format="UDBZ"):
     """ Copy a directory d into a dmg named volname """
     info("\nSigning...")
     sys.stdout.flush()
     if not os.path.exists(destdir):
         os.makedirs(destdir)
     dmg = os.path.join(destdir, volname + ".dmg")
     if os.path.exists(dmg):
         os.unlink(dmg)
     tdir = tempfile.mkdtemp()
     appdir = os.path.join(tdir, os.path.basename(d))
     shutil.copytree(d, appdir, symlinks=True)
     with timeit() as times:
         sign_app(appdir)
     info("Signing completed in %d minutes %d seconds" % tuple(times))
     os.symlink("/Applications", os.path.join(tdir, "Applications"))
     size_in_mb = int(subprocess.check_output(["du", "-s", "-k", tdir]).decode("utf-8").split()[0]) / 1024.0
     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"]
     info("\nCreating dmg...")
     with timeit() as times:
         subprocess.check_call(cmd + [dmg])
         if internet_enable:
             subprocess.check_call(["/usr/bin/hdiutil", "internet-enable", "-yes", dmg])
     info("dmg created in %d minutes and %d seconds" % tuple(times))
     shutil.rmtree(tdir)
     size = os.stat(dmg).st_size / (1024 * 1024.0)
     info("\nInstaller size: %.2fMB\n" % size)
     return dmg
Esempio n. 2
0
 def makedmg(self,
             d,
             volname,
             destdir='dist',
             internet_enable=True,
             format='UDBZ'):
     ''' Copy a directory d into a dmg named volname '''
     info('\nSigning...')
     sys.stdout.flush()
     if not os.path.exists(destdir):
         os.makedirs(destdir)
     dmg = os.path.join(destdir, volname + '.dmg')
     if os.path.exists(dmg):
         os.unlink(dmg)
     tdir = tempfile.mkdtemp()
     appdir = os.path.join(tdir, os.path.basename(d))
     shutil.copytree(d, appdir, symlinks=True)
     with timeit() as times:
         sign_app(appdir)
     info('Signing completed in %d minutes %d seconds' % tuple(times))
     os.symlink('/Applications', os.path.join(tdir, 'Applications'))
     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']
     info('\nCreating dmg...')
     with timeit() as times:
         subprocess.check_call(cmd + [dmg])
         if internet_enable:
             subprocess.check_call(
                 ['/usr/bin/hdiutil', 'internet-enable', '-yes', dmg])
     info('dmg created in %d minutes and %d seconds' % tuple(times))
     shutil.rmtree(tdir)
     size = os.stat(dmg).st_size / (1024 * 1024.)
     info('\nInstaller size: %.2fMB\n' % size)
     return dmg
Esempio n. 3
0
 def makedmg(self, d, volname,
             destdir='dist',
             internet_enable=True,
             format='UDBZ'):
     ''' Copy a directory d into a dmg named volname '''
     info('\nSigning...')
     sys.stdout.flush()
     if not os.path.exists(destdir):
         os.makedirs(destdir)
     dmg = os.path.join(destdir, volname+'.dmg')
     if os.path.exists(dmg):
         os.unlink(dmg)
     tdir = tempfile.mkdtemp()
     appdir = os.path.join(tdir, os.path.basename(d))
     shutil.copytree(d, appdir, symlinks=True)
     with timeit() as times:
         sign_app(appdir)
     info('Signing completed in %d minutes %d seconds' % tuple(times))
     os.symlink('/Applications', os.path.join(tdir, 'Applications'))
     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']
     info('\nCreating dmg...')
     with timeit() as times:
         subprocess.check_call(cmd + [dmg])
         if internet_enable:
             subprocess.check_call(['/usr/bin/hdiutil', 'internet-enable', '-yes', dmg])
     info('dmg created in %d minutes and %d seconds' % tuple(times))
     shutil.rmtree(tdir)
     size = os.stat(dmg).st_size/(1024*1024.)
     info('\nInstaller size: %.2fMB\n'%size)
     return dmg