MCPcopy Create free account
hub / github.com/apache/httpd / _make_modules_conf

Method _make_modules_conf

test/pyhttpd/env.py:132–164  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

130 fd.write(t.substitute(var_map))
131
132 def _make_modules_conf(self):
133 loaded = set()
134 modules_conf = os.path.join(self.env.server_dir, 'conf/modules.conf')
135 with open(modules_conf, 'w') as fd:
136 # issue load directives for all modules we want that are shared
137 missing_mods = list()
138 for m in self._modules:
139 match = re.match(r'^mod_(.+)$', m)
140 if match:
141 m = match.group(1)
142 if m in loaded:
143 continue
144 mod_path = os.path.join(self.env.libexec_dir, f"mod_{m}.so")
145 if os.path.isfile(mod_path):
146 fd.write(f"LoadModule {m}_module \"{mod_path}\"\n")
147 elif m in self.env.dso_modules:
148 missing_mods.append(m)
149 else:
150 fd.write(f"#built static: LoadModule {m}_module \"{mod_path}\"\n")
151 loaded.add(m)
152 for m in self._optional_modules:
153 match = re.match(r'^mod_(.+)$', m)
154 if match:
155 m = match.group(1)
156 if m in loaded:
157 continue
158 mod_path = os.path.join(self.env.libexec_dir, f"mod_{m}.so")
159 if os.path.isfile(mod_path):
160 fd.write(f"LoadModule {m}_module \"{mod_path}\"\n")
161 loaded.add(m)
162 if len(missing_mods) > 0:
163 raise Exception(f"Unable to find modules: {missing_mods} "
164 f"DSOs: {self.env.dso_modules}")
165
166 def _make_htdocs(self):
167 if not os.path.exists(self.env.server_docs_dir):

Callers 1

makeMethod · 0.95

Calls 2

joinMethod · 0.80
addMethod · 0.80

Tested by

no test coverage detected