Skip to content

Commit

Permalink
Merge pull request #5743 from chainer/chainerx-docs
Browse files Browse the repository at this point in the history
Build ChainerX documentation on ReadTheDocs
  • Loading branch information
hvy committed Dec 3, 2018
2 parents 87e9bd7 + 6e89f9b commit f7724b6
Show file tree
Hide file tree
Showing 5 changed files with 27 additions and 3 deletions.
2 changes: 1 addition & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ script:
- (for NP in 1 2; do mpiexec -n ${NP} pytest -s -v -m 'not gpu and not slow' chainermn_tests || exit $?; done)
- popd
- if [[ $TRAVIS_OS_NAME == "linux" ]]; then
READTHEDOCS=True python setup.py develop;
python setup.py develop;
fi
- if [[ $SKIP_CHAINERX != 1 ]]; then
pushd docs;
Expand Down
10 changes: 10 additions & 0 deletions docs/rtd_conda.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
# Conda environment definition to build documentation on RTD

name: chainer-docs
dependencies:
- python=3.5
- cmake
- libopenblas
- libgfortran
- pip:
- 'https://github.com/kmaehashi/rtd-chainerx/releases/download/v6.0.0b1/chainer-6.0.0b1-cp35-cp35m-linux_x86_64.whl'
8 changes: 7 additions & 1 deletion docs/source/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
import inspect
import os
import pkg_resources
import site
import sys


Expand Down Expand Up @@ -395,6 +396,10 @@ def _is_git_root(path):
return os.path.isdir(os.path.join(path, '.git'))


def _is_parent_site_packages(path):
return os.path.dirname(path) in site.getsitepackages()


_source_root = None


Expand All @@ -405,7 +410,8 @@ def _find_source_root(source_abs_path):
if _source_root is None:
dir = os.path.dirname(source_abs_path)
while True:
if _is_egg_directory(dir) or _is_git_root(dir):
if (_is_egg_directory(dir) or _is_git_root(dir) or
_is_parent_site_packages(dir)):
# Reached the root directory
_source_root = dir
break
Expand Down
4 changes: 3 additions & 1 deletion readthedocs.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
name: chainer
type: sphinx
base: docs/source
conda:
file: docs/rtd_conda.yml
python:
setup_py_install: true
setup_py_install: false
6 changes: 6 additions & 0 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -187,6 +187,12 @@ def find_any_distribution(pkgs):


build_chainerx = 0 != int(os.getenv('CHAINER_BUILD_CHAINERX', '0'))
if os.getenv('READTHEDOCS', None) == 'True':
# TODO(kmaehashi) build ChainerX documentation on RTD
build_chainerx = False
#os.environ['MAKEFLAGS'] = '-j4'
#build_chainerx = True

chainerx_build_helper.config_setup_kwargs(setup_kwargs, build_chainerx)


Expand Down

0 comments on commit f7724b6

Please sign in to comment.