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
ede328a7
Commit
ede328a7
authored
May 15, 2019
by
Dan
Committed by
Wenzel Jakob
Jun 11, 2019
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Allow writing output to file instead of stdout.
parent
a33212df
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
20 additions
and
5 deletions
+20
-5
tools/mkdoc.py
+20
-5
No files found.
tools/mkdoc.py
View file @
ede328a7
...
@@ -230,7 +230,7 @@ class ExtractionThread(Thread):
...
@@ -230,7 +230,7 @@ class ExtractionThread(Thread):
job_semaphore
.
release
()
job_semaphore
.
release
()
def
mkdoc
(
args
):
def
mkdoc
(
args
,
out_file
=
sys
.
stdout
):
parameters
=
[]
parameters
=
[]
filenames
=
[]
filenames
=
[]
if
"-x"
not
in
args
:
if
"-x"
not
in
args
:
...
@@ -298,7 +298,7 @@ def mkdoc(args):
...
@@ -298,7 +298,7 @@ def mkdoc(args):
#pragma GCC diagnostic push
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wunused-variable"
#pragma GCC diagnostic ignored "-Wunused-variable"
#endif
#endif
'''
)
'''
,
file
=
out_file
)
output
.
clear
()
output
.
clear
()
for
filename
in
filenames
:
for
filename
in
filenames
:
...
@@ -319,18 +319,33 @@ def mkdoc(args):
...
@@ -319,18 +319,33 @@ def mkdoc(args):
name_prev
=
name
name_prev
=
name
name_ctr
=
1
name_ctr
=
1
print
(
'
\n
static const char *
%
s =
%
sR"doc(
%
s)doc";'
%
print
(
'
\n
static const char *
%
s =
%
sR"doc(
%
s)doc";'
%
(
name
,
'
\n
'
if
'
\n
'
in
comment
else
' '
,
comment
))
(
name
,
'
\n
'
if
'
\n
'
in
comment
else
' '
,
comment
)
,
file
=
out_file
)
print
(
'''
print
(
'''
#if defined(__GNUG__)
#if defined(__GNUG__)
#pragma GCC diagnostic pop
#pragma GCC diagnostic pop
#endif
#endif
'''
)
'''
,
file
=
out_file
)
if
__name__
==
'__main__'
:
if
__name__
==
'__main__'
:
args
=
sys
.
argv
[
1
:]
out_path
=
None
for
idx
,
arg
in
enumerate
(
args
):
if
arg
.
startswith
(
"-o"
):
args
.
remove
(
arg
)
try
:
out_path
=
arg
[
2
:]
or
args
.
pop
(
idx
)
except
IndexError
:
print
(
"-o flag requires an argument"
)
exit
(
-
1
)
break
try
:
try
:
mkdoc
(
sys
.
argv
[
1
:])
if
out_path
:
with
open
(
out_path
,
'w'
)
as
out_file
:
mkdoc
(
args
,
out_file
)
else
:
mkdoc
(
args
)
except
NoFilenamesError
:
except
NoFilenamesError
:
print
(
'Syntax:
%
s [.. a list of header files ..]'
%
sys
.
argv
[
0
])
print
(
'Syntax:
%
s [.. a list of header files ..]'
%
sys
.
argv
[
0
])
exit
(
-
1
)
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