parameters: (self)
docstring: Generate the vcxproj.filters file
docstring_summary: Generate the vcxproj.filters file
docstring_tokens: Generate the vcxproj . filters file
function: def __write_filters(self):
          """Generate the vcxproj.filters file"""
          # 1. get a list of directories for all the files
          # 2. get all the headers in each of these dirs
          # 3. Output these lists of files to vcxproj and vcxproj.headers
          # Note: order of these lists does not matter, VS will sort them anyway
          dirs = set()
          scons_files = set()
  
          for file_name in self.files:
              dirs.add(os.path.dirname(file_name))
  
          base_dirs = set()
          for directory in dirs:
              if not os.path.exists(directory):
                  print(("Warning: skipping include file scan for directory '%s'" +
                        " because it does not exist.") % str(directory))
                  continue
  
              # Get all the header files
              for file_name in os.listdir(directory):
                  if self.__is_header(file_name):
                      self.files.add(directory + "\\" + file_name)
  
              # Make sure the set also includes the base directories
              # (i.e. src/mongo and src as examples)
              base_name = os.path.dirname(directory)
              while base_name:
                  base_dirs.add(base_name)
                  base_name = os.path.dirname(base_name)
  
          dirs = dirs.union(base_dirs)
  
          # Get all the scons files
          for directory in dirs:
              if os.path.exists(directory):
                  for file_name in os.listdir(directory):
                      if "SConstruct" == file_name or "SConscript" in file_name:
                          scons_files.add(directory + "\\" + file_name)
          scons_files.add("SConstruct")
  
          # Write a list of directory entries with unique guids
          self.filters.write("  <ItemGroup>\n")
          for file_name in sorted(dirs):
              self.filters.write("    <Filter Include='%s'>\n" % file_name)
              self.filters.write("        <UniqueIdentifier>{%s}</UniqueIdentifier>\n" % uuid.uuid4())
              self.filters.write("    </Filter>\n")
          self.filters.write("  </ItemGroup>\n")
  
          # Write a list of files to compile
          self.filters.write("  <ItemGroup>\n")
          for file_name in sorted(self.files):
              if not self.__is_header(file_name):
                  self.filters.write("    <ClCompile Include='%s'>\n" % file_name)
                  self.filters.write("        <Filter>%s</Filter>\n" % os.path.dirname(file_name))
                  self.filters.write("    </ClCompile>\n")
          self.filters.write("  </ItemGroup>\n")
  
          # Write a list of headers
          self.filters.write("  <ItemGroup>\n")
          for file_name in sorted(self.files):
              if self.__is_header(file_name):
                  self.filters.write("    <ClInclude Include='%s'>\n" % file_name)
                  self.filters.write("        <Filter>%s</Filter>\n" % os.path.dirname(file_name))
                  self.filters.write("    </ClInclude>\n")
          self.filters.write("  </ItemGroup>\n")
  
          # Write a list of scons files
          self.filters.write("  <ItemGroup>\n")
          for file_name in sorted(scons_files):
              self.filters.write("    <None Include='%s'>\n" % file_name)
              self.filters.write("        <Filter>%s</Filter>\n" % os.path.dirname(file_name))
              self.filters.write("    </None>\n")
          self.filters.write("  </ItemGroup>\n")
  
          # Write a list of headers into the vcxproj
          self.vcxproj.write("  <ItemGroup>\n")
          for file_name in sorted(self.files):
              if self.__is_header(file_name):
                  self.vcxproj.write("    <ClInclude Include='%s' />\n" % file_name)
          self.vcxproj.write("  </ItemGroup>\n")
  
          # Write a list of scons files into the vcxproj
          self.vcxproj.write("  <ItemGroup>\n")
          for file_name in sorted(scons_files):
              self.vcxproj.write("    <None Include='%s' />\n" % file_name)
          self.vcxproj.write("  </ItemGroup>\n")
function_tokens: def __write_filters ( self ) : # 1. get a list of directories for all the files # 2. get all the headers in each of these dirs # 3. Output these lists of files to vcxproj and vcxproj.headers # Note: order of these lists does not matter, VS will sort them anyway dirs = set ( ) scons_files = set ( ) for file_name in self . files : dirs . add ( os . path . dirname ( file_name ) ) base_dirs = set ( ) for directory in dirs : if not os . path . exists ( directory ) : print ( ( "Warning: skipping include file scan for directory '%s'" + " because it does not exist." ) % str ( directory ) ) continue # Get all the header files for file_name in os . listdir ( directory ) : if self . __is_header ( file_name ) : self . files . add ( directory + "\\" + file_name ) # Make sure the set also includes the base directories # (i.e. src/mongo and src as examples) base_name = os . path . dirname ( directory ) while base_name : base_dirs . add ( base_name ) base_name = os . path . dirname ( base_name ) dirs = dirs . union ( base_dirs ) # Get all the scons files for directory in dirs : if os . path . exists ( directory ) : for file_name in os . listdir ( directory ) : if "SConstruct" == file_name or "SConscript" in file_name : scons_files . add ( directory + "\\" + file_name ) scons_files . add ( "SConstruct" ) # Write a list of directory entries with unique guids self . filters . write ( "  <ItemGroup>\n" ) for file_name in sorted ( dirs ) : self . filters . write ( "    <Filter Include='%s'>\n" % file_name ) self . filters . write ( "        <UniqueIdentifier>{%s}</UniqueIdentifier>\n" % uuid . uuid4 ( ) ) self . filters . write ( "    </Filter>\n" ) self . filters . write ( "  </ItemGroup>\n" ) # Write a list of files to compile self . filters . write ( "  <ItemGroup>\n" ) for file_name in sorted ( self . files ) : if not self . __is_header ( file_name ) : self . filters . write ( "    <ClCompile Include='%s'>\n" % file_name ) self . filters . write ( "        <Filter>%s</Filter>\n" % os . path . dirname ( file_name ) ) self . filters . write ( "    </ClCompile>\n" ) self . filters . write ( "  </ItemGroup>\n" ) # Write a list of headers self . filters . write ( "  <ItemGroup>\n" ) for file_name in sorted ( self . files ) : if self . __is_header ( file_name ) : self . filters . write ( "    <ClInclude Include='%s'>\n" % file_name ) self . filters . write ( "        <Filter>%s</Filter>\n" % os . path . dirname ( file_name ) ) self . filters . write ( "    </ClInclude>\n" ) self . filters . write ( "  </ItemGroup>\n" ) # Write a list of scons files self . filters . write ( "  <ItemGroup>\n" ) for file_name in sorted ( scons_files ) : self . filters . write ( "    <None Include='%s'>\n" % file_name ) self . filters . write ( "        <Filter>%s</Filter>\n" % os . path . dirname ( file_name ) ) self . filters . write ( "    </None>\n" ) self . filters . write ( "  </ItemGroup>\n" ) # Write a list of headers into the vcxproj self . vcxproj . write ( "  <ItemGroup>\n" ) for file_name in sorted ( self . files ) : if self . __is_header ( file_name ) : self . vcxproj . write ( "    <ClInclude Include='%s' />\n" % file_name ) self . vcxproj . write ( "  </ItemGroup>\n" ) # Write a list of scons files into the vcxproj self . vcxproj . write ( "  <ItemGroup>\n" ) for file_name in sorted ( scons_files ) : self . vcxproj . write ( "    <None Include='%s' />\n" % file_name ) self . vcxproj . write ( "  </ItemGroup>\n" )