mirror of
https://git.jami.net/savoirfairelinux/jami-client-qt.git
synced 2025-08-04 14:55:43 +02:00
build.py: allow initialization without installing pre-commit hook
Gitlab: #1219 Change-Id: I5a2e2099d6ad1b551e2d744ffbf800b79c36a821
This commit is contained in:
parent
24a0a384ff
commit
0f66152d72
2 changed files with 18 additions and 16 deletions
2
build.py
2
build.py
|
@ -329,7 +329,7 @@ def run_init(args):
|
|||
# The client submodule has QML files, so we need to run qmlformat on it,
|
||||
# and thus need to supply the Qt path.
|
||||
execute_script([f'{format_script} --install {client_hooks_dir}'
|
||||
f' --qt {args.qt}' if args.qt else ''],
|
||||
f' --qt {args.qt}'],
|
||||
{"path": client_hooks_dir})
|
||||
|
||||
# The daemon submodule has no QML files, so we don't need to run
|
||||
|
|
|
@ -22,7 +22,7 @@ import shutil
|
|||
from platform import uname
|
||||
|
||||
CFVERSION = "9"
|
||||
CLANGFORMAT = ""
|
||||
CLANGFORMAT = None
|
||||
|
||||
QMLFORMAT = None
|
||||
|
||||
|
@ -138,27 +138,29 @@ def main():
|
|||
args = parser.parse_args()
|
||||
|
||||
if args.type in ["cpp", "both"]:
|
||||
if not command_exists("clang-format-" + CFVERSION):
|
||||
if not command_exists("clang-format"):
|
||||
print("Required version of clang-format not found")
|
||||
sys.exit(1)
|
||||
else:
|
||||
CLANGFORMAT = "clang-format"
|
||||
else:
|
||||
CLANGFORMAT = "clang-format-" + CFVERSION
|
||||
if command_exists("clang-format-" + CFVERSION):
|
||||
CLANGFORMAT = "clang-format-" + CFVERSION
|
||||
elif command_exists("clang-format"):
|
||||
CLANGFORMAT = "clang-format"
|
||||
|
||||
if CLANGFORMAT is not None:
|
||||
print("Using source formatter: " + CLANGFORMAT)
|
||||
else:
|
||||
print("clang-format not found. can't format source files")
|
||||
|
||||
if args.qt is not None and args.type in ["qml", "both"]:
|
||||
global QMLFORMAT # pylint: disable=global-statement
|
||||
QMLFORMAT = find_qmlformat(args.qt)
|
||||
|
||||
if QMLFORMAT is not None:
|
||||
print("Using qmlformatter: " + QMLFORMAT)
|
||||
else:
|
||||
print("No qmlformat found, can't format QML files")
|
||||
if QMLFORMAT is not None:
|
||||
print("Using qmlformatter: " + QMLFORMAT)
|
||||
else:
|
||||
print("qmlformat not found, can't format QML files")
|
||||
|
||||
if args.install:
|
||||
install_hook(args.install, args.qt)
|
||||
if CLANGFORMAT is not None or QMLFORMAT is not None:
|
||||
install_hook(args.install, args.qt)
|
||||
else:
|
||||
print("No formatters found, skipping hook install")
|
||||
sys.exit(0)
|
||||
|
||||
src_files = get_files([".cpp", ".cxx", ".cc", ".h", ".hpp"],
|
||||
|
|
Loading…
Add table
Reference in a new issue