Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[WIP] Sphinx fix #919

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open

[WIP] Sphinx fix #919

wants to merge 2 commits into from

Conversation

arfoll
Copy link
Contributor

@arfoll arfoll commented Aug 23, 2018

My Sphinx version finding fix is not very nice, if you have a nicer one @b49020 then I'm perfectly willing to take it.

This should fix #911

arfoll added 2 commits August 23, 2018 22:46
Newer Sphinx versions do not output 'Sphinx (sphinx-build) x.x.x' but only
'sphinx-build x.x.x'. This is a pretty simplistic solution, maybe someone can
find a better FindSphinx.cmake module entirely.

Signed-off-by: Brendan Le Foll <[email protected]>
Previously we used SWIG_MODULE_<name>_REAL_NAME to have the doc interfaces
depend on. However that target is preceeded by the SWIG generation in our case
gen_python2-mraa_mraa2PYTHON_wrap. Typically this is hidden because a parralel
build has so many other deps this can be hidden but this is the correct path.

Fixes eclipse#911

Signed-off-by: Brendan Le Foll <[email protected]>
@b49020
Copy link

b49020 commented Aug 24, 2018

@arfoll Thanks for these patches. But I am facing following cmake configuration errors after applying this patch:

CMake Error at src/python/python2/CMakeLists.txt:21 (add_dependencies):
  Cannot add target-level dependencies to non-existent target
  "gen_python2-mraa_mraa2PYTHON_wrap".

  The add_dependencies works for top-level logical targets created by the
  add_executable, add_library, or add_custom_target commands.  If you want to
  add file-level dependencies see the DEPENDS option of the add_custom_target
  and add_custom_command commands.

Not sure regarding above error.

sphinx-build 1.7.6
CMake Error at cmake/modules/FindSphinx.cmake:24 (string):
  string sub-command REPLACE requires at least four arguments.
Call Stack (most recent call first):
  src/python/python2/docs/CMakeLists.txt:2 (find_package)

-- Sphinx version is 
CMake Error at src/python/python2/docs/CMakeLists.txt:41 (message):
  ERROR - Failed to find a compatible version of Sphinx.  Python API doc will
  not be generated

In case of FindSphinx.cmake patch, I think for latest sphinx version output of COMMAND ${SPHINX_EXECUTABLE} --version is stored in ERROR_VARIABLE rather than OUTPUT_VARIABLE. So I have tried to add this fix in your patch as follows:

diff --git a/cmake/modules/FindSphinx.cmake b/cmake/modules/FindSphinx.cmake
index 528b107..e3fd499 100644
--- a/cmake/modules/FindSphinx.cmake
+++ b/cmake/modules/FindSphinx.cmake
@@ -15,12 +15,16 @@ find_package_handle_standard_args (Sphinx DEFAULT_MSG
 if (SPHINX_EXECUTABLE)
     execute_process(COMMAND ${SPHINX_EXECUTABLE} --version
                     OUTPUT_VARIABLE SPHINX_VERSION_STRING
+                    ERROR_VARIABLE SPHINX_VERSION_STRING_NEW
                     OUTPUT_STRIP_TRAILING_WHITESPACE
                     ERROR_STRIP_TRAILING_WHITESPACE)
-    if (SPHINX_VERSION_STRING)
+    if (SPHINX_VERSION_STRING MATCHES "^Sphinx")
         string(REPLACE "Sphinx (sphinx-build) " "" SPHINX_VERSION ${SPHINX_VERSION_STRING})
-        message (STATUS "Sphinx version is ${SPHINX_VERSION}")
+    else ()
+        # newer sphinx builds just say sphinx-build
+       string(REPLACE "sphinx-build " "" SPHINX_VERSION ${SPHINX_VERSION_STRING_NEW})
     endif ()
+    message (STATUS "Sphinx version is ${SPHINX_VERSION}")
 
 mark_as_advanced (SPHINX_EXECUTABLE)

@arfoll
Copy link
Contributor Author

arfoll commented Aug 24, 2018

@b49020 the sphinx fix makes sense that's an easy one. You can put ERROR_VARIALE and OUTPUT_VARIABLE in the same string afaik and it'll work.

However the target name is super weird, what is the equivalent target called for you? Just do a make help after configuring and paste the output?

@arfoll arfoll changed the title Sphinx fix [WIP] Sphinx fix Aug 24, 2018
@b49020
Copy link

b49020 commented Aug 24, 2018

root@linaro-developer:~/mraa/build# make help
The following are some of the valid targets for this Makefile:
... all (the default if no target is provided)
... clean
... depend
... install/local
... test
... list_install_components
... install/strip
... doc
... install
... edit_cache
... rebuild_cache
... mraa
... spiclass_doc_i
... i2cdoc_i
... i2cclass_doc_i
... aioclass_doc_i
... pwmdoc_i
... uartclass_doc_i
... pwmclass_doc_i
... leddoc_i
... ledclass_doc_i
... commondoc_i
... common_hpp_doc_i
... aiodoc_i
... gpiodoc_i
... spidoc_i
... gpioclass_doc_i
... uartdoc_i
... python2-mraa_swig_compilation
... _python2-mraa
... sphinx
... gpio_advanced
... uart_advanced
... aio
... pwm
... i2c_hmc5883l
... iio
... hellomraa
... spi
... gpio
... uart
... led
... uart_ow
... i2c_mpu6050
... up2-leds
... gpio_edison
... i2c_cpp
... pwm_cpp
... gpio_advanced_cpp
... aio_cpp
... spi_cpp
... gpio_cpp
... uart_cpp
... led_cpp
... iio_cpp
... uart_ow_cpp
... mraa-gpio
... mraa-uart
... mraa-i2c

@arfoll
Copy link
Contributor Author

arfoll commented Aug 27, 2018

Uhm so your job name is python2-mraa_swig_compilation so that's why it doesn't work. I have no idea what makes these job names - more investigation is required!

@arfoll
Copy link
Contributor Author

arfoll commented Aug 28, 2018

maybe this needs to depend on https://github.com/Kitware/CMake/blob/master/Modules/UseSWIG.cmake#L172 ?

@Propanu
Copy link
Contributor

Propanu commented Sep 4, 2018

Maybe take a look at how this was done for UPM too, sounds like a similar target dependency issue. The commits are around the v1.6 tag.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Problem building MRAA python docs using latest python-sphinx v1.7.6 package
3 participants