diff --git a/gitlab/deploy.sh b/gitlab/deploy.sh
index 62aae11505f407ebe9c31f4f5dffdaa23a536e9e..81c6ab63d415c7cd62f1f909ee25ae12ac42a24a 100755
--- a/gitlab/deploy.sh
+++ b/gitlab/deploy.sh
@@ -17,13 +17,12 @@ for os in "osx-64" "noarch" "linux-64"; do
   done
 done
 
-# If a package does not build for Linux, $f does not exist.
-# Uploads docs for the last treated package
-run_cmd tar xvfj "${f}" docs/${CI_PROJECT_NAME}
-
-for folder in "${DOC_UPLOADS[@]}"; do
-  dav_upload_folder docs/${CI_PROJECT_NAME} "${folder}"
-done
+# if the sphinx folder exists (usually for Linux Python 3.6), upload the docs.
+if [[ -e sphinx ]]; then
+  for folder in "${DOC_UPLOADS[@]}"; do
+    dav_upload_folder sphinx "${folder}"
+  done
+fi
 
 # Deletes all the old packages if in beta
 if [ -z "${CI_COMMIT_TAG}" ]; then #beta
diff --git a/templates/gitlab-ci.yml b/templates/gitlab-ci.yml
index 1d7d79580a93bcb7f30e761e10ef366031d8a66c..36cfa0900a03f92c95bddac8b0b7ed2c017999cf 100644
--- a/templates/gitlab-ci.yml
+++ b/templates/gitlab-ci.yml
@@ -89,6 +89,7 @@ build_linux_36:
     paths:
       - _ci/
       - dist/*.zip
+      - sphinx
       - ${CONDA_ENVS_PATH}/linux-64/*.tar.bz2
 
 build_macosx_27:
diff --git a/templates/meta.yaml b/templates/meta.yaml
index d01b688339a23bfe0dcf6e36e54b3d04a20a4121..a1ddf214268a8a9f05f8a8be282ecf0741f044dc 100644
--- a/templates/meta.yaml
+++ b/templates/meta.yaml
@@ -5,6 +5,7 @@ package:
   version: {{ environ.get('BOB_PACKAGE_VERSION', '0.0.1') }}
 
 build:
+  <ENTRY_POINTS>
   number: {{ environ.get('BOB_BUILD_NUMBER', 0) }}
   script:
     - cd {{ environ.get('CI_PROJECT_DIR', environ.get('RECIPE_DIR') + '/..') }}
@@ -12,42 +13,35 @@ build:
     - python setup.py sdist --formats=zip
     {% endif %}
     - pip install .
-    - sphinx-build -W doc $PREFIX/docs/{{ name }}
 
 requirements:
   build:
     - python
     - setuptools
     - toolchain {{ toolchain }}
-    - sphinx
-    - sphinx_rtd_theme
-    # place extra build dependencies below this line:
-    - <BUILD_DEPS>
+    <BUILD_DEPS>
   run:
     - python
     - setuptools
-    # place runtime dependencies below this line:
-    - <RUN_DEPS>
-
+    <RUN_DEPS>
 
 test:
   imports:
     - {{ name }}
-
   commands:
-    - nosetests --with-coverage -sv {{ name }}
-    # The doctests will run only if "CI_PROJECT_DIR" is available as an
+    <ENTRY_POINTS_TEST>
+    - nosetests --with-coverage --cover-package={{ name }} -sv {{ name }}
+    # The sphinx commands will run only if "CI_PROJECT_DIR" is available as an
     # environment variable. If you are testing locally, you can set it to the
     # root of your project.
-    - sphinx-build -b doctest {{ environ.get('CI_PROJECT_DIR') }}/doc sphinx
-
+    - sphinx-build -W {{ environ.get('CI_PROJECT_DIR') }}/doc {{ environ.get('CI_PROJECT_DIR') }}/sphinx
+    - sphinx-build -b doctest {{ environ.get('CI_PROJECT_DIR') }}/doc sphinx-test
   requires:
     - nose
     - coverage
     - sphinx
     - sphinx_rtd_theme
-    # place extra test requirements below this line:
-    - <TEST_DEPS>
+    <TEST_DEPS>
 
 about:
   home: https://www.idiap.ch/software/bob/