mirror of
https://git.jami.net/savoirfairelinux/jami-client-qt.git
synced 2025-08-04 23:05:48 +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,
|
# The client submodule has QML files, so we need to run qmlformat on it,
|
||||||
# and thus need to supply the Qt path.
|
# and thus need to supply the Qt path.
|
||||||
execute_script([f'{format_script} --install {client_hooks_dir}'
|
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})
|
{"path": client_hooks_dir})
|
||||||
|
|
||||||
# The daemon submodule has no QML files, so we don't need to run
|
# The daemon submodule has no QML files, so we don't need to run
|
||||||
|
|
|
@ -22,7 +22,7 @@ import shutil
|
||||||
from platform import uname
|
from platform import uname
|
||||||
|
|
||||||
CFVERSION = "9"
|
CFVERSION = "9"
|
||||||
CLANGFORMAT = ""
|
CLANGFORMAT = None
|
||||||
|
|
||||||
QMLFORMAT = None
|
QMLFORMAT = None
|
||||||
|
|
||||||
|
@ -138,27 +138,29 @@ def main():
|
||||||
args = parser.parse_args()
|
args = parser.parse_args()
|
||||||
|
|
||||||
if args.type in ["cpp", "both"]:
|
if args.type in ["cpp", "both"]:
|
||||||
if not command_exists("clang-format-" + CFVERSION):
|
if command_exists("clang-format-" + CFVERSION):
|
||||||
if not command_exists("clang-format"):
|
CLANGFORMAT = "clang-format-" + CFVERSION
|
||||||
print("Required version of clang-format not found")
|
elif command_exists("clang-format"):
|
||||||
sys.exit(1)
|
CLANGFORMAT = "clang-format"
|
||||||
else:
|
|
||||||
CLANGFORMAT = "clang-format"
|
if CLANGFORMAT is not None:
|
||||||
else:
|
|
||||||
CLANGFORMAT = "clang-format-" + CFVERSION
|
|
||||||
print("Using source formatter: " + CLANGFORMAT)
|
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"]:
|
if args.qt is not None and args.type in ["qml", "both"]:
|
||||||
global QMLFORMAT # pylint: disable=global-statement
|
global QMLFORMAT # pylint: disable=global-statement
|
||||||
QMLFORMAT = find_qmlformat(args.qt)
|
QMLFORMAT = find_qmlformat(args.qt)
|
||||||
|
if QMLFORMAT is not None:
|
||||||
if QMLFORMAT is not None:
|
print("Using qmlformatter: " + QMLFORMAT)
|
||||||
print("Using qmlformatter: " + QMLFORMAT)
|
else:
|
||||||
else:
|
print("qmlformat not found, can't format QML files")
|
||||||
print("No qmlformat found, can't format QML files")
|
|
||||||
|
|
||||||
if args.install:
|
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)
|
sys.exit(0)
|
||||||
|
|
||||||
src_files = get_files([".cpp", ".cxx", ".cc", ".h", ".hpp"],
|
src_files = get_files([".cpp", ".cxx", ".cc", ".h", ".hpp"],
|
||||||
|
|
Loading…
Add table
Reference in a new issue