diff options
author | spreis <spreis@yandex-team.ru> | 2022-02-10 16:47:13 +0300 |
---|---|---|
committer | Daniil Cherednik <dcherednik@yandex-team.ru> | 2022-02-10 16:47:13 +0300 |
commit | b49848d6e361b76904f094b7d5e10d6edea75afe (patch) | |
tree | 9814fbd1c3effac9b8377c5d604b367b14e2db55 /contrib/libs/python/gen_includes.py | |
parent | bcd1126cbd5d445cd0665d295198aa39c6ab8cbe (diff) | |
download | ydb-b49848d6e361b76904f094b7d5e10d6edea75afe.tar.gz |
Restoring authorship annotation for <spreis@yandex-team.ru>. Commit 2 of 2.
Diffstat (limited to 'contrib/libs/python/gen_includes.py')
-rw-r--r-- | contrib/libs/python/gen_includes.py | 58 |
1 files changed, 29 insertions, 29 deletions
diff --git a/contrib/libs/python/gen_includes.py b/contrib/libs/python/gen_includes.py index bc73e6e826e..0e024cc49d8 100644 --- a/contrib/libs/python/gen_includes.py +++ b/contrib/libs/python/gen_includes.py @@ -1,24 +1,24 @@ -import sys -import os -import errno -from os import listdir +import sys +import os +import errno +from os import listdir from os.path import dirname, relpath, join - -def ensure_dir_exists(path): - try: - os.makedirs(path) - except OSError as e: - if e.errno == errno.EEXIST and os.path.isdir(path): - pass - else: - raise - -def make_dir(directory): - if not os.path.exists(directory): - os.makedirs(directory) - +def ensure_dir_exists(path): + try: + os.makedirs(path) + except OSError as e: + if e.errno == errno.EEXIST and os.path.isdir(path): + pass + else: + raise + + +def make_dir(directory): + if not os.path.exists(directory): + os.makedirs(directory) + def files(directory): for dirpath, dirnames, filenames in os.walk(directory): @@ -26,22 +26,22 @@ def files(directory): yield relpath(join(dirpath, name), directory) -def headers_set(directory): +def headers_set(directory): return { f for f in files(directory) if f.endswith('.h') and not f.startswith('internal/') } - -if __name__ == "__main__": - - python2_path = sys.argv[1] - python3_path = sys.argv[2] - output_path = sys.argv[3] - - ensure_dir_exists(join('.', python2_path)) - ensure_dir_exists(join('.', python3_path)) - + +if __name__ == "__main__": + + python2_path = sys.argv[1] + python3_path = sys.argv[2] + output_path = sys.argv[3] + + ensure_dir_exists(join('.', python2_path)) + ensure_dir_exists(join('.', python3_path)) + only_headers2 = headers_set(python2_path) only_headers3 = headers_set(python3_path) all_headers = only_headers2 | only_headers3 |