def load_from_envvar(envvar):
 value = os.environ[envvar].strip().strip('"\' ')
 if (platform.system() == 'Windows'):
  executable_dir = os.path.join(value, 'install', 'bin')
  python_dir = os.path.join(value, 'install', 'python')
 else:
  executable_dir = os.path.join(value, 'build', 'tools')
  python_dir = os.path.join(value, 'python')
 try:
  executable = find_executable_in_dir(executable_dir)
  if (executable is None):
   raise ValueError(('Caffe executable not found at "%s"' % executable_dir))
  if (not is_pycaffe_in_dir(python_dir)):
   raise ValueError(('Pycaffe not found in "%s"' % python_dir))
  import_pycaffe(python_dir)
  (version, flavor) = get_version_and_flavor(executable)
 except:
  print ('"%s" from %s does not point to a valid installation of Caffe.' % (value, envvar))
  print 'Use the envvar CAFFE_ROOT to indicate a valid installation.'
  raise
 return (executable, version, flavor)

def load_from_envvar ( envvar ) : value = os . environ [ envvar ] . strip ( ) . strip ( '"\' ' ) if ( platform . system ( ) == 'Windows' ) : executable_dir = os . path . join ( value , 'install' , 'bin' ) python_dir = os . path . join ( value , 'install' , 'python' ) else : executable_dir = os . path . join ( value , 'build' , 'tools' ) python_dir = os . path . join ( value , 'python' ) try : executable = find_executable_in_dir ( executable_dir ) if ( executable is None ) : raise ValueError ( ( 'Caffe executable not found at "%s"' % executable_dir ) ) if ( not is_pycaffe_in_dir ( python_dir ) ) : raise ValueError ( ( 'Pycaffe not found in "%s"' % python_dir ) ) import_pycaffe ( python_dir ) ( version , flavor ) = get_version_and_flavor ( executable ) except : print ( '"%s" from %s does not point to a valid installation of Caffe.' % ( value , envvar ) ) print 'Use the envvar CAFFE_ROOT to indicate a valid installation.' raise return ( executable , version , flavor )
load information from an installation indicated by an environment variable .