MCPcopy Index your code
hub / github.com/python/cpython / main

Function main

Tools/ssl/make_ssl_data.py:197–239  ·  view source on GitHub ↗
(args=None)

Source from the content-addressed store, hash-verified

195
196
197def main(args=None):
198 args = parser.parse_args(args)
199 if not os.path.isdir(args.srcdir):
200 error(f"OpenSSL directory not found: {args.srcdir}")
201 args.err_h = os.path.join(args.srcdir, "include", "openssl", "err.h")
202 if not os.path.isfile(args.err_h):
203 # Fall back to infile for OpenSSL 3.0.0 and later.
204 args.err_h += ".in"
205 args.errcodes = os.path.join(args.srcdir, "crypto", "err", "openssl.ec")
206 if not os.path.isfile(args.errcodes):
207 error(f"file {args.errcodes} not found in {args.srcdir}")
208 args.errtxt = os.path.join(args.srcdir, "crypto", "err", "openssl.txt")
209 if not os.path.isfile(args.errtxt):
210 error(f"file {args.errtxt} not found in {args.srcdir}")
211
212 # [("ERR_LIB_X509", "X509", 11), ...]
213 args.lib2errnum = parse_err_h(args)
214
215 # [('X509_R_AKID_MISMATCH', 'X509', 'AKID_MISMATCH', 110), ...]
216 reasons = []
217 reasons.extend(parse_openssl_error_text(args))
218 reasons.extend(parse_extra_reasons(args))
219 # sort by macro name and numeric error code
220 args.reasons = sorted(reasons, key=operator.itemgetter(0, 3))
221
222 commit = get_openssl_git_commit(args)
223 lines = [
224 "/* File generated by Tools/ssl/make_ssl_data.py */",
225 f"/* Generated on {datetime.datetime.now(datetime.UTC).isoformat()} */",
226 f"/* Generated from Git commit {commit} */",
227 "",
228 ]
229 lines.extend(gen_library_codes(args))
230 lines.append("")
231 lines.extend(gen_error_codes(args))
232
233 if args.output is None:
234 for line in lines:
235 print(line)
236 else:
237 with open(args.output, 'w') as output:
238 for line in lines:
239 print(line, file=output)
240
241
242if __name__ == "__main__":

Callers 1

make_ssl_data.pyFile · 0.70

Calls 15

parse_err_hFunction · 0.85
parse_openssl_error_textFunction · 0.85
parse_extra_reasonsFunction · 0.85
get_openssl_git_commitFunction · 0.85
gen_library_codesFunction · 0.85
gen_error_codesFunction · 0.85
nowMethod · 0.80
errorFunction · 0.70
openFunction · 0.50
parse_argsMethod · 0.45
isdirMethod · 0.45
joinMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…