]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
install-deps.sh: always use python3-sphinx to build the docs 35770/head
authorKefu Chai <kchai@redhat.com>
Thu, 25 Jun 2020 11:54:55 +0000 (19:54 +0800)
committerKefu Chai <kchai@redhat.com>
Thu, 25 Jun 2020 11:59:41 +0000 (19:59 +0800)
python-sphinx creates a symlink pointing ../share/sphinx/scripts/python2/sphinx-build
to /usr/bin/sphinx-build even if python3-sphinx is already installed.
in that case, if python-sphinx is installed after python3-sphinx,
sphinx-build is in python2. and it breaks the build of master, as we are
using python3 syntax in conf.py since
e9e17b9ceff0c862c8f29d629ad54a1dc401ed73.

and we are still using python2 as well as "python-sphinx" when building nautilus,
so if a build slave happen to compile nautilus before it is scheduled to
build master or a wip- branch, the doc build fails.

in this change, python-sphinx is uninstalled, if /usr/bin/sphinx-build
is found to be written in python2.

Signed-off-by: Kefu Chai <kchai@redhat.com>
install-deps.sh

index 6dc37314eda04190a3753621bce0a0b9d8a3accf..f48c5472a9dac6d0862d0f29f3fa5d007b1ad79f 100755 (executable)
@@ -124,6 +124,16 @@ ENDOFKEY
     $SUDO ln -nsf /usr/bin/g++ /usr/bin/${ARCH}-linux-gnu-g++
 }
 
+function ensure_python3_sphinx_on_ubuntu {
+    local sphinx_command=/usr/bin/sphinx-build
+    # python-sphinx points $sphinx_command to
+    # ../share/sphinx/scripts/python2/sphinx-build when it's installed
+    # let's "correct" this
+    if test -e $sphinx_command  && head -n1 $sphinx_command | grep -q python$; then
+        $SUDO env DEBIAN_FRONTEND=noninteractive apt-get -y remove python-sphinx
+    fi
+}
+
 function install_pkg_on_ubuntu {
     local project=$1
     shift
@@ -263,6 +273,7 @@ else
         echo "Using apt-get to install dependencies"
         $SUDO apt-get install -y devscripts equivs
         $SUDO apt-get install -y dpkg-dev
+        ensure_python3_sphinx_on_ubuntu
         case "$VERSION" in
             *Bionic*)
                 ensure_decent_gcc_on_ubuntu 9 bionic