Print only errors and only to stderr

This commit is contained in:
Raphael Coeffic
2022-04-01 08:56:25 +02:00
parent 57d1d953c8
commit a3c92632f5
+5 -5
View File
@@ -45,7 +45,7 @@ def getBuiltinHeaderPath(library_path):
subDirs = [f for f in os.listdir(path) if os.path.isdir(path + "/" + f)] subDirs = [f for f in os.listdir(path) if os.path.isdir(path + "/" + f)]
subDirs = sorted(subDirs) or ['.'] subDirs = sorted(subDirs) or ['.']
path = path + "/" + subDirs[-1] + "/include" path = path + "/" + subDirs[-1] + "/include"
print("searching builtins in " + path) #print("searching builtins in " + path)
if canFindBuiltinHeaders(index, ["-I" + path]): if canFindBuiltinHeaders(index, ["-I" + path]):
return path return path
except: except:
@@ -89,13 +89,13 @@ def initLibClang():
library_path = findLibClang() library_path = findLibClang()
if library_path: if library_path:
print("libclang found: " + library_path) #print("libclang found: " + library_path)
if os.path.isdir(library_path): if os.path.isdir(library_path):
Config.set_library_path(library_path) Config.set_library_path(library_path)
else: else:
Config.set_library_file(library_path) Config.set_library_file(library_path)
else: else:
print("ERROR: libclang not found!") print("ERROR: libclang not found!", file=sys.stderr)
return False return False
Config.set_compatibility_check(False) Config.set_compatibility_check(False)
@@ -103,13 +103,13 @@ def initLibClang():
try: try:
index = Index.create() index = Index.create()
except Exception as e: except Exception as e:
print("ERROR: could not load libclang from '%s'." % library_path) print("ERROR: could not load libclang from '%s'." % library_path, file=sys.stderr)
return False return False
global builtin_hdr_path global builtin_hdr_path
builtin_hdr_path = getBuiltinHeaderPath(library_path) builtin_hdr_path = getBuiltinHeaderPath(library_path)
if not builtin_hdr_path: if not builtin_hdr_path:
print("ERROR: builtin header path not found") print("ERROR: builtin header path not found", file=sys.stderr)
return False return False
# Everything is OK, libclang can be used # Everything is OK, libclang can be used