<s> """<STR_LIT>""" <EOL> from __future__ import division <EOL> from __future__ import print_function <EOL> from __future__ import unicode_literals <EOL> import glob <EOL> import shlex <EOL> import subprocess <EOL> import yaml <EOL> import utils <EOL> class TravisSimulator ( object ) : <EOL> logStrPrefix = '<STR_LIT>' <EOL> yamlFileLocation = '<STR_LIT>' <EOL> def parseTestCommands ( self ) : <EOL> yamlFile = file ( self . yamlFileLocation ) <EOL> yamlData = yaml . load ( yamlFile ) <EOL> return yamlData [ '<STR_LIT>' ] <EOL> def expandCommand ( self , command ) : <EOL> if '<STR_LIT:*>' not in command : <EOL> return command <EOL> splits = shlex . split ( command ) <EOL> expandedSplits = [ ] <EOL> for split in splits : <EOL> if '<STR_LIT:*>' in split : <EOL> files = glob . glob ( split ) <EOL> expandedSplits . extend ( files ) <EOL> else : <EOL> expandedSplits . append ( split ) <EOL> return '<STR_LIT:U+0020>' . join ( expandedSplits ) <EOL> def runTests ( self ) : <EOL> testCommands = self . parseTestCommands ( ) <EOL> for command in testCommands : <EOL> expandedCommand = self . expandCommand ( command ) <EOL> self . log ( '<STR_LIT>' . format ( expandedCommand ) ) <EOL> try : <EOL> utils . runCommand ( expandedCommand ) <EOL> except subprocess . CalledProcessError : <EOL> self . log ( '<STR_LIT>' ) <EOL> return <EOL> self . log ( '<STR_LIT>' ) <EOL> def log ( self , logStr ) : <EOL> utils . log ( "<STR_LIT>" . format ( self . logStrPrefix , logStr ) ) <EOL> if __name__ == '<STR_LIT:__main__>' : <EOL> travisSimulator = TravisSimulator ( ) <EOL> travisSimulator . runTests ( ) </s>
