diff --git a/dev-lang/ghc/ghc-9.0.2-r4.ebuild b/dev-lang/ghc/ghc-9.0.2-r4.ebuild index 140c6cdfed30e..b05739eb215f7 100644 --- a/dev-lang/ghc/ghc-9.0.2-r4.ebuild +++ b/dev-lang/ghc/ghc-9.0.2-r4.ebuild @@ -161,19 +161,28 @@ RDEPEND+="binary? ( ${PREBUILT_BINARY_RDEPENDS} )" DEPEND="${RDEPEND}" BDEPEND=" virtual/pkgconfig - doc? ( app-text/docbook-xml-dtd:4.2 + doc? ( + $(python_gen_any_dep ' + dev-python/sphinx[${PYTHON_USEDEP}] + dev-python/sphinx-rtd-theme[${PYTHON_USEDEP}] + ') + app-text/docbook-xml-dtd:4.2 app-text/docbook-xml-dtd:4.5 app-text/docbook-xsl-stylesheets - dev-python/sphinx - dev-python/sphinx-rtd-theme - >=dev-libs/libxslt-1.1.2 ) - !ghcbootstrap? ( ${PREBUILT_BINARY_DEPENDS} ) - test? ( ${PYTHON_DEPS} ) + >=dev-libs/libxslt-1.1.2 + ) + !ghcbootstrap? ( + ${PREBUILT_BINARY_DEPENDS} + ) + test? ( + ${PYTHON_DEPS} + ) " needs_python() { # test driver is written in python use test && return 0 + use doc && return 0 return 1 } @@ -187,6 +196,13 @@ REQUIRED_USE=" # haskell libraries built with cabal in configure mode, #515354 QA_CONFIGURE_OPTIONS+=" --with-compiler --with-gcc" +python_check_deps() { + if use doc; then + python_has_version "dev-python/sphinx[${PYTHON_USEDEP}]" && + python_has_version "dev-python/sphinx-rtd-theme[${PYTHON_USEDEP}]" + fi +} + is_crosscompile() { [[ ${CHOST} != ${CTARGET} ]] } diff --git a/dev-lang/ghc/ghc-9.2.8.ebuild b/dev-lang/ghc/ghc-9.2.8.ebuild index b6e51fdcdfe84..d6fbae0833998 100644 --- a/dev-lang/ghc/ghc-9.2.8.ebuild +++ b/dev-lang/ghc/ghc-9.2.8.ebuild @@ -170,19 +170,28 @@ RDEPEND+="binary? ( ${PREBUILT_BINARY_RDEPENDS} )" DEPEND="${RDEPEND}" BDEPEND=" virtual/pkgconfig - doc? ( app-text/docbook-xml-dtd:4.2 + doc? ( + $(python_gen_any_dep ' + dev-python/sphinx[${PYTHON_USEDEP}] + dev-python/sphinx-rtd-theme[${PYTHON_USEDEP}] + ') + app-text/docbook-xml-dtd:4.2 app-text/docbook-xml-dtd:4.5 app-text/docbook-xsl-stylesheets - dev-python/sphinx - dev-python/sphinx-rtd-theme - >=dev-libs/libxslt-1.1.2 ) - !ghcbootstrap? ( ${PREBUILT_BINARY_DEPENDS} ) - test? ( ${PYTHON_DEPS} ) + >=dev-libs/libxslt-1.1.2 + ) + !ghcbootstrap? ( + ${PREBUILT_BINARY_DEPENDS} + ) + test? ( + ${PYTHON_DEPS} + ) " needs_python() { # test driver is written in python use test && return 0 + use doc && return 0 return 1 } @@ -196,6 +205,13 @@ REQUIRED_USE=" # haskell libraries built with cabal in configure mode, #515354 QA_CONFIGURE_OPTIONS+=" --with-compiler --with-gcc" +python_check_deps() { + if use doc; then + python_has_version "dev-python/sphinx[${PYTHON_USEDEP}]" && + python_has_version "dev-python/sphinx-rtd-theme[${PYTHON_USEDEP}]" + fi +} + is_crosscompile() { [[ ${CHOST} != ${CTARGET} ]] } @@ -653,13 +669,13 @@ src_prepare() { # However, the patch is difficult to apply and our versions of GHC don't # have the update, so we symlink to the system version instead. if use doc; then - local rtd_theme_dir="$(dirname $(python -c "import sphinx_rtd_theme; print(sphinx_rtd_theme.__file__)"))" + local python_str="import sphinx_rtd_theme; print(sphinx_rtd_theme.__file__)" + local rtd_theme_dir="$(dirname $("${EPYTHON}" -c "$python_str"))" local orig_rtd_theme_dir="${S}/docs/users_guide/rtd-theme" - ebegin "Replacing bundled rtd-theme with dev-python/sphinx-rtd-theme" + einfo "Replacing bundled rtd-theme with dev-python/sphinx-rtd-theme" rm -r "${orig_rtd_theme_dir}" || die ln -s "${rtd_theme_dir}" "${orig_rtd_theme_dir}" || die - eend 0 fi # mingw32 target