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

Carnë Draug carandraug+dev at gmail.com
Sun Feb 28 07:32:28 EST 2016


On 28 February 2016 at 03:24, Bill Deegan <bill at baddogconsulting.com> wrote:
> Also I see you filed a bug.

The original bug from this email was already existed.  I commented on that
bug which was open in 2008:

    http://scons.tigris.org/issues/show_bug.cgi?id=2225

I did report a new bug which is related to scons displaying one command
but actually be running another one:

    http://scons.tigris.org/issues/show_bug.cgi?id=3023

> We ask that users bring bugs to the users mailing list and only file bugs if
> we've determined that it is a bug, and also that it's not a duplicate.
> (this is to a) make that problems get more eyes (here on the users mailing
> list), and b) try to minimize the noise in the bug tracking system and keep
> the signal high.. )

If the developers are following both the mailing list and the bug tracker
(which I guess they are since they're filtering bugs from the first), then
they'll be affected by the same noise.

Actually, it will cause more work for everyone because: 1) it needs to be
reported on the mailing list first, filtered, and then reported on bug
tracker again; and 2) the discussion will be fragmented making it harder
to later find all the discussion related to it.

There would be more tickets on the tracker, so you'd get more hits when
searching.  But you're using a quite powerful bug tracker.  You can easily
search for bugs that are not "invalid", "wontfix", "duplicate", and
"worksforme".

That's just my experience.  Still, your project, your rules.  I won't do
it again.

> I don't believe any of the developers have yet requested that you file a
> bug.
>
> If you take a look at the manpage there are several items which will
> probably help you resolve your issue:
> ( http://scons.org/doc/production/HTML/scons-man.html )
> SPAWN
>
> A command interpreter function that will be called to execute command line
> strings. The function must expect the following arguments:
>
> def spawn(shell, escape, cmd, args, env):
>
> sh is a string naming the shell program to use. escape is a function that
> can be called to escape shell special characters in the command line. cmd is
> the path to the command to be executed. args is the arguments to the
> command. env is a dictionary of the environment variables in which the
> command should be executed.
>
> ESCAPE
>
> A function that will be called to escape shell special characters in command
> lines. The function should take one argument: the command line string to
> escape; and should return the escaped command line.
>
>
> SHELL
>
> A string naming the shell program that will be passed to the $SPAWN
> function. See the $SPAWN construction variable for more information.
>
> I"m guessing changing env['ESCAPE'] to point to a function which properly
> handles escaping your parens in the path (that's a new one for me) and/or
> changing SHELL or SPAWN should be the simplest way to resolve this.

That's still not working.  I'm not sure exactly what but I believe it has to
do with extra quotes (it's hard to figure out exactly what is going on because
the displayed commands work fine).  I have replaced ESCAPE with str() so
that nothing is escaped.  Still:

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

    env = Environment()
    env['ESCAPE'] = str

    env.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"
    sh: 1: Syntax error: "(" unexpected
    scons: *** [foo (bar) qux] Error 2
    scons: building terminated because of errors.

But that command is a perfectly valid command.  No idea what is happening:

    $ python -c "import sys; print sys.argv" "foo (bar) qux"
    ['-c', 'foo (bar) qux']


> Any reason in particular you want to have parens in your file names/paths?

What?  Why do I need a reason?  It's a perfectly valid filename.  And
unfortunately, it's a 4 years old choice that can't be changed now.

Carnë


More information about the Scons-users mailing list