hotdoc module: remove homebrew function-proxied OrderedSet
We are just using this dictionary to get keys, and we could also just
set it ourselves but with None values. But we have a code abstraction
for this already; use it.
import os
import subprocess
-from collections import OrderedDict
from mesonbuild import mesonlib
from mesonbuild import mlog, build
@@ -53,7 +52,7 @@ class HotdocTargetBuilder:
self.name = name
self.state = state
self.interpreter = interpreter
- self.include_paths = OrderedDict()
+ self.include_paths = mesonlib.OrderedSet()
self.builddir = state.environment.get_build_dir()
self.sourcedir = state.environment.get_source_dir()
@@ -197,7 +196,7 @@ class HotdocTargetBuilder:
self.process_dependencies(dep.get_target_dependencies())
self._subprojects.extend(dep.subprojects)
self.process_dependencies(dep.subprojects)
- self.add_include_path(os.path.join(self.builddir, dep.hotdoc_conf.subdir))
+ self.include_paths.add(os.path.join(self.builddir, dep.hotdoc_conf.subdir))
self.cmd += ['--extra-assets=' + p for p in dep.extra_assets]
self.add_extension_paths(dep.extra_extension_paths)
elif isinstance(dep, (build.CustomTarget, build.BuildTarget)):
@@ -278,9 +277,6 @@ class HotdocTargetBuilder:
if arg in self.kwargs:
raise InvalidArguments(f'Argument "{arg}" is forbidden.')
- def add_include_path(self, path):
- self.include_paths[path] = path
-
def make_targets(self):
self.check_forbidden_args()
self.process_known_arg("--index", value_processor=self.ensure_file)
@@ -288,7 +284,7 @@ class HotdocTargetBuilder:
self.process_known_arg("--sitemap", value_processor=self.ensure_file)
self.process_known_arg("--html-extra-theme", value_processor=self.ensure_dir)
self.process_known_arg(None, "include_paths",
- value_processor=lambda x: [self.add_include_path(self.ensure_dir(v)) for v in x])
+ value_processor=lambda x: [self.include_paths.add(self.ensure_dir(v)) for v in x])
self.process_known_arg('--c-include-directories', argname="dependencies", value_processor=self.process_dependencies)
self.process_gi_c_source_roots()
self.process_extra_assets()
@@ -307,13 +303,13 @@ class HotdocTargetBuilder:
f.write('{}')
self.cmd += ['--conf-file', hotdoc_config_path]
- self.add_include_path(os.path.join(self.builddir, self.subdir))
- self.add_include_path(os.path.join(self.sourcedir, self.subdir))
+ self.include_paths.add(os.path.join(self.builddir, self.subdir))
+ self.include_paths.add(os.path.join(self.sourcedir, self.subdir))
depfile = os.path.join(self.builddir, self.subdir, self.name + '.deps')
self.cmd += ['--deps-file-dest', depfile]
- for path in self.include_paths.keys():
+ for path in self.include_paths:
self.cmd.extend(['--include-path', path])
if self.state.environment.coredata.get_option(mesonlib.OptionKey('werror', subproject=self.state.subproject)):
