From 45f2dd4bd928385933b0ac1b33aad52f3360c7ae Mon Sep 17 00:00:00 2001
From: Alain Takoudjou <alain.takoudjou@nexedi.com>
Date: Tue, 26 May 2020 13:55:22 +0200
Subject: [PATCH] gitlab-sr: uses venv to install python4-gitlab

---
 software/gitlab/software.cfg | 16 ++++------------
 1 file changed, 4 insertions(+), 12 deletions(-)

diff --git a/software/gitlab/software.cfg b/software/gitlab/software.cfg
index 986d97699..dc7add4fe 100644
--- a/software/gitlab/software.cfg
+++ b/software/gitlab/software.cfg
@@ -84,19 +84,12 @@ recipe = plone.recipe.command
 location = ${buildout:parts-directory}/${:_buildout_section_name_}
 bin = ${:location}/bin
 eggs =
-  docutils
+  docutils==0.16
 python-path = ${:location}/lib/python${python3:version}/site-packages
 command =
-  ${python3:location}/bin/pip3 install ${:eggs} --prefix=${:location}
-  mkdir -p ${:bin}
-  cat <<EOF > ${:location}/bin/python3
-    #!/bin/sh
-    export PATH=${python3:location}/bin:\$PATH
-    export PYTHONPATH=${:python-path}
-
-    exec python3 "\$@"
-  EOF
-  chmod 700 ${:location}/bin/python3
+  PATH=${git:location}/bin/:$PATH  bash -c "${python3:executable} -m venv ${:location} && \
+  . ${:location}/bin/activate && \
+  pip install ${:eggs}"
 stop-on-error = true
 
 # rubygemsrecipe with fixed url and this way pinned rubygems version
@@ -133,7 +126,6 @@ bundle1.17.3 = ${buildout:parts-directory}/${:_buildout_section_name_}/lib/ruby/
 #   gitlab.yml, but there are not all cases like this, e.g. in
 #   https://gitlab.com/gitlab-org/gitlab_git/blob/2f0d3c1a/lib/gitlab_git/repository.rb#L259 )
 # gitlab (via github-markup) wants to convert rst -> html via running: python3 (with docutils egg)
-# ======>  (python-4gitlab puts interpreter into ${buildout:bin-directory})
 environment =
 
   PATH    = ${python-4gitlab:bin}:${yarn:location}/bin:${:ruby-location}/bin:${cmake:location}/bin:${pkgconfig:location}/bin:${nodejs-8.12.0:location}/bin:${postgresql10:location}/bin:${redis28:location}/bin:${git:location}/bin:${buildout:bin-directory}:%(PATH)s
-- 
2.30.9