forked from CollaboraOnline/online
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathautogen.py
More file actions
executable file
·38 lines (34 loc) · 1.21 KB
/
autogen.py
File metadata and controls
executable file
·38 lines (34 loc) · 1.21 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
#!/usr/bin/env python3
#
# Copyright the Collabora Online contributors.
#
# SPDX-License-Identifier: MPL-2.0
#
# This Source Code Form is subject to the terms of the Mozilla Public
# License, v. 2.0. If a copy of the MPL was not distributed with this
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
#
# Reads options from autogen.input, one option at a time, so you don't have to run autogen.sh or
# configure with parameters.
import os
import re
import subprocess
import sys
def main():
cmdline = [sys.argv[0].replace(".py", ".sh")]
with open("autogen.input") as stream:
for line in stream.readlines():
line = line.strip()
if line.startswith("#"):
continue
line = os.path.expandvars(line)
# If an environment variable doesn't expand to a result, expand it to an empty string,
# like the shell does.
line = re.sub(r"\$[A-Za-z_][A-Za-z0-9_]*", "", line)
cmdline.append(line)
cmdline.append("--enable-option-checking=fatal")
print("Running '{}'".format("' '".join(cmdline)))
subprocess.run(cmdline, check=True)
if __name__ == "__main__":
main()
# vim:set shiftwidth=4 softtabstop=4 expandtab: