Files
codeql/misc/codegen/lib/paths.py
Paolo Tranquilli 14d48e9d58 Add black pre-commit hook
This switched `codegen` from the `autopep8` formatting to the `black`
one, and applies it to `bulk_mad_generator.py` as well. We can enroll
more python scripts to it in the future.
2025-06-10 12:25:39 +02:00

22 lines
564 B
Python

"""module providing useful filesystem paths"""
import pathlib
import sys
import os
_this_file = pathlib.Path(__file__).resolve()
try:
workspace_dir = pathlib.Path(
os.environ["BUILD_WORKSPACE_DIRECTORY"]
).resolve() # <- means we are using bazel run
root_dir = workspace_dir / "swift"
except KeyError:
root_dir = _this_file.parents[2]
workspace_dir = root_dir.parent
lib_dir = _this_file.parents[2] / "codegen" / "lib"
templates_dir = _this_file.parents[2] / "codegen" / "templates"
exe_file = pathlib.Path(sys.argv[0]).resolve()