@env.catch_exceptions
def enable_virtualenv():
 path = env.var('g:pymode_virtualenv_path')
 path = os.path.abspath(path)
 enabled = env.var('g:pymode_virtualenv_enabled')
 if (path == enabled):
  env.message(('Virtualenv %s already enabled.' % path))
  return env.stop()
 activate_this = os.path.join(os.path.join(path, 'bin'), 'activate_this.py')
 if (not os.path.exists(activate_this)):
  activate_this = os.path.join(os.path.join(path, 'Scripts'), 'activate_this.py')
 try:
  with open(activate_this) as f:
   source = f.read()
   exec compile(source, activate_this, 'exec') in dict(__file__=activate_this)
 except IOError:
  _activate_env_from_path(path)
 env.message(('Activate virtualenv: ' + path))
 env.let('g:pymode_virtualenv_enabled', path)
 return True

@ env . catch_exceptions def enable_virtualenv ( ) : path = env . var ( 'g:pymode_virtualenv_path' ) path = os . path . abspath ( path ) enabled = env . var ( 'g:pymode_virtualenv_enabled' ) if ( path == enabled ) : env . message ( ( 'Virtualenv %s already enabled.' % path ) ) return env . stop ( ) activate_this = os . path . join ( os . path . join ( path , 'bin' ) , 'activate_this.py' ) if ( not os . path . exists ( activate_this ) ) : activate_this = os . path . join ( os . path . join ( path , 'Scripts' ) , 'activate_this.py' ) try : with open ( activate_this ) as f : source = f . read ( ) exec compile ( source , activate_this , 'exec' ) in dict ( __file__ = activate_this ) except IOError : _activate_env_from_path ( path ) env . message ( ( 'Activate virtualenv: ' + path ) ) env . let ( 'g:pymode_virtualenv_enabled' , path ) return True
enable virtualenv for vim .