Ignore:
Timestamp:
Nov 10, 2006, 11:23:41 AM (18 years ago)
Author:
garonne
Message:

add the recursive make option

File:
1 edited

Legend:

Unmodified
Added
Removed
  • tbroadcast/HEAD/python/tbroadcast.py

    r261 r306  
    492492      #sys.exit(-1)
    493493
     494   
     495    def generate_make (self, file, command):
     496        print 'generate_make'
     497        makefile = open (file, 'w+')
     498        self.recursive_make (self.current_package, command, makefile, len(self.packages))
     499        makefile.close ()
     500       
     501    def recursive_make (self, package, command, makefile, indice,actions=list()):
     502        lines = self.generate_action_make (package, command, indice)
     503        makefile.write (lines)
     504        print lines               
     505        for pkg in self.packages[package] ['uses']:
     506            if pkg not in actions:
     507                actions.append(pkg)
     508                indice = indice - 1
     509                self.recursive_make(pkg, command,makefile, indice, actions)       
     510       
     511    def generate_action_make (self, package, command, indice):
     512        lines = package + ' :: '       
     513        # add dependencies
     514        for pkg in self.packages[package] ['uses']:
     515            lines = lines + ' ' + pkg           
     516
     517        # add the action itself
     518        newcommand = string.replace (command, '<package>', package)
     519        lines = lines + '\n'
     520        lines = lines +  '\t@echo "#--------------------------------------------------------------"\n'
     521        lines = lines +  '\t@echo "# ('+str(indice)+'/'+str(len(self.packages))+') Now trying ['+newcommand+'] in '+ self.packages[package]['path']+'"\n'
     522        lines = lines +  '\t@echo "#--------------------------------------------------------------"\n'
     523        lines = lines + '\t@cd ' + self.packages[package]['path']           
     524        lines = lines + ' ; ' + newcommand               
     525        lines = lines + '\n\n'
     526        return lines
     527       
    494528#--------- EoF --------#
Note: See TracChangeset for help on using the changeset viewer.