Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
E
edx-platform
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
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
edx
edx-platform
Commits
67167830
Commit
67167830
authored
Aug 06, 2013
by
Julian Arni
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix import mocks.
Prevents sphinx from bailing on builds that involve unavailable imports.
parent
0bbd80fe
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
41 additions
and
22 deletions
+41
-22
docs/developers/source/conf.py
+41
-22
No files found.
docs/developers/source/conf.py
View file @
67167830
...
@@ -3,7 +3,7 @@
...
@@ -3,7 +3,7 @@
#pylint: disable=W0622
#pylint: disable=W0622
#pylint: disable=W0212
#pylint: disable=W0212
#pylint: disable=W0613
#pylint: disable=W0613
import
sys
,
os
import
sys
,
os
on_rtd
=
os
.
environ
.
get
(
'READTHEDOCS'
,
None
)
==
'True'
on_rtd
=
os
.
environ
.
get
(
'READTHEDOCS'
,
None
)
==
'True'
...
@@ -26,7 +26,7 @@ html_static_path.append('source/_static')
...
@@ -26,7 +26,7 @@ html_static_path.append('source/_static')
# If extensions (or modules to document with autodoc) are in another directory,
# If extensions (or modules to document with autodoc) are in another directory,
# add these directories to sys.path here. If the directory is relative to the
# add these directories to sys.path here. If the directory is relative to the
# documentation root, use os.path.abspath to make it absolute, like shown here.
# documentation root, use os.path.abspath to make it absolute, like shown here.
#
sys.path.insert(0, os.path.abspath('../../..'))
sys
.
path
.
insert
(
0
,
os
.
path
.
abspath
(
'../../..'
))
root
=
os
.
path
.
abspath
(
'../../..'
)
root
=
os
.
path
.
abspath
(
'../../..'
)
sys
.
path
.
append
(
root
)
sys
.
path
.
append
(
root
)
...
@@ -64,6 +64,45 @@ exclude_patterns = ['build']
...
@@ -64,6 +64,45 @@ exclude_patterns = ['build']
# Output file base name for HTML help builder.
# Output file base name for HTML help builder.
htmlhelp_basename
=
'edXDocs'
htmlhelp_basename
=
'edXDocs'
# --- Mock modules ------------------------------------------------------------
# Mock all the modules that the readthedocs build can't import
import
mock
class
Mock
(
object
):
def
__init__
(
self
,
*
args
,
**
kwargs
):
pass
def
__call__
(
self
,
*
args
,
**
kwargs
):
return
Mock
()
@classmethod
def
__getattr__
(
cls
,
name
):
if
name
in
(
'__file__'
,
'__path__'
):
return
'/dev/null'
elif
name
[
0
]
==
name
[
0
]
.
upper
():
mockType
=
type
(
name
,
(),
{})
mockType
.
__module__
=
__name__
return
mockType
else
:
return
Mock
()
# The list of modules and submodules that we know give RTD trouble.
# Make sure you've tried including the relevant package in
# docs/share/requirements.txt before adding to this list.
MOCK_MODULES
=
[
'numpy'
,
'matplotlib'
,
'matplotlib.pyplot'
,
'scipy.interpolate'
,
'scipy.constants'
,
'scipy.optimize'
,
]
for
mod_name
in
MOCK_MODULES
:
sys
.
modules
[
mod_name
]
=
Mock
()
# -----------------------------------------------------------------------------
# from http://djangosnippets.org/snippets/2533/
# from http://djangosnippets.org/snippets/2533/
# autogenerate models definitions
# autogenerate models definitions
...
@@ -109,27 +148,7 @@ def strip_tags(html):
...
@@ -109,27 +148,7 @@ def strip_tags(html):
s
.
feed
(
html
)
s
.
feed
(
html
)
return
s
.
get_data
()
return
s
.
get_data
()
class
Mock
(
object
):
def
__init__
(
self
,
*
args
,
**
kwargs
):
pass
def
__call__
(
self
,
*
args
,
**
kwargs
):
return
Mock
()
@classmethod
def
__getattr__
(
cls
,
name
):
if
name
in
(
'__file__'
,
'__path__'
):
return
'/dev/null'
elif
name
[
0
]
==
name
[
0
]
.
upper
():
mockType
=
type
(
name
,
(),
{})
mockType
.
__module__
=
__name__
return
mockType
else
:
return
Mock
()
MOCK_MODULES
=
[
'scipy'
,
'numpy'
]
for
mod_name
in
MOCK_MODULES
:
sys
.
modules
[
mod_name
]
=
Mock
()
def
process_docstring
(
app
,
what
,
name
,
obj
,
options
,
lines
):
def
process_docstring
(
app
,
what
,
name
,
obj
,
options
,
lines
):
"""Autodoc django models"""
"""Autodoc django models"""
...
...
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