/usr/lib/python3/dist-packages/mockbuild/state.py is in mock 1.3.2-2.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 | # -*- coding: utf-8 -*-
# vim: noai:ts=4:sw=4:expandtab
from .exception import StateError
from .trace_decorator import getLog
class State(object):
def __init__(self):
self._state = []
# can be "unknown", "success" or "fail"
self.result = "unknown"
self.state_log = getLog("mockbuild.Root.state")
def state(self):
if not len(self._state):
raise StateError("state called on empty state stack")
return self._state[-1]
def start(self, state):
if state is None:
raise StateError("start called with None State")
self._state.append(state)
self.state_log.info("Start: %s", state)
def finish(self, state):
if len(self._state) == 0:
raise StateError("finish called on empty state list")
current = self._state.pop()
if state != current:
raise StateError("state finish mismatch: current: %s, state: %s" % (current, state))
self.state_log.info("Finish: %s", state)
def alldone(self):
if len(self._state) != 0:
raise StateError("alldone called with pending states: %s" % ",".join(self._state))
|