Uploaded image for project: 'Qt for Python'
  1. Qt for Python
  2. PYSIDE-233

Build breaks with -DPYTHON_EXECUTABLE

    XMLWordPrintable

Details

    • Bug
    • Resolution: Cannot Reproduce
    • Not Evaluated
    • None
    • 1.2.x
    • PySide, Shiboken
    • None
    • * Qt 4.8.5
      * Python 2.6.4
      * GCC 4.1.2 (used to build both of the above)
      * CMake 2.8.12
      * Fedora 19

    Description

      The current CMake builds for Shiboken, PySide, and pyside-tools all fail when passed an explicit Python interpreter due to syntax errors in the CMakeLists.txt and the bundled FindPythonInterp* CMake modules.

      The problem is caused by calls to Python -c similar to this (take from FindPythonInterpWithDebug.cmake in the Shiboken repo):

      execute_process(
          COMMAND ${PYTHON_EXECUTABLE} -c "from distutils import sysconfig; \\
              print(sysconfig.get_python_lib(1,0,prefix='${CMAKE_INSTALL_PREFIX}'))"
          OUTPUT_VARIABLE PYTHON_SITE_PACKAGES
          OUTPUT_STRIP_TRAILING_WHITESPACE)
      

      When the -DPYTHON_EXECUTABLE flag is passed to CMake during configuration, it results in errors similar to the following:

        File "<string>", line 1
          from distutils import sysconfig; \
                                            ^
      SyntaxError: unexpected character after line continuation character
      CMake Error at CMakeLists.txt:43 (message):
        Could not detect Python module installation directory.
      
      
      -- Configuring incomplete, errors occurred!
      

      I believe this is because CMake does not support splitting of strings across multiple lines. Ensuring that the Python command string is continuous fixes the problem. For example:

      execute_process(
          COMMAND ${PYTHON_EXECUTABLE} -c
              "from distutils import sysconfig; print(sysconfig.get_python_lib(1,0,prefix='${CMAKE_INSTALL_PREFIX}'))"
          OUTPUT_VARIABLE PYTHON_SITE_PACKAGES
          OUTPUT_STRIP_TRAILING_WHITESPACE)
      

      Attachments

        No reviews matched the request. Check your Options in the drop-down menu of this sections header.

        Activity

          People

            rlacko Roman Lacko
            nrusch Nathan Rusch
            Votes:
            2 Vote for this issue
            Watchers:
            6 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Gerrit Reviews

                There are no open Gerrit changes