[Scons-users] escaping brackets () in file path

Carnë Draug carandraug+dev at gmail.com
Wed Feb 24 19:55:17 EST 2016


On my project I have paths with brackets.  It seems to me that SCons tries
to escape them incorrectly.  In addition, the command that is displayed
is different from what's actually executed.

Please consider:

    $ cat SConstruct
    #!/usr/bin/env python
    # -*- coding: utf-8 -*-
    Command(target='foo (bar) qux', source=None, action='touch $TARGET')

    $ scons
    scons: Reading SConscript files ...
    scons: done reading SConscript files.
    scons: Building targets ...
    touch "foo (bar) qux"
    scons: done building targets.

    $ ls
    foo \(bar\) qux  SConstruct

Note how the generated file has backslashes on the name.  Doesn't look like
it's bash playing up.  I have checked the actual argv passed to programs:

    $ cat SConstruct
    #!/usr/bin/env python
    # -*- coding: utf-8 -*-

    Command(target='foo (bar) qux', source=None, action='python -c
"import sys; print sys.argv" $TARGET')

    $ scons
    scons: Reading SConscript files ...
    scons: done reading SConscript files.
    scons: Building targets ...
    python -c "import sys; print sys.argv" "foo (bar) qux"
    ['-c', 'foo \\(bar\\) qux']
    scons: done building targets.

So is this a bug in SCons or am I missing a detail about how to curate
my own paths?  Should I be handling these paths in some different way?

Thank you,
Carnë


More information about the Scons-users mailing list