blob: 161be913b0f491b47ebb0ffa3ecba6c260b7b516 (
plain)
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
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
|
#
# Copyright (C) 2020 Codethink Limited
#
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU Lesser General Public
# License as published by the Free Software Foundation; either
# version 2 of the License, or (at your option) any later version.
#
# This library is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
# Lesser General Public License for more details.
#
# You should have received a copy of the GNU Lesser General Public
# License along with this library. If not, see <http://www.gnu.org/licenses/>.
#
# Authors:
# Tristan Van Berkom <tristan.vanberkom@codethink.co.uk>
# LoaderContext()
#
# An object to keep track of overall context during the load process.
#
# Args:
# context (Context): The invocation context
#
class LoadContext:
def __init__(self, context):
# Keep track of global context required throughout the recursive load
self.context = context
self.rewritable = False
self.fetch_subprojects = None
self.task = None
# set_rewritable()
#
# Sets whether the projects are to be loaded in a rewritable fashion,
# this is used for tracking and is slightly more expensive in load time.
#
# Args:
# task (Task): The task to report progress on
#
def set_rewritable(self, rewritable):
self.rewritable = rewritable
# set_task()
#
# Sets the task for progress reporting.
#
# Args:
# task (Task): The task to report progress on
#
def set_task(self, task):
self.task = task
# set_fetch_subprojects()
#
# Sets the task for progress reporting.
#
# Args:
# task (callable): The callable for loading subprojects
#
def set_fetch_subprojects(self, fetch_subprojects):
self.fetch_subprojects = fetch_subprojects
|