Files
test/tools/utils_ide/qtcreator/externaltools/qtc_project_update.py
Bastien Montagne e83d87f588 Move several py scripts from build_files to tools.
Preliminary step towards adding 'system python' validation for some
build-essential py scripts (!130746).

Pull Request: https://projects.blender.org/blender/blender/pulls/132025
2024-12-17 19:02:45 +01:00

41 lines
859 B
Python
Executable File

#!/usr/bin/env python3
# SPDX-FileCopyrightText: 2023 Blender Authors
#
# SPDX-License-Identifier: GPL-2.0-or-later
"""
This is just a wrapper to run Blender's QtCreator project file generator,
knowing only the CMake build path.
qtc_project_update.py <project_path>
"""
import sys
import os
PROJECT_DIR = sys.argv[-1]
def cmake_find_source(path):
import re
match = re.compile(r"^CMAKE_HOME_DIRECTORY\b")
cache = os.path.join(path, "CMakeCache.txt")
with open(cache, 'r', encoding='utf-8') as f:
for l in f:
if re.match(match, l):
return l[l.index("=") + 1:].strip()
return ""
SOURCE_DIR = cmake_find_source(PROJECT_DIR)
cmd = (
"python",
os.path.join(SOURCE_DIR, "tools/utils_ide/cmake_qtcreator_project.py"),
"--build-dir",
PROJECT_DIR,
)
print(cmd)
os.system(" ".join(cmd))