code: def gen_dos_short_file_name(file, filename_set):
      
      # guard this to not confuse the generation
      if is_dos_short_file_name(file):
          return file
  
      fname, ext = os.path.splitext(file) # ext contains the dot
  
      # first try if it suffices to convert to upper
      file = file.upper()
      if is_dos_short_file_name(file):
          return file
  
      # strip forbidden characters.
      forbidden = '."/[]:;=, '
      fname = [c for c in fname if c not in forbidden]
  
      # check if we already generated a filename with the same number:
      # thisis1.txt, thisis2.txt etc.
      duplicate, num = not None, 1
      while duplicate:
          shortname = "%s%s" % (fname[:8-len(str(num))].upper(),\
                                str(num))
          if len(ext) >= 2:
              shortname = "%s%s" % (shortname, ext[:4].upper())
  
          duplicate, num = shortname in filename_set, num+1
  
      assert( is_dos_short_file_name(shortname) ), 'shortname is %s, longname is %s' % (shortname, file)
      filename_set.append(shortname)
      return shortname
docs: See http://support.microsoft.com/default.aspx?scid=kb;en-us;Q142982
  
      These are no complete 8.3 dos short names. The ~ char is missing and 
      replaced with one character from the filename. WiX warns about such
      filenames, since a collision might occur. Google for "CNDL1014" for
      more information.