>It's also possible to do it the other around using shlex.split. I prefer that
>version because
>I can easily copy/paste the command from code to the shell, it's also more
>readable IMO:
> cmd = """python3 -O -c "import sys; print(sys.argv[1:])" foo bar "spam egg"
> """
> print(cmd)
> subproc
On Mon Feb 16 2015 at 7:40:42 PM Peter Otten <__pete...@web.de> wrote:
> David Aldrich wrote:
>
> > Hi Peter
> >
> > Thanks very much for your reply. I have added one more question below.
> >
> >> The straightforward approach is to pass a list or tuple:
> >>
> >> def build(build_options=()):
> >>
David Aldrich wrote:
> Hi Peter
>
> Thanks very much for your reply. I have added one more question below.
>
>> The straightforward approach is to pass a list or tuple:
>>
>> def build(build_options=()):
>> subprocess_check_call(("make",) + build_options)
>>
>> build(("flagA=true", "flagB=
On 2015-02-16 17:07, David Aldrich wrote:
Hi Peter
Thanks very much for your reply. I have added one more question below.
The straightforward approach is to pass a list or tuple:
def build(build_options=()):
subprocess_check_call(("make",) + build_options)
build(("flagA=true", "flagB=tru
Hi Peter
Thanks very much for your reply. I have added one more question below.
> The straightforward approach is to pass a list or tuple:
>
> def build(build_options=()):
> subprocess_check_call(("make",) + build_options)
>
> build(("flagA=true", "flagB=true"))
This looks fine - I am tryi
David Aldrich wrote:
> Hi
>
> I wonder if someone could help me with this problem please. I am writing
> a Python script that builds and tests a C++ program on Linux. The build
> options depend on the test, so I have encapsulated the 'make' call in a
> Python function:
>
> def build(build_opti
Hi
I wonder if someone could help me with this problem please. I am writing a
Python script that builds and tests a C++ program on Linux. The build options
depend on the test, so I have encapsulated the 'make' call in a Python function:
def build(build_options=''):
if len(build_option