Skip to content

Question about escaping spaces in filenames in Cython dependencies file #15227

@lesteve

Description

@lesteve

tl;dr

It seems like Cython dependencies file should escape the spaces in paths, otherwise ninja keeps building files.

I'd like to make sure my understanding is correct before potentially opening a PR in Cython to fix the behaviour.

It seems like I found at least a similar thing in rust-bindgen rust-lang/rust-bindgen#2503.

More details

I noticed this when working on #15219.

In meson root folder execute the following (which I think is what the tests are doing):

meson setup --wipe my-build test\ cases/cython/2\ generated\ sources 
ninja -C my-build

This builds as expected.

The suprising thing is that rerunning ninja rebuilds some already built files, see -d explain output below (you can tell that there are issues related to spaces):

❯ ninja -C my-build -d explain
ninja: Entering directory `my-build'
ninja explain: ../test is dirty
ninja explain: cases/cython/2 is dirty
ninja explain: generated is dirty
ninja explain: sources/simpleinclude.pyx is dirty
ninja explain: sources/simplestuff.pxi is dirty
[0/3] Compiling Cython source '/home/lesteve/dev/meson/test cases/cython/2 generated sources/simpleinclude.pyx'
ninja explain: ../test is dirty
ninja explain: cases/cython/2 is dirty
ninja explain: generated is dirty
ninja explain: sources/simpleinclude.pyx is dirty
ninja explain: sources/simplestuff.pxi is dirty
[1/3] Compiling Cython source '/home/lesteve/dev/meson/test cases/cython/2 generated sources/simpleinclude.pyx'
ninja explain: simpleinclude.cpython-314t-x86_64-linux-gnu.so.p/simpleinclude.pyx.c is dirty
ninja explain: simpleinclude.cpython-314t-x86_64-linux-gnu.so.p/simpleinclude.pyx.c is dirty
[1/3] Compiling C object simpleinclude.cpython-314t-x86_64-linux-gnu.so.p/meson-generated_simpleinclude.pyx.c.o
ninja explain: simpleinclude.cpython-314t-x86_64-linux-gnu.so.p/simpleinclude.pyx.c is dirty
ninja explain: simpleinclude.cpython-314t-x86_64-linux-gnu.so.p/simpleinclude.pyx.c is dirty
[2/3] Compiling C object simpleinclude.cpython-314t-x86_64-linux-gnu.so.p/meson-generated_simpleinclude.pyx.c.o
ninja explain: simpleinclude.cpython-314t-x86_64-linux-gnu.so.p/meson-generated_simpleinclude.pyx.c.o is dirty
[2/3] Linking target simpleinclude.cpython-314t-x86_64-linux-gnu.so
ninja explain: simpleinclude.cpython-314t-x86_64-linux-gnu.so.p/meson-generated_simpleinclude.pyx.c.o is dirty
[3/3] Linking target simpleinclude.cpython-314t-x86_64-linux-gnu.so

One of the dependency file has spaces in paths:

cat my-build/simpleinclude.cpython-314t-x86_64-linux-gnu.so.p/simpleinclude.pyx.c.dep
simpleinclude.cpython-314t-x86_64-linux-gnu.so.p/simpleinclude.pyx.c: \
  ../test cases/cython/2 generated sources/simpleinclude.pyx \
  ../test cases/cython/2 generated sources/simplestuff.pxi

If I edit manually the file to espace spaces with \, I get the expected behaviour ninja: no work to do.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions