<s> import sys <EOL> import os <EOL> import codecs <EOL> from hamlpy . hamlpy import Compiler <EOL> from cactus . utils . filesystem import fileList <EOL> CLEANUP = [ ] <EOL> def preBuild ( site ) : <EOL> for path in fileList ( site . paths [ '<STR_LIT>' ] ) : <EOL> if not path . endswith ( '<STR_LIT>' ) : <EOL> continue <EOL> haml_lines = codecs . open ( path , '<STR_LIT:r>' , encoding = '<STR_LIT:utf-8>' ) . read ( ) . splitlines ( ) <EOL> compiler = Compiler ( ) <EOL> output = compiler . process_lines ( haml_lines ) <EOL> outPath = path . replace ( '<STR_LIT>' , '<STR_LIT>' ) <EOL> with open ( outPath , '<STR_LIT:w>' ) as f : <EOL> f . write ( output ) <EOL> CLEANUP . append ( outPath ) <EOL> def postBuild ( site ) : <EOL> global CLEANUP <EOL> for path in CLEANUP : <EOL> print path <EOL> os . remove ( path ) <EOL> CLEANUP = [ ] </s>
