Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
C
cpython
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
cpython
Commits
f7338f65
Commit
f7338f65
authored
Jun 22, 2012
by
Antoine Pitrou
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add forgotten files for #14837.
parent
3b36fb1f
Changes
2
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
1710 additions
and
0 deletions
+1710
-0
Modules/_ssl_data.h
Modules/_ssl_data.h
+1653
-0
Tools/ssl/make_ssl_data.py
Tools/ssl/make_ssl_data.py
+57
-0
No files found.
Modules/_ssl_data.h
0 → 100644
View file @
f7338f65
This diff is collapsed.
Click to expand it.
Tools/ssl/make_ssl_data.py
0 → 100644
View file @
f7338f65
#! /usr/bin/env python3
import
datetime
import
os
import
re
import
sys
def
parse_error_codes
(
h_file
,
prefix
):
pat
=
re
.
compile
(
r"#define\
W+(%s([
\w]+))\
W+(
\d+)\b"
%
re
.
escape
(
prefix
))
codes
=
[]
with
open
(
h_file
,
"r"
,
encoding
=
"latin1"
)
as
f
:
for
line
in
f
:
match
=
pat
.
search
(
line
)
if
match
:
code
,
name
,
num
=
match
.
groups
()
num
=
int
(
num
)
codes
.
append
((
code
,
name
,
num
))
return
codes
if
__name__
==
"__main__"
:
openssl_inc
=
sys
.
argv
[
1
]
outfile
=
sys
.
argv
[
2
]
use_stdout
=
outfile
==
'-'
f
=
sys
.
stdout
if
use_stdout
else
open
(
outfile
,
"w"
)
error_libraries
=
(
# (library code, mnemonic, error prefix, header file)
(
'ERR_LIB_PEM'
,
'PEM'
,
'PEM_R_'
,
'pem.h'
),
(
'ERR_LIB_SSL'
,
'SSL'
,
'SSL_R_'
,
'ssl.h'
),
(
'ERR_LIB_X509'
,
'X509'
,
'X509_R_'
,
'x509.h'
),
)
def
w
(
l
):
f
.
write
(
l
+
"
\
n
"
)
w
(
"/* File generated by Tools/ssl/make_ssl_data.py */"
)
w
(
"/* Generated on %s */"
%
datetime
.
datetime
.
now
().
isoformat
())
w
(
""
)
w
(
"static struct py_ssl_library_code library_codes[] = {"
)
for
libcode
,
mnemo
,
_
,
_
in
error_libraries
:
w
(
' {"%s", %s},'
%
(
mnemo
,
libcode
))
w
(
' { NULL }'
)
w
(
'};'
)
w
(
""
)
w
(
"static struct py_ssl_error_code error_codes[] = {"
)
for
libcode
,
_
,
prefix
,
h_file
in
error_libraries
:
codes
=
parse_error_codes
(
os
.
path
.
join
(
openssl_inc
,
h_file
),
prefix
)
for
code
,
name
,
num
in
sorted
(
codes
):
w
(
' #ifdef %s'
%
(
code
))
w
(
' {"%s", %s, %s},'
%
(
name
,
libcode
,
code
))
w
(
' #else'
)
w
(
' {"%s", %s, %d},'
%
(
name
,
libcode
,
num
))
w
(
' #endif'
)
w
(
' { NULL }'
)
w
(
'};'
)
if
not
use_stdout
:
f
.
close
()
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment