summaryrefslogtreecommitdiffstats
path: root/base/common/python
diff options
context:
space:
mode:
Diffstat (limited to 'base/common/python')
-rw-r--r--base/common/python/pki/util.py12
1 files changed, 12 insertions, 0 deletions
diff --git a/base/common/python/pki/util.py b/base/common/python/pki/util.py
index 7220a7d49..2cac1d816 100644
--- a/base/common/python/pki/util.py
+++ b/base/common/python/pki/util.py
@@ -123,3 +123,15 @@ def chown(path, uid, gid):
os.chown(itempath, uid, gid)
elif os.path.isdir(itempath):
chown(itempath, uid, gid)
+
+
+def customize_file(input_file, output_file, params):
+ """
+ Customize a file with specified parameters.
+ """
+
+ with open(input_file) as infile, open(output_file, 'w') as outfile:
+ for line in infile:
+ for src, target in params.items():
+ line = line.replace(src, target)
+ outfile.write(line)