parameters: (self)
docstring: Verify that self.install_dir is .pth-capable dir, if needed
docstring_summary: Verify that self.install_dir is .pth-capable dir, if needed
docstring_tokens: Verify that self . install_dir is . pth - capable dir if needed
function: def check_site_dir(self):
          """Verify that self.install_dir is .pth-capable dir, if needed"""
  
          instdir = normalize_path(self.install_dir)
          pth_file = os.path.join(instdir, 'easy-install.pth')
  
          if not os.path.exists(instdir):
              try:
                  os.makedirs(instdir)
              except (OSError, IOError):
                  self.cant_write_to_target()
  
          # Is it a configured, PYTHONPATH, implicit, or explicit site dir?
          is_site_dir = instdir in self.all_site_dirs
  
          if not is_site_dir and not self.multi_version:
              # No?  Then directly test whether it does .pth file processing
              is_site_dir = self.check_pth_processing()
          else:
              # make sure we can write to target dir
              testfile = self.pseudo_tempname() + '.write-test'
              test_exists = os.path.exists(testfile)
              try:
                  if test_exists:
                      os.unlink(testfile)
                  open(testfile, 'w').close()
                  os.unlink(testfile)
              except (OSError, IOError):
                  self.cant_write_to_target()
  
          if not is_site_dir and not self.multi_version:
              # Can't install non-multi to non-site dir with easy_install
              pythonpath = os.environ.get('PYTHONPATH', '')
              log.warn(self.__no_default_msg, self.install_dir, pythonpath)
  
          if is_site_dir:
              if self.pth_file is None:
                  self.pth_file = PthDistributions(pth_file, self.all_site_dirs)
          else:
              self.pth_file = None
  
          if instdir not in map(normalize_path, _pythonpath()):
              # only PYTHONPATH dirs need a site.py, so pretend it's there
              self.sitepy_installed = True
          elif self.multi_version and not os.path.exists(pth_file):
              self.sitepy_installed = True  # don't need site.py in this case
              self.pth_file = None  # and don't create a .pth file
          self.install_dir = instdir
function_tokens: def check_site_dir ( self ) : instdir = normalize_path ( self . install_dir ) pth_file = os . path . join ( instdir , 'easy-install.pth' ) if not os . path . exists ( instdir ) : try : os . makedirs ( instdir ) except ( OSError , IOError ) : self . cant_write_to_target ( ) # Is it a configured, PYTHONPATH, implicit, or explicit site dir? is_site_dir = instdir in self . all_site_dirs if not is_site_dir and not self . multi_version : # No?  Then directly test whether it does .pth file processing is_site_dir = self . check_pth_processing ( ) else : # make sure we can write to target dir testfile = self . pseudo_tempname ( ) + '.write-test' test_exists = os . path . exists ( testfile ) try : if test_exists : os . unlink ( testfile ) open ( testfile , 'w' ) . close ( ) os . unlink ( testfile ) except ( OSError , IOError ) : self . cant_write_to_target ( ) if not is_site_dir and not self . multi_version : # Can't install non-multi to non-site dir with easy_install pythonpath = os . environ . get ( 'PYTHONPATH' , '' ) log . warn ( self . __no_default_msg , self . install_dir , pythonpath ) if is_site_dir : if self . pth_file is None : self . pth_file = PthDistributions ( pth_file , self . all_site_dirs ) else : self . pth_file = None if instdir not in map ( normalize_path , _pythonpath ( ) ) : # only PYTHONPATH dirs need a site.py, so pretend it's there self . sitepy_installed = True elif self . multi_version and not os . path . exists ( pth_file ) : self . sitepy_installed = True # don't need site.py in this case self . pth_file = None # and don't create a .pth file self . install_dir = instdir