SFTtech / openage

Free (as in freedom) open source clone of the Age of Empires II engine 🚀
http://openage.dev
Other
12.65k stars 1.12k forks source link

Dropping invalid python interpreter pythontex, but trying to use it anyway #565

Closed niklasf closed 8 years ago

niklasf commented 8 years ago

Trying to build on Debian Stretch:

$ ./configure
 _________________________________________
/ ./configure is a convenience script: it \
| creates the build directory, symlinks   |
| it, and invokes cmake for an            |
| out-of-source build.                    |
|                                         |
| Nobody is stopping you from skipping    |
| ./configure and our Makefile, and using |
| CMake directly (e.g. when packaging, or |
| using an IDE). For your convenience,    |
| ./configure even prints the direct      |
\ CMake invocation!                       /
 -----------------------------------------
        \   ^__^
         \  (oo)\_______
            (__)\       )\/\
                ||----w |
                ||     ||

         build_type | Debug
       cxx_compiler | g++
          cxx_flags | 
   exe_linker_flags | 
     install_prefix | /usr/local
module_linker_flags | 
shared_linker_flags | 

config options:

          backtrace | if_available
gperftools-profiler | if_available
gperftools-tcmalloc | False
            inotify | if_available

bindir:
/home/niklas/Projekte/openage/.bin/g++-debug-Oauto-sanitize-none/

invocation:
cmake -DCMAKE_BUILD_TYPE=Debug -DCMAKE_CXX_FLAGS='' -DCMAKE_EXE_LINKER_FLAGS='' -DCMAKE_INSTALL_PREFIX=/usr/local -DCMAKE_MODULE_LINKER_FLAGS='' -DCMAKE_SHARED_LINKER_FLAGS='' -DCXX_OPTIMIZATION_LEVEL=auto -DCXX_SANITIZE_FATAL=False -DCXX_SANITIZE_MODE=none -DWANT_BACKTRACE=if_available -DWANT_GPERFTOOLS_PROFILER=if_available -DWANT_GPERFTOOLS_TCMALLOC=False -DWANT_INOTIFY=if_available -- /home/niklas/Projekte/openage

(running cmake...)

 ___  ______ _______ _______ ___
