aboutsummaryrefslogtreecommitdiff
path: root/mesonbuild/modules
diff options
context:
space:
mode:
authorDylan Baker <dylan@pnwbakers.com>2022-11-18 13:25:12 -0800
committerEli Schwartz <eschwartz@archlinux.org>2023-05-31 17:20:44 -0400
commitada2a976f003f505181d2f252ef907f8caa345e0 (patch)
tree547aac75202aa63aec5688e5c064f80ca43cf557 /mesonbuild/modules
parent1e79553c36bf6473a58559254dc25fc550dfca99 (diff)
downloadmeson-ada2a976f003f505181d2f252ef907f8caa345e0.zip
meson-ada2a976f003f505181d2f252ef907f8caa345e0.tar.gz
meson-ada2a976f003f505181d2f252ef907f8caa345e0.tar.bz2
mlog: use a hidden class for state
This is a pretty common pattern in python (the standard library uses it a ton): A class is created, with a single private instance in the module, and then it's methods are exposed as public API. This removes the need for the global statement, and is generally a little easier to reason about thanks to encapsulation.
Diffstat (limited to 'mesonbuild/modules')
-rw-r--r--mesonbuild/modules/external_project.py4
1 files changed, 2 insertions, 2 deletions
diff --git a/mesonbuild/modules/external_project.py b/mesonbuild/modules/external_project.py
index e0c32da..df7d8f8 100644
--- a/mesonbuild/modules/external_project.py
+++ b/mesonbuild/modules/external_project.py
@@ -204,7 +204,7 @@ class ExternalProject(NewExtensionModule):
def _run(self, step: str, command: T.List[str], workdir: Path) -> None:
mlog.log(f'External project {self.name}:', mlog.bold(step))
m = 'Running command ' + str(command) + ' in directory ' + str(workdir) + '\n'
- log_filename = Path(mlog.log_dir, f'{self.name}-{step}.log')
+ log_filename = Path(mlog.get_log_dir(), f'{self.name}-{step}.log')
output = None
if not self.verbose:
output = open(log_filename, 'w', encoding='utf-8')
@@ -228,7 +228,7 @@ class ExternalProject(NewExtensionModule):
'--srcdir', self.src_dir.as_posix(),
'--builddir', self.build_dir.as_posix(),
'--installdir', self.install_dir.as_posix(),
- '--logdir', mlog.log_dir,
+ '--logdir', mlog.get_log_dir(),
'--make', join_args(self.make),
]
if self.verbose: