project_info: replace os.system w/ subprocess.check_call
This commit is contained in:
@@ -28,6 +28,9 @@ Module for accessing project file data for Blender.
|
|||||||
Before use, call init(cmake_build_dir).
|
Before use, call init(cmake_build_dir).
|
||||||
"""
|
"""
|
||||||
|
|
||||||
|
# TODO: Use CMAKE_EXPORT_COMPILE_COMMANDS (compile_commands.json)
|
||||||
|
# Instead of Eclipse project format.
|
||||||
|
|
||||||
__all__ = (
|
__all__ = (
|
||||||
"SIMPLE_PROJECTFILE",
|
"SIMPLE_PROJECTFILE",
|
||||||
"SOURCE_DIR",
|
"SOURCE_DIR",
|
||||||
@@ -45,14 +48,22 @@ __all__ = (
|
|||||||
|
|
||||||
|
|
||||||
import sys
|
import sys
|
||||||
if not sys.version.startswith("3"):
|
if sys.version_info.major < 3:
|
||||||
print("\nPython3.x needed, found %s.\nAborting!\n" %
|
print("\nPython3.x needed, found %s.\nAborting!\n" %
|
||||||
sys.version.partition(" ")[0])
|
sys.version.partition(" ")[0])
|
||||||
sys.exit(1)
|
sys.exit(1)
|
||||||
|
|
||||||
|
|
||||||
|
import subprocess
|
||||||
import os
|
import os
|
||||||
from os.path import join, dirname, normpath, abspath, splitext, exists
|
from os.path import (
|
||||||
|
abspath,
|
||||||
|
dirname,
|
||||||
|
exists,
|
||||||
|
join,
|
||||||
|
normpath,
|
||||||
|
splitext,
|
||||||
|
)
|
||||||
|
|
||||||
SOURCE_DIR = join(dirname(__file__), "..", "..")
|
SOURCE_DIR = join(dirname(__file__), "..", "..")
|
||||||
SOURCE_DIR = normpath(SOURCE_DIR)
|
SOURCE_DIR = normpath(SOURCE_DIR)
|
||||||
@@ -146,13 +157,13 @@ def cmake_advanced_info():
|
|||||||
raise Exception("Error: win32 is not supported")
|
raise Exception("Error: win32 is not supported")
|
||||||
else:
|
else:
|
||||||
if make_exe_basename.startswith(("make", "gmake")):
|
if make_exe_basename.startswith(("make", "gmake")):
|
||||||
cmd = 'cmake "%s" -G"Eclipse CDT4 - Unix Makefiles"' % CMAKE_DIR
|
cmd = ("cmake", CMAKE_DIR, "-GEclipse CDT4 - Unix Makefiles")
|
||||||
elif make_exe_basename.startswith("ninja"):
|
elif make_exe_basename.startswith("ninja"):
|
||||||
cmd = 'cmake "%s" -G"Eclipse CDT4 - Ninja"' % CMAKE_DIR
|
cmd = ("cmake", CMAKE_DIR, "-GEclipse CDT4 - Ninja")
|
||||||
else:
|
else:
|
||||||
raise Exception("Unknown make program %r" % make_exe)
|
raise Exception("Unknown make program %r" % make_exe)
|
||||||
|
|
||||||
os.system(cmd)
|
subprocess.check_call(cmd)
|
||||||
return join(CMAKE_DIR, ".cproject")
|
return join(CMAKE_DIR, ".cproject")
|
||||||
|
|
||||||
includes = []
|
includes = []
|
||||||
|
Reference in New Issue
Block a user