|  _)/ _____|_______|_______|_  |
| | ( (____  _____      _     | |    ___  ____  _____ ____  _____  ____ _____
| |  \____ \|  ___)    | |    | |   / _ \|  _ \| ___ |  _ \(____ |/ _  | ___ |
| |_ _____) ) |        | |   _| |  | |_| | |_| | ____| | | / ___ ( (_| | ____|
|___|______/|_|        |_|  (___|   \___/|  __/|_____)_| |_\_____|\___ |_____)
                                         |_|                     (_____|

Welcome to the SFT technologies computer-aided openage build system!

You have chosen, or been chosen, to attempt the daring task of building openage.
If you have installed all the dependencies that are conveniently listed in
[doc/building.md], this _might_ just work!

If it doesn't, consider reporting the issue/asking for help in #sfttech on freenode.net.

usage: pythontex.py [-h] [--version] [--encoding ENCODING]
                    [--error-exit-code {true,false}] [--runall [{true,false}]
                    | --rerun {never,modified,errors,warnings,always}]
                    [--hashdependencies [{true,false}]] [-j N] [-v]
                    [--interpreter INTERPRETER]
                    [--debug [<family>:<session>:<restart>] | --interactive
                    [<family>:<session>:<restart>]]
                    TEXNAME
pythontex.py: error: unrecognized arguments: -c
CMake Warning at buildsystem/modules/FindPython.cmake:128 (message):
  Dropping invalid python interpreter
  '/usr/share/texlive/texmf-dist/scripts/pythontex/pythontex.py'
Call Stack (most recent call first):
  buildsystem/HandlePythonOptions.cmake:6 (find_package)
  CMakeLists.txt:70 (include)

usage: pythontex3.py [-h] [--version] [--encoding ENCODING]
                     [--error-exit-code {true,false}] [--runall [{true,false}]
                     | --rerun {never,modified,errors,warnings,always}]
                     [--hashdependencies [{true,false}]] [-j N] [-v]
                     [--interpreter INTERPRETER]
                     [--debug [<family>:<session>:<restart>] | --interactive
                     [<family>:<session>:<restart>]]
                     TEXNAME
pythontex3.py: error: unrecognized arguments: -c
CMake Warning at buildsystem/modules/FindPython.cmake:128 (message):
  Dropping invalid python interpreter '/usr/bin/pythontex3'
Call Stack (most recent call first):
  buildsystem/HandlePythonOptions.cmake:6 (find_package)
  CMakeLists.txt:70 (include)

usage: pythontex.py [-h] [--version] [--encoding ENCODING]
                    [--error-exit-code {true,false}] [--runall [{true,false}]
                    | --rerun {never,modified,errors,warnings,always}]
                    [--hashdependencies [{true,false}]] [-j N] [-v]
                    [--interpreter INTERPRETER]
                    [--debug [<family>:<session>:<restart>] | --interactive
                    [<family>:<session>:<restart>]]
                    TEXNAME
pythontex.py: error: unrecognized arguments: -c
CMake Error at buildsystem/modules/FindPython.cmake:29 (message):
  failed:

  /usr/share/texlive/texmf-dist/scripts/pythontex/pythontex.py -c 'from
  distutils.sysconfig import get_config_var;
  print(get_config_var('INCLUDEPY'))'

Call Stack (most recent call first):
  buildsystem/modules/FindPython.cmake:39 (py_exec)
  buildsystem/modules/FindPython.cmake:138 (py_get_config_var)
  buildsystem/HandlePythonOptions.cmake:6 (find_package)
  CMakeLists.txt:70 (include)

-- Configuring incomplete, errors occurred!
See also "/home/niklas/Projekte/openage/.bin/g++-debug-Oauto-sanitize-none/CMakeFiles/CMakeOutput.log".
TheJJ commented 8 years ago

Can you test my #566 please? It should fix it, at least on my machine it now drops invalid interpreters.

niklasf commented 8 years ago

Cool. This results in the following:

./configure 
 _________________________________________
/ ./configure is a convenience script: it \
| creates the build directory, symlinks   |
| it, and invokes cmake for an            |
| out-of-source build.                    |
|                                         |
| Nobody is stopping you from skipping    |
| ./configure and our Makefile, and using |
| CMake directly (e.g. when packaging, or |
| using an IDE). For your convenience,    |
| ./configure even prints the direct      |
\ CMake invocation!                       /
 -----------------------------------------
        \   ^__^
         \  (oo)\_______
            (__)\       )\/\
                ||----w |
                ||     ||

         build_type | Debug
       cxx_compiler | g++
          cxx_flags | 
   exe_linker_flags | 
     install_prefix | /usr/local
module_linker_flags | 
shared_linker_flags | 

config options:

          backtrace | if_available
gperftools-profiler | if_available
gperftools-tcmalloc | False
            inotify | if_available

bindir:
/home/niklas/Projekte/openage/.bin/g++-debug-Oauto-sanitize-none/

invocation:
cmake -DCMAKE_BUILD_TYPE=Debug -DCMAKE_CXX_FLAGS='' -DCMAKE_EXE_LINKER_FLAGS='' -DCMAKE_INSTALL_PREFIX=/usr/local -DCMAKE_MODULE_LINKER_FLAGS='' -DCMAKE_SHARED_LINKER_FLAGS='' -DCXX_OPTIMIZATION_LEVEL=auto -DCXX_SANITIZE_FATAL=False -DCXX_SANITIZE_MODE=none -DWANT_BACKTRACE=if_available -DWANT_GPERFTOOLS_PROFILER=if_available -DWANT_GPERFTOOLS_TCMALLOC=False -DWANT_INOTIFY=if_available -- /home/niklas/Projekte/openage

(running cmake...)

 ___  ______ _______ _______ ___
|  _)/ _____|_______|_______|_  |
| | ( (____  _____      _     | |    ___  ____  _____ ____  _____  ____ _____
| |  \____ \|  ___)    | |    | |   / _ \|  _ \| ___ |  _ \(____ |/ _  | ___ |
| |_ _____) ) |        | |   _| |  | |_| | |_| | ____| | | / ___ ( (_| | ____|
|___|______/|_|        |_|  (___|   \___/|  __/|_____)_| |_\_____|\___ |_____)
                                         |_|                     (_____|

Welcome to the SFT technologies computer-aided openage build system!

You have chosen, or been chosen, to attempt the daring task of building openage.
If you have installed all the dependencies that are conveniently listed in
[doc/building.md], this _might_ just work!

If it doesn't, consider reporting the issue/asking for help in #sfttech on freenode.net.

CMake Warning at buildsystem/modules/FindPython.cmake:135 (message):
  Dropping invalid python interpreter '/usr/bin/python3.4'
Call Stack (most recent call first):
  buildsystem/HandlePythonOptions.cmake:6 (find_package)
  CMakeLists.txt:70 (include)

usage: pythontex.py [-h] [--version] [--encoding ENCODING]
                    [--error-exit-code {true,false}] [--runall [{true,false}]
                    | --rerun {never,modified,errors,warnings,always}]
                    [--hashdependencies [{true,false}]] [-j N] [-v]
                    [--interpreter INTERPRETER]
                    [--debug [<family>:<session>:<restart>] | --interactive
                    [<family>:<session>:<restart>]]
                    TEXNAME
pythontex.py: error: unrecognized arguments: -c
CMake Warning at buildsystem/modules/FindPython.cmake:135 (message):
  Dropping invalid python interpreter
  '/usr/share/texlive/texmf-dist/scripts/pythontex/pythontex.py'
Call Stack (most recent call first):
  buildsystem/HandlePythonOptions.cmake:6 (find_package)
  CMakeLists.txt:70 (include)

usage: pythontex3.py [-h] [--version] [--encoding ENCODING]
                     [--error-exit-code {true,false}] [--runall [{true,false}]
                     | --rerun {never,modified,errors,warnings,always}]
                     [--hashdependencies [{true,false}]] [-j N] [-v]
                     [--interpreter INTERPRETER]
                     [--debug [<family>:<session>:<restart>] | --interactive
                     [<family>:<session>:<restart>]]
                     TEXNAME
pythontex3.py: error: unrecognized arguments: -c
CMake Warning at buildsystem/modules/FindPython.cmake:135 (message):
  Dropping invalid python interpreter '/usr/bin/pythontex3'
Call Stack (most recent call first):
  buildsystem/HandlePythonOptions.cmake:6 (find_package)
  CMakeLists.txt:70 (include)

-- Looking for suitable python3 - Success: /usr/bin/python2.7
-- Found Python: /usr/bin/python2.7 (Required is at least version "3.4") 
Traceback (most recent call last):
  File "<string>", line 1, in <module>
ImportError: No module named cython
CMake Error at buildsystem/modules/FindPython.cmake:36 (message):
  failed:

  /usr/bin/python2.7 -c 'import cython; print(cython.__version__)'

Call Stack (most recent call first):
  buildsystem/modules/FindCython.cmake:14 (py_exec)
  buildsystem/HandlePythonOptions.cmake:7 (find_package)
  CMakeLists.txt:70 (include)

-- Configuring incomplete, errors occurred!
See also "/home/niklas/Projekte/openage/.bin/g++-debug-Oauto-sanitize-none/CMakeFiles/CMakeOutput.log".

Looks to me like dropping works now, but it still selects the wrong version (python2.7) even though I also have Python 3 installed:

$ which python3
/usr/bin/python3
$ /usr/bin/python3 --version
Python 3.5.1+
TheJJ commented 8 years ago

looks good, except:

comeoooon it works on my machine...

mind fiddling with my branch? (look at the diff to see where the issues were)

niklasf commented 8 years ago

I don't even have a /usr/bin/python3.4, only /usr/bin/python2.7 and /usr/bin/python3.5. It works when applying this hack to your patch (to drop 2.7).

diff --git a/buildsystem/modules/FindPython.cmake b/buildsystem/modules/FindPython.cmake
index 9c94699..78313ab 100644
--- a/buildsystem/modules/FindPython.cmake
+++ b/buildsystem/modules/FindPython.cmake
@@ -127,7 +127,7 @@ list(REMOVE_DUPLICATES PYTHON_INTERPRETERS)
 foreach(INTERPRETER ${PYTHON_INTERPRETERS})
        set(PY_OUTPUT_TEST "rofl, lol")
        execute_process(COMMAND
-               "${INTERPRETER}" -c "print('${PY_OUTPUT_TEST}'); exit(42)"
+               "${INTERPRETER}" -c "print('${PY_OUTPUT_TEST}'); import sys; exit(42 if sys.version_info >= (3, 4) else 0)"
                OUTPUT_VARIABLE TEST_OUTPUT
                RESULT_VARIABLE TEST_RETVAL
        )
TheJJ commented 8 years ago

can you try again please?

niklasf commented 8 years ago

Thanks. Works as expected.

$ ./configure 
 _________________________________________
/ ./configure is a convenience script: it \
| creates the build directory, symlinks   |
| it, and invokes cmake for an            |
| out-of-source build.                    |
|                                         |
| Nobody is stopping you from skipping    |
| ./configure and our Makefile, and using |
| CMake directly (e.g. when packaging, or |
| using an IDE). For your convenience,    |
| ./configure even prints the direct      |
\ CMake invocation!                       /
 -----------------------------------------
        \   ^__^
         \  (oo)\_______
            (__)\       )\/\
                ||----w |
                ||     ||

         build_type | Debug
       cxx_compiler | g++
          cxx_flags | 
   exe_linker_flags | 
     install_prefix | /usr/local
module_linker_flags | 
shared_linker_flags | 

config options:

          backtrace | if_available
gperftools-profiler | if_available
gperftools-tcmalloc | False
            inotify | if_available

bindir:
/home/niklas/Projekte/openage/.bin/g++-debug-Oauto-sanitize-none/

invocation:
cmake -DCMAKE_BUILD_TYPE=Debug -DCMAKE_CXX_FLAGS='' -DCMAKE_EXE_LINKER_FLAGS='' -DCMAKE_INSTALL_PREFIX=/usr/local -DCMAKE_MODULE_LINKER_FLAGS='' -DCMAKE_SHARED_LINKER_FLAGS='' -DCXX_OPTIMIZATION_LEVEL=auto -DCXX_SANITIZE_FATAL=False -DCXX_SANITIZE_MODE=none -DWANT_BACKTRACE=if_available -DWANT_GPERFTOOLS_PROFILER=if_available -DWANT_GPERFTOOLS_TCMALLOC=False -DWANT_INOTIFY=if_available -- /home/niklas/Projekte/openage

(running cmake...)

 ___  ______ _______ _______ ___
|  _)/ _____|_______|_______|_  |
| | ( (____  _____      _     | |    ___  ____  _____ ____  _____  ____ _____
| |  \____ \|  ___)    | |    | |   / _ \|  _ \| ___ |  _ \(____ |/ _  | ___ |
| |_ _____) ) |        | |   _| |  | |_| | |_| | ____| | | / ___ ( (_| | ____|
|___|______/|_|        |_|  (___|   \___/|  __/|_____)_| |_\_____|\___ |_____)
                                         |_|                     (_____|

Welcome to the SFT technologies computer-aided openage build system!

You have chosen, or been chosen, to attempt the daring task of building openage.
If you have installed all the dependencies that are conveniently listed in
[doc/building.md], this _might_ just work!

If it doesn't, consider reporting the issue/asking for help in #sfttech on freenode.net.

usage: pythontex.py [-h] [--version] [--encoding ENCODING]
                    [--error-exit-code {true,false}] [--runall [{true,false}]
                    | --rerun {never,modified,errors,warnings,always}]
                    [--hashdependencies [{true,false}]] [-j N] [-v]
                    [--interpreter INTERPRETER]
                    [--debug [<family>:<session>:<restart>] | --interactive
                    [<family>:<session>:<restart>]]
                    TEXNAME
pythontex.py: error: unrecognized arguments: -c
CMake Warning at buildsystem/modules/FindPython.cmake:137 (message):
  Dropping invalid python interpreter
  '/usr/share/texlive/texmf-dist/scripts/pythontex/pythontex.py'
Call Stack (most recent call first):
  buildsystem/HandlePythonOptions.cmake:6 (find_package)
  CMakeLists.txt:70 (include)

usage: pythontex3.py [-h] [--version] [--encoding ENCODING]
                     [--error-exit-code {true,false}] [--runall [{true,false}]
                     | --rerun {never,modified,errors,warnings,always}]
                     [--hashdependencies [{true,false}]] [-j N] [-v]
                     [--interpreter INTERPRETER]
                     [--debug [<family>:<session>:<restart>] | --interactive
                     [<family>:<session>:<restart>]]
                     TEXNAME
pythontex3.py: error: unrecognized arguments: -c
CMake Warning at buildsystem/modules/FindPython.cmake:137 (message):
  Dropping invalid python interpreter '/usr/bin/pythontex3'
Call Stack (most recent call first):
  buildsystem/HandlePythonOptions.cmake:6 (find_package)
  CMakeLists.txt:70 (include)

-- Looking for suitable Python >=3.4 - Success: /usr/bin/python3.5
-- Checking python3 module PIL.Image - Success
-- Checking python3 module PIL.ImageDraw - Success
-- Checking python3 module numpy - Success
-- Checking python3 module pygments - Success
-- Checking utility program opusenc - Success
CMake Warning at buildsystem/doxygen.cmake:17 (message):
  graphviz dot couldn't be found, you won't have cool graphs in the docs.
Call Stack (most recent call first):
  buildsystem/doxygen.cmake:54 (doxygen_init)
  CMakeLists.txt:82 (include)

cpp library
    libopenage                                          [210 sources] [15 generated]
-- Could NOT find GCCBacktrace (missing:  GCCBacktrace_LIBRARY GCCBacktrace_INCLUDE_DIR) 
unavailable: backtrace
-- Could NOT find Gperftools (missing:  GPERFTOOLS_LIBRARIES GPERFTOOLS_INCLUDE_DIR) 
unavailable: gperftools-profiler

cython module
    run                                                 [embedded interpreter] [noinstall]
    openage.cabextract.lzxd
    openage.cabextract.cabchecksum                      [standalone]
    openage.convert.slp
    openage.cppinterface.exctranslate
    openage.cppinterface.exctranslate_tests
    openage.cppinterface.pyobject
    openage.cppinterface.setup_checker
    openage.cvar.cvar
    openage.game.main_cpp
    openage.log.log_cpp
    openage.util.fslike.cpp
    openage.testing.cpp_testing
    openage.testing.misc_cpp

enabled options:
    inotify

disabled options:
    backtrace
    gperftools-profiler
    gperftools-tcmalloc

openage v0.3.0-412-g272ca89

         compiler | GNU 5.3.1
       build type | Debug
         cxxflags |  -Wall -Wextra -pedantic -std=c++14 -fdiagnostics-color=auto -Wsuggest-override
 build type flags | -g -Og
        build dir | /home/niklas/Projekte/openage/.bin/g++-debug-Oauto-sanitize-none
   install prefix | /usr/local
py install prefix | /usr/local/lib/python3.5/dist-packages

-- Configuring done
-- Generating done
-- Build files have been written to: /home/niklas/Projekte/openage/.bin/g++-debug-Oauto-sanitize-none