old_contents: #!python3
  import util
  
  import os
  import re
  import shutil
  import subprocess
  import sys
  
  import dllversion
  
  from os.path import abspath
  from subprocess import check_call
  from util import glob_paths, rmpath, mkdirs, buildTimeStamp, projectDir, getGppVer
  
  
  # Install https://www.7-zip.org. Use Win10 bundled curl.
  shutil.which('7z')      or sys.exit('error: 7z missing')
  shutil.which('curl')    or sys.exit('error: curl missing')
  
  
  buildDir = os.path.join(projectDir, 'out\\build-cygwin')
  artifactDir = os.path.join(projectDir, 'out\\artifact')
  rmpath(buildDir)
  mkdirs(buildDir)
  mkdirs(artifactDir)
  
  os.chdir(buildDir)
  
  for setup, cygwin in (('setup-x86_64', 'cygwin64'), ('setup-x86', 'cygwin')):
  
      check_call(['curl', '-O', 'https://cygwin.com/{}.exe'.format(setup)])
  
      check_call([
          abspath('{}.exe'.format(setup)),
          '-l', abspath('{}-packages'.format(cygwin)),
          '-P', 'gcc-g++,make',
          '-s', 'http://mirrors.kernel.org/sourceware/cygwin',
          '-R', abspath(cygwin),
          '--no-admin', '--no-desktop', '--no-shortcuts', '--no-startmenu', '--quiet-mode',
      ])
  
      cygVer = dllversion.fileVersion('{}/bin/cygwin1.dll'.format(cygwin))
      gppVer = getGppVer('{}/bin/g++.exe'.format(cygwin))
  
      filename = '{}\\{}-{}-dll{}-gcc{}.7z'.format(artifactDir, cygwin, buildTimeStamp, cygVer, gppVer)
      rmpath(filename)
  
      check_call(['7z', 'a', '-mx=9', filename] + glob_paths([
          cygwin + '/dev',
          cygwin + '/tmp',
          cygwin + '/bin',
          cygwin + '/lib',
          cygwin + '/usr/include',
          cygwin + '/usr/*-pc-cygwin',
      ]))
  
new_contents: #!python3
  import util
  
  import os
  import re
  import shutil
  import subprocess
  import sys
  
  import dllversion
  
  from os.path import abspath
  from subprocess import check_call
  from util import glob_paths, rmpath, mkdirs, buildTimeStamp, projectDir, getGppVer
  
  
  # Install https://www.7-zip.org. Use Win10 bundled curl.
  shutil.which('7z')      or sys.exit('error: 7z missing')
  shutil.which('curl')    or sys.exit('error: curl missing')
  
  
  buildDir = os.path.join(projectDir, 'out\\build-cygwin')
  artifactDir = os.path.join(projectDir, 'out\\artifact')
  rmpath(buildDir)
  mkdirs(buildDir)
  mkdirs(artifactDir)
  
  os.chdir(buildDir)
  
  for setup, cygwin in (('setup-x86_64', 'cygwin64'), ('setup-x86', 'cygwin32')):
  
      check_call(['curl', '-O', 'https://cygwin.com/{}.exe'.format(setup)])
  
      check_call([
          abspath('{}.exe'.format(setup)),
          '-l', abspath('{}-packages'.format(cygwin)),
          '-P', 'gcc-g++,make',
          '-s', 'http://mirrors.kernel.org/sourceware/cygwin',
          '-R', abspath(cygwin),
          '--no-admin', '--no-desktop', '--no-shortcuts', '--no-startmenu', '--quiet-mode',
      ])
  
      cygVer = dllversion.fileVersion('{}/bin/cygwin1.dll'.format(cygwin))
      gppVer = getGppVer('{}/bin/g++.exe'.format(cygwin))
  
      filename = '{}\\{}-{}-dll{}-gcc{}.7z'.format(artifactDir, cygwin, buildTimeStamp, cygVer, gppVer)
      rmpath(filename)
  
      check_call(['7z', 'a', '-mx=9', filename] + glob_paths([
          cygwin + '/dev',
          cygwin + '/tmp',
          cygwin + '/bin',
          cygwin + '/lib',
          cygwin + '/usr/include',
          cygwin + '/usr/*-pc-cygwin',
      ]))
  
subject: Rename cygwin -> cygwin32