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
avoid escaping spaces #265
Merged
Merged
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
spaces in CYTHON_FLAGS are incorrectly escaped (at least on linux) when provided as command line arguments to the cython executable through CMake cache entries. Here is a simple mwe (run `$ bash build.sh` in a terminal) **build.sh** ```bash #!/usr/bin/env bash rm -r build; mkdir -p build; cd build cmake \ -DCYTHON_FLAGS='-X boundscheck=False -X wraparound=False' \ -DCMAKE_MODULE_PATH="$SKBUILD_PREFIX/skbuild/resources/cmake" \ -DCMAKE_VERBOSE_MAKEFILE=ON .. make || exit 1 python3 -c 'import fib; fib.fib(2000)' ``` **CMakeLists.txt** ```CMake cmake_minimum_required(VERSION 3.8) project(fib) find_package(Cython REQUIRED) include(UseCython) include_directories(${PYTHON_INCLUDE_DIRS}) add_cython_target(fib fib.pyx C PY3) add_library(fib MODULE fib.c) set_target_properties(fib PROPERTIES PREFIX "") ``` **fib.pyx** ```python def fib(n): """Print the Fibonacci series up to n.""" a, b = 0, 1 while b < n: print(b) a, b = b, a + b ``` without this patch, build.sh fails with the following output ```bash <...> cython --include-dir <...>/include/python3.6m -3 -X\ boundscheck=False\ -X\ wraparound=False <...>/fib.pyx --output-file <...>/build/fib.c Error in compiler directive: boundscheck directive must be set to True or False, got 'False -X wraparound=False' <...> make[2]: *** [CMakeFiles/fib.dir/build.make:65: fib.c] Error 1 make[2]: Leaving directory <...>/build' ```
thewtex
approved these changes
Nov 17, 2017
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@neok-m4700 Thanks for the contribution! 👏
Well done on the patch and description of the issue 🥇
CI errors are unrelated. |
These should now be fixed in #266 |
jcfr
added a commit
that referenced
this pull request
Nov 20, 2017
CHANGE: Add entry documenting fix for #265
jcfr
pushed a commit
to scikit-build/cython-cmake
that referenced
this pull request
Jan 25, 2024
spaces in CYTHON_FLAGS are incorrectly escaped (at least on linux) when provided as command line arguments to the cython executable through CMake cache entries. Here is a simple mwe (run `$ bash build.sh` in a terminal) **build.sh** ```bash rm -r build; mkdir -p build; cd build cmake \ -DCYTHON_FLAGS='-X boundscheck=False -X wraparound=False' \ -DCMAKE_MODULE_PATH="$SKBUILD_PREFIX/skbuild/resources/cmake" \ -DCMAKE_VERBOSE_MAKEFILE=ON .. make || exit 1 python3 -c 'import fib; fib.fib(2000)' ``` **CMakeLists.txt** ```CMake cmake_minimum_required(VERSION 3.8) project(fib) find_package(Cython REQUIRED) include(UseCython) include_directories(${PYTHON_INCLUDE_DIRS}) add_cython_target(fib fib.pyx C PY3) add_library(fib MODULE fib.c) set_target_properties(fib PROPERTIES PREFIX "") ``` **fib.pyx** ```python def fib(n): """Print the Fibonacci series up to n.""" a, b = 0, 1 while b < n: print(b) a, b = b, a + b ``` without this patch, build.sh fails with the following output ```bash <...> cython --include-dir <...>/include/python3.6m -3 -X\ boundscheck=False\ -X\ wraparound=False <...>/fib.pyx --output-file <...>/build/fib.c Error in compiler directive: boundscheck directive must be set to True or False, got 'False -X wraparound=False' <...> make[2]: *** [CMakeFiles/fib.dir/build.make:65: fib.c] Error 1 make[2]: Leaving directory <...>/build' ```
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
spaces in CYTHON_FLAGS are incorrectly escaped (at least on linux) when provided as command line arguments to the cython executable through CMake cache entries.
Here is a simple mwe (run
$ bash build.sh
in a terminal)build.sh
CMakeLists.txt
fib.pyx
without this patch, build.sh fails with the following output