old_contents: import os, sys
  from ctypes import windll
  
  def is_cache():
      try:
          import comtypes.gen
      except ImportError:
          return
      return comtypes.gen.__path__[0]
  
  install_text = """\
  When installing a new comtypes version, it is recommended to remove
  the comtypes\gen directory and the automatically generated modules
  it contains.  This directory and the modules will be regenerated
  on demand.
  
  Should the installer delete all the files in this directory?"""
  
  deinstall_text = """\
  The comtypes\gen directory contains modules that comtypes
  automatically generates.
  
  Should this directory be removed?"""
  
  if len(sys.argv) > 1 and sys.argv[1] == "-install":
      title = "Install comtypes"
      text = install_text
  else:
      title = "Remove comtypes"
      text = deinstall_text
  
  
  IDYES = 6
  IDNO = 7
  MB_YESNO = 4
  MB_ICONWARNING = 48
  directory = is_cache()
  if directory:
      res = windll.user32.MessageBoxA(0, text, title, MB_YESNO|MB_ICONWARNING)
      if res == IDYES:
          for f in os.listdir(directory):
              fullpath = os.path.join(directory, f)
              os.remove(fullpath)
          os.rmdir(directory)
          print("Removed directory %s" % directory)
      else:
          print("Directory %s NOT removed" % directory)
  
new_contents: import os
  import sys
  import shutil
  from ctypes import windll
  
  def is_cache():
      try:
          import comtypes.gen
      except ImportError:
          return
      return comtypes.gen.__path__[0]
  
  install_text = """\
  When installing a new comtypes version, it is recommended to remove
  the comtypes\gen directory and the automatically generated modules
  it contains.  This directory and the modules will be regenerated
  on demand.
  
  Should the installer delete all the files in this directory?"""
  
  deinstall_text = """\
  The comtypes\gen directory contains modules that comtypes
  automatically generates.
  
  Should this directory be removed?"""
  
  if len(sys.argv) > 1 and sys.argv[1] == "-install":
      title = "Install comtypes"
      text = install_text
  else:
      title = "Remove comtypes"
      text = deinstall_text
  
  
  IDYES = 6
  IDNO = 7
  MB_YESNO = 4
  MB_ICONWARNING = 48
  directory = is_cache()
  if directory:
      res = windll.user32.MessageBoxA(0, text, title, MB_YESNO|MB_ICONWARNING)
      if res == IDYES:
          shutil.rmtree(directory)
          print("Removed directory %s" % directory)
      else:
          print("Directory %s NOT removed" % directory)
  
subject: Fix SF #3288383: In Python 3.2, compiled Python files are no longer saved as .pyc files, but are instead saved in the __pycache__ folder. This breaks the clear_comtypes_cache script, which assumes only files are found in the cache.