diff options
-rwxr-xr-x | scripts/devtool | 20 |
1 files changed, 8 insertions, 12 deletions
diff --git a/scripts/devtool b/scripts/devtool index 750365c1c9..9f2b7b7ced 100755 --- a/scripts/devtool +++ b/scripts/devtool | |||
@@ -19,8 +19,6 @@ import logging | |||
19 | # This can be removed once our minimum is Python 3.9: https://docs.python.org/3/whatsnew/3.9.html#type-hinting-generics-in-standard-collections | 19 | # This can be removed once our minimum is Python 3.9: https://docs.python.org/3/whatsnew/3.9.html#type-hinting-generics-in-standard-collections |
20 | from typing import List | 20 | from typing import List |
21 | 21 | ||
22 | config = None | ||
23 | |||
24 | 22 | ||
25 | scripts_path = os.path.dirname(os.path.realpath(__file__)) | 23 | scripts_path = os.path.dirname(os.path.realpath(__file__)) |
26 | lib_path = scripts_path + '/lib' | 24 | lib_path = scripts_path + '/lib' |
@@ -93,19 +91,19 @@ class Context: | |||
93 | 91 | ||
94 | def read_workspace(basepath, context): | 92 | def read_workspace(basepath, context): |
95 | workspace = {} | 93 | workspace = {} |
96 | if not os.path.exists(os.path.join(config.workspace_path, 'conf', 'layer.conf')): | 94 | if not os.path.exists(os.path.join(context.config.workspace_path, 'conf', 'layer.conf')): |
97 | if context.fixed_setup: | 95 | if context.fixed_setup: |
98 | logger.error("workspace layer not set up") | 96 | logger.error("workspace layer not set up") |
99 | sys.exit(1) | 97 | sys.exit(1) |
100 | else: | 98 | else: |
101 | logger.info('Creating workspace layer in %s' % config.workspace_path) | 99 | logger.info('Creating workspace layer in %s' % context.config.workspace_path) |
102 | _create_workspace(config.workspace_path, config, basepath) | 100 | _create_workspace(context.config.workspace_path, context.config, basepath) |
103 | if not context.fixed_setup: | 101 | if not context.fixed_setup: |
104 | _enable_workspace_layer(config.workspace_path, config, basepath) | 102 | _enable_workspace_layer(context.config.workspace_path, context.config, basepath) |
105 | 103 | ||
106 | logger.debug('Reading workspace in %s' % config.workspace_path) | 104 | logger.debug('Reading workspace in %s' % context.config.workspace_path) |
107 | externalsrc_re = re.compile(r'^EXTERNALSRC(:pn-([^ =]+))? *= *"([^"]*)"$') | 105 | externalsrc_re = re.compile(r'^EXTERNALSRC(:pn-([^ =]+))? *= *"([^"]*)"$') |
108 | for fn in glob.glob(os.path.join(config.workspace_path, 'appends', '*.bbappend')): | 106 | for fn in glob.glob(os.path.join(context.config.workspace_path, 'appends', '*.bbappend')): |
109 | with open(fn, 'r') as f: | 107 | with open(fn, 'r') as f: |
110 | pnvalues = {} | 108 | pnvalues = {} |
111 | pn = None | 109 | pn = None |
@@ -116,7 +114,7 @@ def read_workspace(basepath, context): | |||
116 | pn = res.group(2) or recipepn | 114 | pn = res.group(2) or recipepn |
117 | # Find the recipe file within the workspace, if any | 115 | # Find the recipe file within the workspace, if any |
118 | bbfile = os.path.basename(fn).replace('.bbappend', '.bb').replace('%', '*') | 116 | bbfile = os.path.basename(fn).replace('.bbappend', '.bb').replace('%', '*') |
119 | recipefile = glob.glob(os.path.join(config.workspace_path, | 117 | recipefile = glob.glob(os.path.join(context.config.workspace_path, |
120 | 'recipes', | 118 | 'recipes', |
121 | recipepn, | 119 | recipepn, |
122 | bbfile)) | 120 | bbfile)) |
@@ -130,7 +128,7 @@ def read_workspace(basepath, context): | |||
130 | if pnvalues: | 128 | if pnvalues: |
131 | if not pn: | 129 | if not pn: |
132 | raise DevtoolError("Found *.bbappend in %s, but could not determine EXTERNALSRC:pn-*. " | 130 | raise DevtoolError("Found *.bbappend in %s, but could not determine EXTERNALSRC:pn-*. " |
133 | "Maybe still using old syntax?" % config.workspace_path) | 131 | "Maybe still using old syntax?" % context.config.workspace_path) |
134 | if not pnvalues.get('srctreebase', None): | 132 | if not pnvalues.get('srctreebase', None): |
135 | pnvalues['srctreebase'] = pnvalues['srctree'] | 133 | pnvalues['srctreebase'] = pnvalues['srctree'] |
136 | logger.debug('Found recipe %s' % pnvalues) | 134 | logger.debug('Found recipe %s' % pnvalues) |
@@ -215,8 +213,6 @@ def _enable_workspace_layer(workspacedir, config, basepath): | |||
215 | 213 | ||
216 | 214 | ||
217 | def main(): | 215 | def main(): |
218 | global config | ||
219 | |||
220 | if sys.getfilesystemencoding() != "utf-8": | 216 | if sys.getfilesystemencoding() != "utf-8": |
221 | sys.exit("Please use a locale setting which supports utf-8.\nPython can't change the filesystem locale after loading so we need a utf-8 when python starts or things won't work.") | 217 | sys.exit("Please use a locale setting which supports utf-8.\nPython can't change the filesystem locale after loading so we need a utf-8 when python starts or things won't work.") |
222 | 218 | ||