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
2c8c5c4e
Commit
2c8c5c4e
authored
May 15, 2019
by
Dan
Committed by
Wenzel Jakob
Jun 11, 2019
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Split into seperate functions for easier invocation from python.
parent
590e7ace
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
27 additions
and
15 deletions
+27
-15
tools/mkdoc.py
+27
-15
No files found.
tools/mkdoc.py
View file @
2c8c5c4e
...
...
@@ -228,7 +228,7 @@ class ExtractionThread(Thread):
job_semaphore
.
release
()
def
mkdoc
(
args
,
out_file
=
sys
.
stdout
):
def
extract_all
(
args
):
parameters
=
[]
filenames
=
[]
if
"-x"
not
in
args
:
...
...
@@ -273,6 +273,19 @@ def mkdoc(args, out_file=sys.stdout):
if
len
(
filenames
)
==
0
:
raise
NoFilenamesError
(
"args parameter did not contain any filenames"
)
output
=
[]
for
filename
in
filenames
:
thr
=
ExtractionThread
(
filename
,
parameters
,
output
)
thr
.
start
()
print
(
'Waiting for jobs to finish ..'
,
file
=
sys
.
stderr
)
for
i
in
range
(
job_count
):
job_semaphore
.
acquire
()
return
output
def
write_header
(
comments
,
out_file
=
sys
.
stdout
):
print
(
'''/*
This file contains docstrings for the Python bindings.
Do not edit! These were automatically extracted by mkdoc.py
...
...
@@ -298,18 +311,10 @@ def mkdoc(args, out_file=sys.stdout):
#endif
'''
,
file
=
out_file
)
output
=
[]
for
filename
in
filenames
:
thr
=
ExtractionThread
(
filename
,
parameters
,
output
)
thr
.
start
()
print
(
'Waiting for jobs to finish ..'
,
file
=
sys
.
stderr
)
for
i
in
range
(
job_count
):
job_semaphore
.
acquire
()
name_ctr
=
1
name_prev
=
None
for
name
,
_
,
comment
in
list
(
sorted
(
output
,
key
=
lambda
x
:
(
x
[
0
],
x
[
1
]))):
for
name
,
_
,
comment
in
list
(
sorted
(
comments
,
key
=
lambda
x
:
(
x
[
0
],
x
[
1
]))):
if
name
==
name_prev
:
name_ctr
+=
1
name
=
name
+
"_
%
i"
%
name_ctr
...
...
@@ -326,8 +331,8 @@ def mkdoc(args, out_file=sys.stdout):
'''
,
file
=
out_file
)
if
__name__
==
'__main__'
:
args
=
sys
.
argv
[
1
:]
def
mkdoc
(
args
)
:
args
=
list
(
args
)
out_path
=
None
for
idx
,
arg
in
enumerate
(
args
):
if
arg
.
startswith
(
"-o"
):
...
...
@@ -338,11 +343,13 @@ if __name__ == '__main__':
print
(
"-o flag requires an argument"
)
exit
(
-
1
)
break
try
:
comments
=
extract_all
(
args
)
if
out_path
:
try
:
with
open
(
out_path
,
'w'
)
as
out_file
:
mkdoc
(
arg
s
,
out_file
)
write_header
(
comment
s
,
out_file
)
except
:
# In the event of an error, don't leave a partially-written
# output file.
...
...
@@ -352,7 +359,12 @@ if __name__ == '__main__':
pass
raise
else
:
mkdoc
(
args
)
write_header
(
comments
)
if
__name__
==
'__main__'
:
try
:
mkdoc
(
sys
.
argv
[
1
:])
except
NoFilenamesError
:
print
(
'Syntax:
%
s [.. a list of header files ..]'
%
sys
.
argv
[
0
])
exit
(
-
1
)
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