<s> import os <EOL> import re <EOL> from subprocess import Popen , PIPE <EOL> def find_command ( cmd , path = None , pathext = None ) : <EOL> if path is None : <EOL> path = os . environ . get ( '<STR_LIT>' , [ ] ) . split ( os . pathsep ) <EOL> if isinstance ( path , basestring ) : <EOL> path = [ path ] <EOL> if pathext is None : <EOL> pathext = os . environ . get ( '<STR_LIT>' , '<STR_LIT>' ) . split ( os . pathsep ) <EOL> for ext in pathext : <EOL> if cmd . endswith ( ext ) : <EOL> pathext = [ '<STR_LIT>' ] <EOL> break <EOL> for p in path : <EOL> f = os . path . join ( p , cmd ) <EOL> if os . path . isfile ( f ) : <EOL> return f <EOL> for ext in pathext : <EOL> fext = f + ext <EOL> if os . path . isfile ( fext ) : <EOL> return fext <EOL> return None <EOL> xgettext_cmd = find_command ( '<STR_LIT>' ) <EOL> if xgettext_cmd : <EOL> p = Popen ( '<STR_LIT>' % xgettext_cmd , shell = True , stdout = PIPE , stderr = PIPE , close_fds = os . name != '<STR_LIT>' , universal_newlines = True ) <EOL> output = p . communicate ( ) [ <NUM_LIT:0> ] <EOL> match = re . search ( r'<STR_LIT>' , output ) <EOL> if match : <EOL> xversion = ( int ( match . group ( '<STR_LIT>' ) ) , int ( match . group ( '<STR_LIT>' ) ) ) <EOL> if xversion >= ( <NUM_LIT:0> , <NUM_LIT:15> ) : <EOL> from extraction import * <EOL> del p </s>
