From d77f7427b0d3478ccf6407e03d3808e607c57456 Mon Sep 17 00:00:00 2001
From: Joseph Weston <joseph@weston.cloud>
Date: Thu, 23 May 2019 10:30:35 +0200
Subject: [PATCH] move documentation-building package installation to docker

---
 .gitlab-ci.yml                    | 6 ------
 docker/Dockerfile.conda           | 4 +++-
 docker/kwant-latest.yml           | 3 +++
 docker/kwant-stable-no-extras.yml | 4 ----
 docker/kwant-stable.yml           | 4 ----
 5 files changed, 6 insertions(+), 15 deletions(-)

diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml
index c95b91e9..81464374 100644
--- a/.gitlab-ci.yml
+++ b/.gitlab-ci.yml
@@ -239,9 +239,6 @@ build documentation:
     - build:latest
   stage: test
   script:
-    - apt-get update && apt-get install -y librsvg2-bin  # for converting svgs to pdfs
-    - pip install git+https://github.com/jupyter-widgets/jupyter-sphinx sphinxcontrib-svg2pdfconverter
-    - python -m ipykernel install --user --name kwant-latest
     - make -C doc clean; make -C doc html SPHINXOPTS='-A website_deploy=True -n -W -D jupyter_execute_default_kernel=kwant-latest' SOURCE_LINK_TEMPLATE="$CI_PROJECT_URL"/blob/\$\$r/\$\$f
   artifacts:
     paths:
@@ -254,9 +251,6 @@ build PDF documentation:
     - build:latest
   stage: test
   script:
-    - apt-get update && apt-get install -y librsvg2-bin  # for converting svgs to pdfs
-    - pip install git+https://github.com/jupyter-widgets/jupyter-sphinx sphinxcontrib-svg2pdfconverter
-    - python -m ipykernel install --user --name kwant-latest
     - make -C doc latex SPHINXOPTS='-n -W -D jupyter_execute_default_kernel=kwant-latest'
     - cd doc/build/latex
     - make all-pdf
diff --git a/docker/Dockerfile.conda b/docker/Dockerfile.conda
index dc2b0b31..5deab0b3 100644
--- a/docker/Dockerfile.conda
+++ b/docker/Dockerfile.conda
@@ -9,7 +9,7 @@ RUN apt-get update && apt-get install -y --no-install-recommends \
         # Additional tools for running CI
         file rsync openssh-client \
         # Documentation building
-        inkscape texlive-full zip \
+        inkscape texlive-full zip librsvg2-bin \
     && apt-get clean && \
     rm -rf /var/lib/apt/lists/*
 
@@ -18,3 +18,5 @@ COPY kwant-latest.yml kwant-stable.yml kwant-stable-no-extras.yml /
 RUN conda env create -qf kwant-stable.yml
 RUN conda env create -qf kwant-stable-no-extras.yml
 RUN conda env create -qf kwant-latest.yml
+
+RUN /usr/local/envs/kwant-latest/bin/python -m ipykernel install --user --name kwant-latest
diff --git a/docker/kwant-latest.yml b/docker/kwant-latest.yml
index 94d526fb..8c35dce6 100644
--- a/docker/kwant-latest.yml
+++ b/docker/kwant-latest.yml
@@ -26,3 +26,6 @@ dependencies:
     - sphinx=1.7.4  # later versions seem to have problems
     - numpydoc
     - requests
+    - pip:
+        - sphinxcontrib-svg2pdfconverter
+        - git+https://github.com/jupyter-widgets/jupyter-sphinx
diff --git a/docker/kwant-stable-no-extras.yml b/docker/kwant-stable-no-extras.yml
index afb5ed70..99b2af16 100644
--- a/docker/kwant-stable-no-extras.yml
+++ b/docker/kwant-stable-no-extras.yml
@@ -19,7 +19,3 @@ dependencies:
     - pytest-cov
     - pytest-flakes
     - pytest-pep8
-    # Documentation building
-    - sphinx=1.7.4  # later versions seem to have problems
-    - numpydoc
-    - requests
diff --git a/docker/kwant-stable.yml b/docker/kwant-stable.yml
index e2d02a00..5e16a86a 100644
--- a/docker/kwant-stable.yml
+++ b/docker/kwant-stable.yml
@@ -22,7 +22,3 @@ dependencies:
     - pytest-cov
     - pytest-flakes
     - pytest-pep8
-    # Documentation building
-    - sphinx=1.7.4  # later versions seem to have problems
-    - numpydoc
-    - requests
-- 
GitLab