source: mod_gnutls/test/required-modules.py @ c4ba2b60

asyncioproxy-ticket
Last change on this file since c4ba2b60 was c4ba2b60, checked in by Fiona Klute <fiona.klute@…>, 20 months ago

Test suite: Automatically detect required modules

Which modules are compiled into the Apache binary varies between
distributions. required-modules.py creates additional LoadModule?
directives if needed.

  • Property mode set to 100644
File size: 688 bytes
Line 
1#!/usr/bin/python3
2import os
3import re
4import shutil
5import subprocess
6
7required_modules = {'logio', 'unixd', 'log_config'}
8
9apache2 = os.environ.get('APACHE2')
10if not apache2:
11    apache2 = shutil.which('apache2')
12if not apache2:
13    apache2 = shutil.which('httpd')
14
15result = subprocess.run([apache2, '-l'], check=True,
16                        stdout=subprocess.PIPE, text=True)
17
18built_in_modules = set()
19mod_re = re.compile(r'^\s+mod_(\w+)\.c')
20for line in result.stdout.splitlines():
21    m = mod_re.match(line)
22    if m:
23        built_in_modules.add(m.group(1))
24
25for mod in (required_modules - built_in_modules):
26    print(f'LoadModule\t{mod}_module\t${{AP_LIBEXECDIR}}/mod_{mod}.so')
Note: See TracBrowser for help on using the repository browser.