2014-09-21 10:34:16 -05:00
|
|
|
import os
|
2018-02-19 07:39:14 -06:00
|
|
|
import sys
|
2014-09-21 10:34:16 -05:00
|
|
|
|
2018-04-05 17:40:09 -05:00
|
|
|
source_dir = os.path.abspath('.')
|
|
|
|
if source_dir not in sys.path:
|
|
|
|
sys.path.insert(0, source_dir)
|
2014-09-21 10:34:16 -05:00
|
|
|
extensions = ['sphinx.ext.autodoc', 'sphinx.ext.viewcode']
|
2016-01-09 00:35:56 -06:00
|
|
|
exclude_patterns = ['_build']
|
2014-09-21 10:34:16 -05:00
|
|
|
|
|
|
|
|
2022-08-28 14:03:17 -05:00
|
|
|
if 'test_linkcode' in tags:
|
2014-09-21 10:34:16 -05:00
|
|
|
extensions.remove('sphinx.ext.viewcode')
|
|
|
|
extensions.append('sphinx.ext.linkcode')
|
|
|
|
|
|
|
|
def linkcode_resolve(domain, info):
|
|
|
|
if domain == 'py':
|
|
|
|
fn = info['module'].replace('.', '/')
|
|
|
|
return "http://foobar/source/%s.py" % fn
|
|
|
|
elif domain == "js":
|
|
|
|
return "http://foobar/js/" + info['fullname']
|
|
|
|
elif domain in ("c", "cpp"):
|
2023-01-01 18:01:14 -06:00
|
|
|
return f"http://foobar/{domain}/{''.join(info['names'])}"
|
2014-09-21 10:34:16 -05:00
|
|
|
else:
|
|
|
|
raise AssertionError()
|