def _find_prefix(filename):
 if (not is_venv):
  return sys.prefix
 filename = os.path.abspath(filename)
 prefixes = [os.path.abspath(sys.prefix), base_prefix]
 possible_prefixes = []
 for prefix in prefixes:
  common = os.path.commonprefix([prefix, filename])
  if (common == prefix):
   possible_prefixes.append(prefix)
 possible_prefixes.sort(key=(lambda p: len(p)), reverse=True)
 return possible_prefixes[0]

def _find_prefix ( filename ) : if ( not is_venv ) : return sys . prefix filename = os . path . abspath ( filename ) prefixes = [ os . path . abspath ( sys . prefix ) , base_prefix ] possible_prefixes = [ ] for prefix in prefixes : common = os . path . commonprefix ( [ prefix , filename ] ) if ( common == prefix ) : possible_prefixes . append ( prefix ) possible_prefixes . sort ( key = ( lambda p : len ( p ) ) , reverse = True ) return possible_prefixes [ 0 ]
in virtualenv .