2 from subprocess
import Popen
, PIPE
7 valid_home
= os
.environ
.get('VALIDATE_HOME')
9 raise OSError('You must set the "VALIDATE_HOME" variable')
10 xsl_stylesheet
= os
.path
.join(valid_home
, 'xslt', 'folint.xsl')
11 if not os
.path
.isfile(xsl_stylesheet
):
12 raise OSError('Cannot find xsl_stylesheet')
13 self
.xsl_stylesheet
= xsl_stylesheet
15 def validate_fo(self
, in_file
):
16 command_list
= ['xsltproc', self
.xsl_stylesheet
, in_file
]
17 p
= Popen(command_list
, stdout
=PIPE
, stderr
=PIPE
)
18 stdout
, stderr
= p
.communicate()
20 sys
.stderr
.write(stderr
)
24 if __name__
== '__main__':
25 validate_obj
= ValidateFo()
26 validate_obj
.validate_fo(sys
.argv
[1])