@@ -75,6 +75,7 @@ def _make_ref(symbol, symbol_type, meta):
75
75
ref = ":ref:`" + ref + " <" + target .replace ("_" , "-" ) + ">`"
76
76
else :
77
77
print ("%s(%s) : error : enum symbol not found for etor %s" % (fin , iline + 1 , symbol ))
78
+ raise Exception ()
78
79
elif not re .match ("function" , symbol_type ):
79
80
ref = ":ref:`" + ref .replace ("_" , "-" ) + "`"
80
81
else :
@@ -92,6 +93,8 @@ def _generate_valid_rst(fin, fout, namespace, tags, ver, rev, meta):
92
93
93
94
print ("Generating %s..." % fout )
94
95
96
+ error = False
97
+
95
98
outlines = []
96
99
for iline , line in enumerate (util .textRead (fin )):
97
100
@@ -116,6 +119,7 @@ def _generate_valid_rst(fin, fout, namespace, tags, ver, rev, meta):
116
119
117
120
if re .match (RE_INVALID_TAG_FORMAT , line ):
118
121
print ("%s(%s) : error : invalid %s tag used" % (fin , iline + 1 , re .sub (RE_INVALID_TAG_FORMAT , r"\1" , line )))
122
+ error = True
119
123
120
124
newline = line # new line will contain proper tags for reStructuredText if needed.
121
125
if re .match (RE_PROPER_TAG_FORMAT , line ):
@@ -128,6 +132,7 @@ def _generate_valid_rst(fin, fout, namespace, tags, ver, rev, meta):
128
132
symbol_type = _find_symbol_type (symbol , meta )
129
133
if not symbol_type :
130
134
print ("%s(%s) : error : symbol '%s' not found" % (fin , iline + 1 , symbol ))
135
+ error = True
131
136
continue
132
137
133
138
if code_block and 'function' == symbol_type :
@@ -136,6 +141,7 @@ def _generate_valid_rst(fin, fout, namespace, tags, ver, rev, meta):
136
141
if len (words ) != len (meta ['function' ][symbol ]['params' ]):
137
142
print ("%s(%s) : error : %s parameter count mismatch - %s actual vs. %s expected" % (fin , iline + 1 , symbol , len (words ), len (meta ['function' ][symbol ]['params' ])))
138
143
print ("line = %s" % line )
144
+ error = True
139
145
140
146
ref = _make_ref (symbol , symbol_type , meta )
141
147
if ref :
@@ -157,6 +163,9 @@ def _generate_valid_rst(fin, fout, namespace, tags, ver, rev, meta):
157
163
158
164
outlines .append (newline )
159
165
166
+ if error :
167
+ raise Exception ('Error during reStructuredText generation.' )
168
+
160
169
util .writelines (os .path .abspath (fout ), outlines )
161
170
162
171
return util .makoWrite (os .path .abspath (fout ), fout ,
0 commit comments