Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
tsoc
openmm
Commits
292f9ab5
Commit
292f9ab5
authored
Nov 03, 2015
by
Robert McGibbon
Browse files
Fix install
parent
22784f48
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
41 additions
and
3 deletions
+41
-3
docs-source/api-python/CMakeLists.txt
docs-source/api-python/CMakeLists.txt
+4
-2
docs-source/api-python/conf.py
docs-source/api-python/conf.py
+1
-1
docs-source/api-python/process-docstring.py
docs-source/api-python/process-docstring.py
+36
-0
No files found.
docs-source/api-python/CMakeLists.txt
View file @
292f9ab5
...
@@ -5,6 +5,7 @@ file(GLOB STAGING_INPUT_FILES RELATIVE "${CMAKE_CURRENT_SOURCE_DIR}"
...
@@ -5,6 +5,7 @@ file(GLOB STAGING_INPUT_FILES RELATIVE "${CMAKE_CURRENT_SOURCE_DIR}"
"index.rst"
"index.rst"
"render.py"
"render.py"
"conf.py"
"conf.py"
"process-docstring.py"
"_static/logo.png"
"_static/logo.png"
"_templates/class.rst"
"_templates/class.rst"
)
)
...
@@ -35,6 +36,7 @@ add_custom_command(
...
@@ -35,6 +36,7 @@ add_custom_command(
COMMAND
"
${
PYTHON_EXECUTABLE
}
"
-m sphinx .
"
${
CMAKE_BINARY_DIR
}
/api-python"
COMMAND
"
${
PYTHON_EXECUTABLE
}
"
-m sphinx .
"
${
CMAKE_BINARY_DIR
}
/api-python"
WORKING_DIRECTORY
"
${
CMAKE_CURRENT_BINARY_DIR
}
"
WORKING_DIRECTORY
"
${
CMAKE_CURRENT_BINARY_DIR
}
"
DEPENDS
"
${
CMAKE_CURRENT_BINARY_DIR
}
/conf.py"
DEPENDS
"
${
CMAKE_CURRENT_BINARY_DIR
}
/conf.py"
"
${
CMAKE_CURRENT_BINARY_DIR
}
/process-docstring.py"
"
${
CMAKE_CURRENT_BINARY_DIR
}
/app.rst"
"
${
CMAKE_CURRENT_BINARY_DIR
}
/app.rst"
"
${
CMAKE_CURRENT_BINARY_DIR
}
/library.rst"
"
${
CMAKE_CURRENT_BINARY_DIR
}
/library.rst"
"
${
CMAKE_CURRENT_BINARY_DIR
}
/index.rst"
"
${
CMAKE_CURRENT_BINARY_DIR
}
/index.rst"
...
@@ -44,7 +46,7 @@ add_custom_command(
...
@@ -44,7 +46,7 @@ add_custom_command(
)
)
add_custom_target
(
PythonApiDocs DEPENDS
${
CMAKE_BINARY_DIR
}
/api-python/index.html
)
add_custom_target
(
PythonApiDocs DEPENDS
${
CMAKE_BINARY_DIR
}
/api-python/index.html
)
INSTALL
(
DIRECTORY
"
${
PROJECT
_BINARY_DIR
}
/api-python/"
INSTALL
(
DIRECTORY
"
${
CMAKE
_BINARY_DIR
}
/api-python/"
DESTINATION
"docs/api-python/"
)
DESTINATION
"docs/api-python/"
)
INSTALL
(
FILES
"Python API Reference.html"
INSTALL
(
FILES
"
${
CMAKE_CURRENT_SOURCE_DIR
}
/../
Python API Reference.html"
DESTINATION
"docs/"
)
DESTINATION
"docs/"
)
docs-source/api-python/conf.py
View file @
292f9ab5
...
@@ -5,7 +5,7 @@ import os
...
@@ -5,7 +5,7 @@ import os
import
simtk.openmm.version
import
simtk.openmm.version
extensions
=
[
'sphinx.ext.mathjax'
,
'sphinx.ext.ifconfig'
,
'sphinx.ext.autosummary'
,
extensions
=
[
'sphinx.ext.mathjax'
,
'sphinx.ext.ifconfig'
,
'sphinx.ext.autosummary'
,
'sphinx.ext.autodoc'
,
'numpydoc'
,]
'sphinx.ext.autodoc'
,
'numpydoc'
,
'process-docstring'
]
autosummary_generate
=
True
autosummary_generate
=
True
autodoc_default_flags
=
[
'members'
,
'inherited-members'
]
autodoc_default_flags
=
[
'members'
,
'inherited-members'
]
...
...
docs-source/api-python/process-docstring.py
0 → 100644
View file @
292f9ab5
import
re
def
process_docstring
(
app
,
what
,
name
,
obj
,
options
,
lines
):
"""This hook edits the docstrings to replace "<tt><pre>" html tags
with sphinx directives.
"""
def
repl
(
m
):
s
=
m
.
group
(
1
)
if
not
s
.
startswith
(
linesep
):
s
=
linesep
+
s
newline
=
'.. code-block:: c++'
+
linesep
return
newline
+
' '
+
s
.
replace
(
linesep
,
linesep
+
' '
)
if
name
==
'simtk.openmm.openmm.CustomTorsionForce'
:
print
(
lines
)
linesep
=
'|LINEBREAK|'
joined
=
linesep
.
join
(
lines
)
joined
=
re
.
sub
(
r
'<tt><pre>((|LINEBREAK|)?.*?)</pre></tt>'
,
repl
,
joined
)
joined
=
re
.
sub
(
r
'<tt>(.*?)</tt>'
,
repl
,
joined
)
lines
[:]
=
[(
l
if
not
l
.
isspace
()
else
''
)
for
l
in
joined
.
split
(
linesep
)]
def
setup
(
app
):
app
.
connect
(
'autodoc-process-docstring'
,
process_docstring
)
def
test
():
lines
=
[
'Hello World'
,
'<tt><pre>'
,
'contents'
,
'</pre></tt>'
,
''
,
'<tt>contents2</tt>'
]
linesRef
=
[
'Hello World'
,
'.. code-block:: c++'
,
''
,
' contents'
,
''
,
''
,
'.. code-block:: c++'
,
''
,
' contents2'
]
process_docstring
(
None
,
None
,
None
,
None
,
None
,
lines
)
assert
lines
==
linesRef
if
__name__
==
'__main__'
:
test
()
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