Skip to content

Commit c135a5c

Browse files
committed
Cleanup find_xml_generator, drop support for gccxml
1 parent 39c85bd commit c135a5c

File tree

1 file changed

+17
-32
lines changed

1 file changed

+17
-32
lines changed

pygccxml/utils/utils.py

Lines changed: 17 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -31,49 +31,34 @@ def is_str(string):
3131
return isinstance(string, basestring)
3232

3333

34-
def find_xml_generator(name=None):
34+
def find_xml_generator(name="castxml"):
3535
"""
36-
Try to find a c++ parser. Returns path and name.
36+
Try to find a c++ parser (xml generator)
3737
38-
:param name: name of the c++ parser: castxml or gccxml
39-
:type name: str
38+
Args:
39+
name (str): name of the c++ parser (e.g. castxml)
40+
41+
Returns:
42+
path (str), name (str): path to the xml generator and it's name
4043
41-
If no name is given the function first looks for castxml,
42-
then for gccxml. If no c++ parser is found the function
43-
raises an exception.
44+
45+
If no c++ parser is found the function raises an exception.
46+
pygccxml does currently only support castxml as c++ parser.
4447
4548
"""
4649
if platform.system() == "Windows":
4750
command = "where"
4851
else:
4952
command = "which"
5053

51-
if name is None:
52-
name = "castxml"
53-
p = subprocess.Popen([command, name], stdout=subprocess.PIPE,
54-
stderr=subprocess.PIPE)
55-
path = p.stdout.read().decode("utf-8")
56-
p.wait()
57-
p.stdout.close()
58-
p.stderr.close()
59-
if path == "":
60-
name = "gccxml"
61-
p = subprocess.Popen([command, name], stdout=subprocess.PIPE,
62-
stderr=subprocess.PIPE)
63-
path = p.stdout.read().decode("utf-8")
64-
p.wait()
65-
p.stdout.close()
66-
p.stderr.close()
67-
else:
68-
p = subprocess.Popen([command, name], stdout=subprocess.PIPE,
69-
stderr=subprocess.PIPE)
70-
path = p.stdout.read().decode("utf-8")
71-
p.wait()
72-
p.stdout.close()
73-
p.stderr.close()
54+
p = subprocess.Popen([command, name], stdout=subprocess.PIPE,
55+
stderr=subprocess.PIPE)
56+
path = p.stdout.read().decode("utf-8")
57+
p.wait()
58+
p.stdout.close()
59+
p.stderr.close()
7460
if path == "":
75-
raise(Exception(
76-
"No c++ parser found. Please install castxml or gccxml."))
61+
raise(Exception("No c++ parser found. Please install castxml."))
7762
else:
7863
return path.rstrip(), name
7964

0 commit comments

Comments
 (0)