comparison paraspace/dexfile.py @ 132:75a31967ebee

Following the ref in resotre_dependencies()
author Thinker K.F. Li <thinker@codemud.net>
date Tue, 09 Aug 2011 15:30:45 +0800
parents 044bfc415577
children f31bfe55d9c2
comparison
equal deleted inserted replaced
131:044bfc415577 132:75a31967ebee
531 raise ValueError, 'can not find %s' % (self.target_path) 531 raise ValueError, 'can not find %s' % (self.target_path)
532 532
533 attr_path = '.'.join(pparts[1:]) 533 attr_path = '.'.join(pparts[1:])
534 value = _dex_tree_get_child(parent, attr_path) 534 value = _dex_tree_get_child(parent, attr_path)
535 return value 535 return value
536
537 def set_value(self, value, parents):
538 from paraspace.dex_deptracker import _resolve_name_path
539 from paraspace.dex_deptracker import _dex_tree_get_child
540
541 pparts = self.target_path.split('.')
542 clazz_name = pparts[0]
543 clazz, dummy = _resolve_name_path(clazz_name)
544
545 rev_parents = list(parents)
546 rev_parents.reverse()
547
548 for parent in rev_parents:
549 if isinstance(parent, clazz):
550 break
551 pass
552 else:
553 raise ValueError, 'can not find %s' % (self.target_path)
554
555 attr_path = '.'.join(pparts[1:])
556 _dex_tree_set_child(parent, attr_path, value)
557 pass
536 pass 558 pass
537 559
538 560
539 class array(relocatable): 561 class array(relocatable):
540 count_name = None 562 count_name = None