def add_vendor_dir(path, index=1):
 venv_path = os.path.join(path, 'lib', _PYTHON_VERSION, 'site-packages')
 if os.path.isdir(venv_path):
  site_dir = venv_path
 elif os.path.isdir(path):
  site_dir = path
 else:
  raise ValueError(('virtualenv: cannot access %s: No such virtualenv or site directory' % path))
 sys_path = sys.path[:]
 del sys.path[index:]
 import site
 site.addsitedir(site_dir)
 sys.path.extend(sys_path[index:])

def add_vendor_dir ( path , index = 1 ) : venv_path = os . path . join ( path , 'lib' , _PYTHON_VERSION , 'site-packages' ) if os . path . isdir ( venv_path ) : site_dir = venv_path elif os . path . isdir ( path ) : site_dir = path else : raise ValueError ( ( 'virtualenv: cannot access %s: No such virtualenv or site directory' % path ) ) sys_path = sys . path [ : ] del sys . path [ index : ] import site site . addsitedir ( site_dir ) sys . path . extend ( sys_path [ index : ] )
insert site dir or virtualenv at a given index in sys .