aboutsummaryrefslogtreecommitdiffstats
path: root/build/scripts/preprocess.py
diff options
context:
space:
mode:
authorAnton Samokhvalov <pg83@yandex.ru>2022-02-10 16:45:15 +0300
committerDaniil Cherednik <dcherednik@yandex-team.ru>2022-02-10 16:45:15 +0300
commit72cb13b4aff9bc9cf22e49251bc8fd143f82538f (patch)
treeda2c34829458c7d4e74bdfbdf85dff449e9e7fb8 /build/scripts/preprocess.py
parent778e51ba091dc39e7b7fcab2b9cf4dbedfb6f2b5 (diff)
downloadydb-72cb13b4aff9bc9cf22e49251bc8fd143f82538f.tar.gz
Restoring authorship annotation for Anton Samokhvalov <pg83@yandex.ru>. Commit 1 of 2.
Diffstat (limited to 'build/scripts/preprocess.py')
-rw-r--r--build/scripts/preprocess.py88
1 files changed, 44 insertions, 44 deletions
diff --git a/build/scripts/preprocess.py b/build/scripts/preprocess.py
index 4657bef732..24846b4c23 100644
--- a/build/scripts/preprocess.py
+++ b/build/scripts/preprocess.py
@@ -1,48 +1,48 @@
import sys
import os
-
-
-def load_file(p):
- with open(p, 'r') as f:
- return f.read()
-
-
-def step(base, data, hh):
- def flt():
- for l in data.split('\n'):
- if l in hh:
- pp = os.path.join(base, hh[l])
-
- yield '\n\n' + load_file(pp) + '\n\n'
-
- os.unlink(pp)
- else:
- yield l
-
- return '\n'.join(flt())
-
-
-def subst_headers(path, headers):
- hh = dict()
-
- for h in headers:
- hh['# include "' + h + '"'] = h
-
- data = load_file(path)
- prev = data
-
- while True:
- ret = step(os.path.dirname(path), prev, hh)
-
- if ret == prev:
- break
-
- prev = ret
-
- if data != prev:
- with open(path, 'w') as f:
- f.write(prev)
-
-
+
+
+def load_file(p):
+ with open(p, 'r') as f:
+ return f.read()
+
+
+def step(base, data, hh):
+ def flt():
+ for l in data.split('\n'):
+ if l in hh:
+ pp = os.path.join(base, hh[l])
+
+ yield '\n\n' + load_file(pp) + '\n\n'
+
+ os.unlink(pp)
+ else:
+ yield l
+
+ return '\n'.join(flt())
+
+
+def subst_headers(path, headers):
+ hh = dict()
+
+ for h in headers:
+ hh['# include "' + h + '"'] = h
+
+ data = load_file(path)
+ prev = data
+
+ while True:
+ ret = step(os.path.dirname(path), prev, hh)
+
+ if ret == prev:
+ break
+
+ prev = ret
+
+ if data != prev:
+ with open(path, 'w') as f:
+ f.write(prev)
+
+
if __name__ == '__main__':
subst_headers(sys.argv[1], ['stack.hh', 'position.hh', 'location.hh'])