def locate_config(apache_ctl):
 try:
  proc = subprocess.Popen([apache_ctl, '-V'], stdout=subprocess.PIPE, stderr=subprocess.PIPE)
  (output, _) = proc.communicate()
 except OSError:
  sys.exit(_NO_APACHECTL)
 server_root = config_file = ''
 for line in output.splitlines():
  if ('HTTPD_ROOT' in line):
   server_root = line[(line.find('"') + 1):(-1)]
  elif ('SERVER_CONFIG_FILE' in line):
   config_file = line[(line.find('"') + 1):(-1)]
 if (not (server_root and config_file)):
  sys.exit('Unable to locate Apache configuration. Please run this script again and specify --server-root and --config-file')
 return (server_root, config_file)

def locate_config ( apache_ctl ) : try : proc = subprocess . Popen ( [ apache_ctl , '-V' ] , stdout = subprocess . PIPE , stderr = subprocess . PIPE ) ( output , _ ) = proc . communicate ( ) except OSError : sys . exit ( _NO_APACHECTL ) server_root = config_file = '' for line in output . splitlines ( ) : if ( 'HTTPD_ROOT' in line ) : server_root = line [ ( line . find ( '"' ) + 1 ) : ( - 1 ) ] elif ( 'SERVER_CONFIG_FILE' in line ) : config_file = line [ ( line . find ( '"' ) + 1 ) : ( - 1 ) ] if ( not ( server_root and config_file ) ) : sys . exit ( 'Unable to locate Apache configuration. Please run this script again and specify --server-root and --config-file' ) return ( server_root , config_file )
uses the apachectl binary to find configuration files .