From eefa51bc154c0a2c4c5a06d62704233943299de8 Mon Sep 17 00:00:00 2001
From: Andre Anjos <andre.anjos@idiap.ch>
Date: Tue, 27 Jun 2017 10:19:50 +0200
Subject: [PATCH] Allow private packages to be properly tagged and depend on
 other stable documentation

---
 gitlab/deploy.sh    |  8 +++++---
 gitlab/functions.sh | 10 +++++++---
 2 files changed, 12 insertions(+), 6 deletions(-)

diff --git a/gitlab/deploy.sh b/gitlab/deploy.sh
index cc1cfb5..d7c131c 100755
--- a/gitlab/deploy.sh
+++ b/gitlab/deploy.sh
@@ -3,6 +3,11 @@
 
 source $(dirname ${0})/functions.sh
 
+# upload documentation on our internal server
+run_cmd $(dirname ${0})/before_docs.sh
+run_cmd $(dirname ${0})/docs.sh
+run_cmd $(dirname ${0})/after_docs.sh
+
 if [ "${VISIBILITY}" != "public" ]; then
   log_error "ERROR: You cannot publish a PRIVATE to PyPI"
   log_error "ERROR: Make this package public before re-trying!"
@@ -23,9 +28,6 @@ setup_deploy check sdist --formats zip upload --repository production
 if [ -d sphinx ]; then
   log_info "Uploading documentation to ${PYPISERVER} on behalf of ${PYPIUSER}..."
   setup_deploy upload_docs --upload-dir sphinx --repository production
-  run_cmd $(dirname ${0})/before_docs.sh
-  run_cmd $(dirname ${0})/docs.sh
-  run_cmd $(dirname ${0})/after_docs.sh
 fi
 
 unlock_pypirc
diff --git a/gitlab/functions.sh b/gitlab/functions.sh
index 157c373..83ca826 100644
--- a/gitlab/functions.sh
+++ b/gitlab/functions.sh
@@ -421,9 +421,9 @@ export_env BOB_PREFIX_PATH
 
 # Setup default documentation server
 if [ -z "${CI_COMMIT_TAG}" ]; then
-  DEFSRV="${DOCSERVER}/software/bob/docs/bob/%s/master/"
+  DEFSRV="${DOCSERVER}/software/bob/docs/bob/%(name)s/master/"
 else
-  DEFSRV="${DOCSERVER}/software/bob/docs/bob/%s/stable/|http://pythonhosted.org/%s/"
+  DEFSRV="${DOCSERVER}/software/bob/docs/bob/%(name)s/%(version)s/|${DOCSERVER}/software/bob/docs/bob/%(name)s/stable/|http://pythonhosted.org/%(name)s/"
 fi
 if [ -z "${BOB_DOCUMENTATION_SERVER}" ]; then
   BOB_DOCUMENTATION_SERVER="${DEFSRV}"
@@ -432,7 +432,11 @@ else
 fi
 if [ "${VISIBILITY}" != "public" ]; then
   # If private or internal, allow it to depend on other internal documents
-  BOB_DOCUMENTATION_SERVER="${BOB_DOCUMENTATION_SERVER}|${DOCSERVER}/private/docs/bob/%s/master/"
+  if [ -z "${CI_COMMIT_TAG}" ]; then
+    BOB_DOCUMENTATION_SERVER="${BOB_DOCUMENTATION_SERVER}|${DOCSERVER}/private/docs/bob/%(name)s/master/"
+  else
+    BOB_DOCUMENTATION_SERVER="${BOB_DOCUMENTATION_SERVER}|${DOCSERVER}/private/docs/bob/%(name)s/%(version)s/|${DOCSERVER}/private/docs/bob/%(name)s/stable/"
+  fi
 fi
 unset DEFSRV
 export_env BOB_DOCUMENTATION_SERVER
-- 
GitLab