parameters: (self, req)
docstring: Add an InstallRequirement to build tracking.
docstring_summary: Add an InstallRequirement to build tracking.
docstring_tokens: Add an InstallRequirement to build tracking .
function: def add(self, req):
          # type: (InstallRequirement) -> None
          """Add an InstallRequirement to build tracking.
          """
  
          assert req.link
          # Get the file to write information about this requirement.
          entry_path = self._entry_path(req.link)
  
          # Try reading from the file. If it exists and can be read from, a build
          # is already in progress, so a LookupError is raised.
          try:
              with open(entry_path) as fp:
                  contents = fp.read()
          except FileNotFoundError:
              pass
          else:
              message = '{} is already being built: {}'.format(
                  req.link, contents)
              raise LookupError(message)
  
          # If we're here, req should really not be building already.
          assert req not in self._entries
  
          # Start tracking this requirement.
          with open(entry_path, 'w') as fp:
              fp.write(str(req))
          self._entries.add(req)
  
          logger.debug('Added %s to build tracker %r', req, self._root)
function_tokens: def add ( self , req ) : # type: (InstallRequirement) -> None assert req . link # Get the file to write information about this requirement. entry_path = self . _entry_path ( req . link ) # Try reading from the file. If it exists and can be read from, a build # is already in progress, so a LookupError is raised. try : with open ( entry_path ) as fp : contents = fp . read ( ) except FileNotFoundError : pass else : message = '{} is already being built: {}' . format ( req . link , contents ) raise LookupError ( message ) # If we're here, req should really not be building already. assert req not in self . _entries # Start tracking this requirement. with open ( entry_path , 'w' ) as fp : fp . write ( str ( req ) ) self . _entries . add ( req ) logger . debug ( 'Added %s to build tracker %r' , req , self . _root )