<s> from __future__ import print_function <EOL> from bloom . generators . release import ReleaseGenerator <EOL> from bloom . git import inbranch <EOL> from bloom . logging import warning <EOL> from bloom . packages import get_package_data <EOL> from bloom . util import execute_command <EOL> from bloom . util import get_distro_list_prompt <EOL> class RosReleaseGenerator ( ReleaseGenerator ) : <EOL> title = '<STR_LIT>' <EOL> description = """<STR_LIT>""" <EOL> def prepare_arguments ( self , parser ) : <EOL> add = parser . add_argument <EOL> add ( '<STR_LIT>' , help = "<STR_LIT>" % get_distro_list_prompt ( ) ) <EOL> return ReleaseGenerator . prepare_arguments ( self , parser ) <EOL> def handle_arguments ( self , args ) : <EOL> self . rosdistro = args . rosdistro <EOL> return ReleaseGenerator . handle_arguments ( self , args ) <EOL> def get_branching_arguments ( self ) : <EOL> p , d , s , i = self . prefix , self . rosdistro , self . src , self . interactive <EOL> self . branch_args = [ <EOL> [ '<STR_LIT:/>' . join ( [ p , d , b ] ) , s , i ] for b in self . branch_list <EOL> ] <EOL> return self . branch_args <EOL> def pre_rebase ( self , destination ) : <EOL> name = destination . split ( '<STR_LIT:/>' ) [ - <NUM_LIT:1> ] <EOL> return ReleaseGenerator . pre_rebase ( <EOL> self , destination , <EOL> "<STR_LIT>" . format ( <EOL> name , self . rosdistro , destination <EOL> ) <EOL> ) <EOL> def post_patch ( self , destination ) : <EOL> if self . name is not None : <EOL> warning ( """<STR_LIT>""" ) <EOL> warning ( """<STR_LIT>""" ) <EOL> warning ( "<STR_LIT>" + destination ) <EOL> warning ( "<STR_LIT>" + destination + "<STR_LIT>" ) <EOL> return <EOL> with inbranch ( destination ) : <EOL> name , version , packages = get_package_data ( destination ) <EOL> execute_command ( '<STR_LIT>' + destination + '<STR_LIT:/>' + version + <EOL> '<STR_LIT:->' + str ( self . release_inc ) ) <EOL> def detect_branches ( self ) : <EOL> self . packages = None <EOL> with inbranch ( self . src ) : <EOL> if self . name is not None : <EOL> self . packages = [ self . name ] <EOL> return [ self . name ] <EOL> package_data = get_package_data ( self . src ) <EOL> if type ( package_data ) not in [ list , tuple ] : <EOL> return package_data <EOL> name , version , packages = package_data <EOL> self . packages = packages <EOL> if isinstance ( self . packages , dict ) : <EOL> for path , pkg in self . packages . items ( ) : <EOL> self . metapackage_check ( path , pkg ) <EOL> return name if type ( name ) is list else [ name ] </s>
