コード例 #1
0
 def save(self):
     if not self.txt:
         # no changes
         return
     if not self.fn:
         raise exception.InvalidAction(
             "Can't save .spec file without its file name specified.")
     f = codecs.open(self.fn, 'w', encoding='utf-8')
     f.write(self.txt)
     f.close()
     self._rpmspec = None
コード例 #2
0
 def action_deserialize(self, action_sr):
     action = []
     steps = self.actions
     for action_name in action_sr:
         found = False
         for step in steps:
             if unicode(step.name) == action_name:
                 action.append(step)
                 steps = step.steps or []
                 found = True
                 break
         if not found:
             astr = self.action_str(action + [Action(action_name)])
             raise exception.InvalidAction(action=astr)
     return action
コード例 #3
0
 def new_action(self, action, args=None):
     self._new_action_check(action)
     if args:
         self.args = args
     if isinstance(action, _action.Action):
         self.action = [action]
     else:
         self.action = []
         for a in self.action_manager.actions:
             if a.name == action:
                 self.action = [a]
                 break
     if not self.action:
         raise exception.InvalidAction(action=action)
     if not action.atomic and action.steps:
         self.save_state()