Skip to content
Snippets Groups Projects
Commit de466dcc authored by Alexis Durgnat's avatar Alexis Durgnat :milky_way:
Browse files

Add doc generation support

parent cd099099
Branches
No related tags found
No related merge requests found
......@@ -30,12 +30,17 @@ RUN python3 -m pip install --upgrade pip
RUN python3 -m pip install cython numpy opencv-python pybind11 build
# Venv for python-build
RUN apt-get install -y python3-venv
# Sphinx for documentation
RUN python3 -m pip install sphinx sphinx_rtd_theme
# Create paths
RUN mkdir -p /build && mkdir -p /opt/scripts/
RUN mkdir -p $src_path
WORKDIR $src_path
# Copy the necessary scripts in
COPY ./Scripts/* /opt/scripts/
RUN chmod +x /opt/scripts/*
ENTRYPOINT [ "/opt/scripts/entrypoint.sh" ]
# ENTRYPOINT [ "./sandbox_docker-builder/entrypoint.sh" ]
\ No newline at end of file
......@@ -11,5 +11,8 @@ create: docker-compose.yml Dockerfile
build: docker-compose.yml
$(DCR) $(CONTAINER_NAME) build
docs: docker-compose.yml
$(DCR) $(CONTAINER_NAME) docs html
clean: docker-compose.yml
$(DCR) $(CONTAINER_NAME) clean
\ No newline at end of file
......@@ -56,6 +56,7 @@ The provided makefile allow simple manipulation of the docker to build, clean an
| create | `make create` | Build the docker container |
| build (default) | `make` or `make build` | Build everything |
| clean | `make clean` | Cleanup |
| docs | `make docs` | Build the documentation for the python wrapper (Lib and wrapper must be built beforehand) |
## Docker container
......@@ -72,6 +73,7 @@ The following arguments are available :
| Arg | Description |
|-- |--|
| `build [lib] [wrapper]` | Will build the indicated component. `wrapper` should be built after `lib`. If none provided, build everything. |
| `docs [mode] [opts]` | Build the wrapper documentation using sphinx-build. Everything must be already built. You may override `mode` (default to `html`.). You may override the sphinx-build options by passing `opts` which are relayed to the sphinx-build command. To provide `opts`, `mode` must be set. |
| `clean [lib] [wrapper]` | Will cleanup the build directories. If no component provided, clean everything. |
| `bash` or `s` | Execute a bash terminal inside the docker. May or may not be useful. |
| `exec CMD [ARGS]` or `c [CMD] [ARGS]` | Execute the command `CMD` with the arguments `ARGS` inside the docker. May or may not be useful. |
\ No newline at end of file
......@@ -81,6 +81,29 @@ function build_all() {
make_target $SBOX_PYWR
}
function make_python_docs() {
export LD_LIBRARY_PATH=$SBOX_LIB/build/
local MODE='html'
if [ ! -z $1 ]; then
MODE=$1
shift
fi
if [ ! -z $1 ]; then
SOPT="$@"
echo $SOPT
fi
echo -e "${GRN}Running sphinx-build in html mode.${NC}"
cd $SBOX_PYWR/docs/ && SPHINXOPTS=$SOPT make $MODE
}
function clean_python_doc() {
cd $SBOX_PYWR/docs/ && make clean && rm -rf ./_build
}
function build_doc() {
clean_python_doc
make_python_docs $@
}
## Main entry of script. Check for arguments
if [ $# -gt 0 ]; then
......@@ -143,11 +166,17 @@ if [ $# -gt 0 ]; then
elif [ $1 = "test" ]; then
shift
/opt/scripts/test-pypackage.sh
exit 0
elif [ $1 = "docs" ]; then
shift
build_doc $@
exit 0
elif [ $1 = "bt" ]; then
shift
build_all
copy_artifacts
/opt/scripts/test-pypackage.sh
exit 0
fi
exit 1
fi
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment