Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
P
pybind11
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
open
pybind11
Commits
590e7ace
Commit
590e7ace
authored
May 15, 2019
by
Dan
Committed by
Wenzel Jakob
Jun 11, 2019
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Avoid storing global state.
parent
a163f881
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
7 additions
and
9 deletions
+7
-9
tools/mkdoc.py
+7
-9
No files found.
tools/mkdoc.py
View file @
590e7ace
...
...
@@ -57,8 +57,6 @@ CPP_OPERATORS = OrderedDict(
job_count
=
cpu_count
()
job_semaphore
=
Semaphore
(
job_count
)
output
=
[]
class
NoFilenamesError
(
ValueError
):
pass
...
...
@@ -188,7 +186,7 @@ def process_comment(comment):
return
result
.
rstrip
()
.
lstrip
(
'
\n
'
)
def
extract
(
filename
,
node
,
prefix
):
def
extract
(
filename
,
node
,
prefix
,
output
):
if
not
(
node
.
location
.
file
is
None
or
os
.
path
.
samefile
(
d
(
node
.
location
.
file
.
name
),
filename
)):
return
0
...
...
@@ -199,7 +197,7 @@ def extract(filename, node, prefix):
sub_prefix
+=
'_'
sub_prefix
+=
d
(
node
.
spelling
)
for
i
in
node
.
get_children
():
extract
(
filename
,
i
,
sub_prefix
)
extract
(
filename
,
i
,
sub_prefix
,
output
)
if
node
.
kind
in
PRINT_LIST
:
comment
=
d
(
node
.
raw_comment
)
if
node
.
raw_comment
is
not
None
else
''
comment
=
process_comment
(
comment
)
...
...
@@ -208,15 +206,15 @@ def extract(filename, node, prefix):
sub_prefix
+=
'_'
if
len
(
node
.
spelling
)
>
0
:
name
=
sanitize_name
(
sub_prefix
+
d
(
node
.
spelling
))
global
output
output
.
append
((
name
,
filename
,
comment
))
class
ExtractionThread
(
Thread
):
def
__init__
(
self
,
filename
,
parameters
):
def
__init__
(
self
,
filename
,
parameters
,
output
):
Thread
.
__init__
(
self
)
self
.
filename
=
filename
self
.
parameters
=
parameters
self
.
output
=
output
job_semaphore
.
acquire
()
def
run
(
self
):
...
...
@@ -225,7 +223,7 @@ class ExtractionThread(Thread):
index
=
cindex
.
Index
(
cindex
.
conf
.
lib
.
clang_createIndex
(
False
,
True
))
tu
=
index
.
parse
(
self
.
filename
,
self
.
parameters
)
extract
(
self
.
filename
,
tu
.
cursor
,
''
)
extract
(
self
.
filename
,
tu
.
cursor
,
''
,
self
.
output
)
finally
:
job_semaphore
.
release
()
...
...
@@ -300,9 +298,9 @@ def mkdoc(args, out_file=sys.stdout):
#endif
'''
,
file
=
out_file
)
output
.
clear
()
output
=
[]
for
filename
in
filenames
:
thr
=
ExtractionThread
(
filename
,
parameters
)
thr
=
ExtractionThread
(
filename
,
parameters
,
output
)
thr
.
start
()
print
(
'Waiting for jobs to finish ..'
,
file
=
sys
.
stderr
)
...
...
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