diff options
Diffstat (limited to 'meta/lib/patchtest/patch.py')
-rw-r--r-- | meta/lib/patchtest/patch.py | 43 |
1 files changed, 0 insertions, 43 deletions
diff --git a/meta/lib/patchtest/patch.py b/meta/lib/patchtest/patch.py deleted file mode 100644 index 90faf3eeb4..0000000000 --- a/meta/lib/patchtest/patch.py +++ /dev/null | |||
@@ -1,43 +0,0 @@ | |||
1 | # ex:ts=4:sw=4:sts=4:et | ||
2 | # -*- tab-width: 4; c-basic-offset: 4; indent-tabs-mode: nil -*- | ||
3 | # | ||
4 | # patchtestpatch: PatchTestPatch class which abstracts a patch file | ||
5 | # | ||
6 | # Copyright (C) 2016 Intel Corporation | ||
7 | # | ||
8 | # SPDX-License-Identifier: GPL-2.0-only | ||
9 | # | ||
10 | |||
11 | import logging | ||
12 | import utils | ||
13 | |||
14 | logger = logging.getLogger('patchtest') | ||
15 | |||
16 | class PatchTestPatch(object): | ||
17 | def __init__(self, path, forcereload=False): | ||
18 | self._path = path | ||
19 | self._forcereload = forcereload | ||
20 | |||
21 | self._contents = None | ||
22 | self._branch = None | ||
23 | |||
24 | @property | ||
25 | def contents(self): | ||
26 | if self._forcereload or (not self._contents): | ||
27 | logger.debug('Reading %s contents' % self._path) | ||
28 | try: | ||
29 | with open(self._path, newline='') as _f: | ||
30 | self._contents = _f.read() | ||
31 | except IOError: | ||
32 | logger.warn("Reading the mbox %s failed" % self.resource) | ||
33 | return self._contents | ||
34 | |||
35 | @property | ||
36 | def path(self): | ||
37 | return self._path | ||
38 | |||
39 | @property | ||
40 | def branch(self): | ||
41 | if not self._branch: | ||
42 | self._branch = utils.get_branch(self._path) | ||
43 | return self._branch | ||