<s> import os <EOL> import errno <EOL> from pybuilder . core import init , task , use_plugin , description , depends , after <EOL> from pybuilder . utils import assert_can_execute , execute_command <EOL> use_plugin ( "<STR_LIT>" ) <EOL> @ init <EOL> def init_ronn_manpage_plugin ( project ) : <EOL> project . set_property_if_unset ( "<STR_LIT>" , "<STR_LIT>" ) <EOL> project . set_property_if_unset ( "<STR_LIT>" , "<STR_LIT>" ) <EOL> project . set_property_if_unset ( "<STR_LIT>" , <NUM_LIT:1> ) <EOL> @ after ( "<STR_LIT>" ) <EOL> def assert_ronn_is_executable ( logger ) : <EOL> """<STR_LIT>""" <EOL> logger . debug ( "<STR_LIT>" ) <EOL> assert_can_execute ( command_and_arguments = [ "<STR_LIT>" , "<STR_LIT>" ] , <EOL> prerequisite = "<STR_LIT>" , <EOL> caller = "<STR_LIT>" ) <EOL> @ after ( "<STR_LIT>" ) <EOL> def assert_gzip_is_executable ( logger ) : <EOL> """<STR_LIT>""" <EOL> logger . debug ( "<STR_LIT>" ) <EOL> assert_can_execute ( command_and_arguments = [ "<STR_LIT>" , "<STR_LIT>" ] , <EOL> prerequisite = "<STR_LIT>" , <EOL> caller = "<STR_LIT>" ) <EOL> @ task <EOL> @ depends ( "<STR_LIT>" ) <EOL> @ description ( "<STR_LIT>" ) <EOL> def generate_manpages ( project , logger ) : <EOL> """<STR_LIT>""" <EOL> logger . info ( '<STR_LIT>' ) <EOL> try : <EOL> os . makedirs ( project . get_property ( '<STR_LIT>' ) ) <EOL> except OSError as e : <EOL> if e . errno != errno . EEXIST : <EOL> raise <EOL> ronn_report_file = project . expand_path ( "<STR_LIT>" . format ( '<STR_LIT>' ) ) <EOL> generate_manpages_command = build_generate_manpages_command ( project ) <EOL> execute_command ( generate_manpages_command , ronn_report_file , shell = True ) <EOL> def build_generate_manpages_command ( project ) : <EOL> ronn_pipe_command = '<STR_LIT>' % project . get_property ( '<STR_LIT>' ) <EOL> compressed_manpage_file = '<STR_LIT>' % ( project . name , project . get_property ( '<STR_LIT>' ) ) <EOL> compress_command = '<STR_LIT>' % os . path . join ( project . get_property ( '<STR_LIT>' ) , compressed_manpage_file ) <EOL> generate_manpages_command = '<STR_LIT>' % ( ronn_pipe_command , compress_command ) <EOL> return generate_manpages_command </s>
