Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit19e1b9b

Browse files
committed
mock C extensions in doc/conf.py for readthedocs.org
1 parent14350ab commit19e1b9b

File tree

1 file changed

+29
-0
lines changed

1 file changed

+29
-0
lines changed

‎doc/conf.py

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -249,3 +249,32 @@
249249

250250
# If true, do not generate a @detailmenu in the "Top" node's menu.
251251
#texinfo_no_detailmenu = False
252+
253+
classCExtMock(object):
254+
"""Required for autodoc on readthedocs.org where you cannot build C extensions."""
255+
def__init__(self,*args,**kwargs):
256+
pass
257+
258+
def__call__(self,*args,**kwargs):
259+
returnCExtMock()
260+
261+
@classmethod
262+
def__getattr__(cls,name):
263+
ifnamein ('__file__','__path__'):
264+
return'/dev/null'
265+
else:
266+
returnCExtMock()
267+
268+
try:
269+
importlxml# flake8: noqa
270+
exceptImportError:
271+
sys.modules['lxml']=CExtMock()
272+
sys.modules['lxml.etree']=CExtMock()
273+
print("warning: lxml modules mocked.")
274+
275+
try:
276+
importgenshi# flake8: noqa
277+
exceptImportError:
278+
sys.modules['genshi']=CExtMock()
279+
sys.modules['genshi.core']=CExtMock()
280+
print("warning: genshi modules mocked.")

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp