#NEWLINE# def main( argv = None ) : #NEWLINE# #INDENT# if hasattr ( os , 'getuid' ) : #NEWLINE# #INDENT# if ( os . getuid ( ) == 0 ) : #NEWLINE# #INDENT# pprint ( 'RED' , 'Using bentomaker under root/sudo is *strongly* discouraged - do you want to continue ? y/N' ) #NEWLINE# ans = input ( ) #NEWLINE# if ( not ( ans . lower ( ) in [ 'y' , 'yes' ] ) ) : #NEWLINE# #INDENT# raise bento . errors . UsageException ( 'bentomaker execution canceld (not using bentomaker with admin privileges)' ) #NEWLINE# #UNINDENT# #UNINDENT# #UNINDENT# if ( argv is None ) : #NEWLINE# #INDENT# argv = sys . argv [ 1 : ] #NEWLINE# #UNINDENT# options_context = create_global_options_context ( ) #NEWLINE# popts = parse_global_options ( options_context , argv ) #NEWLINE# cmd_name = popts . cmd_name #NEWLINE# if popts . show_version : #NEWLINE# #INDENT# print ( bento . __version__ ) #NEWLINE# return #NEWLINE# #UNINDENT# if popts . show_full_version : #NEWLINE# #INDENT# print ( ( ( bento . __version__ + 'git' ) + bento . __git_revision__ ) ) #NEWLINE# return #NEWLINE# #UNINDENT# source_root = os . path . join ( os . getcwd ( ) , os . path . dirname ( popts . bento_info ) ) #NEWLINE# build_root = os . path . join ( os . getcwd ( ) , popts . build_directory ) #NEWLINE# ( top_node , build_node , run_node ) = bento . core . node . create_base_nodes ( source_root , build_root ) #NEWLINE# if ( ( run_node != top_node ) and run_node . is_src ( ) ) : #NEWLINE# #INDENT# raise bento . errors . UsageException ( 'You cannot execute bentomaker in a subdirectory of the source tree !' ) #NEWLINE# #UNINDENT# if ( ( run_node != build_node ) and run_node . is_bld ( ) ) : #NEWLINE# #INDENT# raise bento . errors . UsageException ( 'You cannot execute bentomaker in a subdirectory of the build tree !' ) #NEWLINE# #UNINDENT# global_context = GlobalContext ( build_node . make_node ( CMD_DATA_DUMP ) , CommandRegistry ( ) , ContextRegistry ( ) , OptionsRegistry ( ) , CommandScheduler ( ) ) #NEWLINE# global_context . register_options_context_without_command ( '' , options_context ) #NEWLINE# if ( not popts . disable_autoconfigure ) : #NEWLINE# #INDENT# global_context . set_before ( 'build' , 'configure' ) #NEWLINE# #UNINDENT# global_context . set_before ( 'build_egg' , 'build' ) #NEWLINE# global_context . set_before ( 'build_wininst' , 'build' ) #NEWLINE# global_context . set_before ( 'install' , 'build' ) #NEWLINE# if ( cmd_name and ( cmd_name not in [ 'convert' ] ) ) : #NEWLINE# #INDENT# return _wrapped_main ( global_context , popts , run_node , top_node , build_node ) #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# cached_package = None #NEWLINE# register_stuff ( global_context ) #NEWLINE# for cmd_name in global_context . command_names ( ) : #NEWLINE# #INDENT# register_options ( global_context , cmd_name ) #NEWLINE# #UNINDENT# return _main ( global_context , cached_package , popts , run_node , top_node , build_node )