Changeset 237 for tbroadcast/v2/python
- Timestamp:
- Aug 26, 2006, 2:15:12 PM (18 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
tbroadcast/v2/python/tbroadcast.py
r236 r237 29 29 def instanciate_packages(self): 30 30 # We create the schedule of the work units 31 print '# first, we initialize the DAG (takes a long time... huk should be improved asap) ' 31 32 cmd = 'cmt show uses' 32 33 status, output = commands.getstatusoutput (cmd) … … 37 38 current_package = self.get_current_package() 38 39 self.packages [current_package] = {'version': '*', 'dependencies': list(), 'status': 'waiting', 'path':os.getcwd()} 40 indice = 1 39 41 for line in lines: 40 42 if line [0] == '#' and line[:5] != "#CMT>" and line not in ['# Selection :','#']: … … 43 45 if name not in self.packages[current_package]['dependencies']: 44 46 self.packages[current_package]['dependencies'].append (name) 47 print '\n#', indice,':: add package', name 48 indice = indice + 1 45 49 if not self.packages.has_key (name): 46 self.packages [name] = {'version': version, 'dependencies': list(), 'status': 'waiting', 'path': self.get_package_path(name)}47 found = False48 for ligne in lines:50 self.packages [name] = {'version': version, 'dependencies': list(), 'status': 'waiting', 'path': None} 51 found = False 52 for ligne in lines: 49 53 if ligne [0] == '#' and ligne[:5] != "#CMT>" and ligne not in ['# Selection :','#']: 50 54 if found: … … 52 56 if string.split (ligne)[2] not in self.packages[name]['dependencies']: 53 57 self.packages[name]['dependencies'].append (string.split (ligne)[2]) 58 print "# add dependency", string.split (ligne)[2], ' to package ',name 54 59 else: 55 60 found = False … … 57 62 level = string.find(ligne, 'use') 58 63 found = True 64 if line[:4] == "use ": 65 result = string.split (line[4:len(line)], ' ') 66 if self.packages.has_key(result[0]): 67 if len(result)==4: 68 name, version, offset, path = string.split (line[4:len(line)], " ") 69 if os.path.exists(path[1:-1] + '/' + offset + '/' +name + '/' + version + '/cmt'): 70 full_path = path[1:-1] + '/' + offset + '/' +name + '/' + version + '/cmt' 71 elif os.path.exists(path[1:-1] + '/' + offset + '/' +name + '/cmt'): 72 full_path = path[1:-1] + '/' + offset + '/' +name + '/cmt' 73 else: 74 print '# error path not found for', name 75 sys.exit(-1) 76 elif len(result)==5: 77 name, version, offset, path, importation = string.split (line[4:len(line)], " ") 78 if os.path.exists(path[1:-1] + '/' + offset + '/' +name + '/' + version + '/cmt'): 79 full_path = path[1:-1] + '/' + offset + '/' +name + '/' + version + '/cmt' 80 elif os.path.exists(path[1:-1] + '/' + offset + '/' +name + '/cmt'): 81 full_path = path[1:-1] + '/' + offset + '/' +name + '/cmt' 82 else: 83 print '# error path not found for', name 84 sys.exit(-1) 85 elif len(result)==3: 86 name, version, path = string.split (line[4:len(line)], " ") 87 if os.path.exists(path[1:-1] + '/' +name + '/' + version + '/cmt'): 88 full_path = path[1:-1] + '/' +name + '/' + version + '/cmt' 89 elif os.path.exists(path[1:-1] + '/' +name + + '/cmt'): 90 full_path = path[1:-1] + '/' +name + + '/cmt' 91 else: 92 print '# error path not found for', name 93 sys.exit(-1) 94 else: 95 print "error:",line 96 print str(result) 97 sys.exit(-1) 98 self.packages[result[0]]['path'] = full_path 99 print '# really takes a long time... ' 59 100 60 101 def get_current_package(self): … … 75 116 76 117 def get_package_path (self, name): 118 #return os.getcwd () 77 119 cmd = 'cmt -use='+name+' run pwd' 78 120 status, output = commands.getstatusoutput (cmd) … … 82 124 lines = string.split(output, '\n') 83 125 for line in lines: 84 if line [0] != '#': 126 if line [0] != '#' and line[:5] != "#CMT>": 127 print line 85 128 return line 86 129
Note: See TracChangeset
for help on using the changeset viewer.