Message from discussion
Any way to prepend/append a string to each item of a list variable?
Received: by 10.58.187.168 with SMTP id ft8mr2615224vec.7.1349463501280;
Fri, 05 Oct 2012 11:58:21 -0700 (PDT)
X-BeenThere: gyp-developer@googlegroups.com
Received: by 10.220.148.143 with SMTP id p15ls3475195vcv.9.gmail; Fri, 05 Oct
2012 11:58:20 -0700 (PDT)
Received: by 10.58.12.6 with SMTP id u6mr1368909veb.0.1349463500796;
Fri, 05 Oct 2012 11:58:20 -0700 (PDT)
Received: by 10.58.12.6 with SMTP id u6mr1368908veb.0.1349463500757;
Fri, 05 Oct 2012 11:58:20 -0700 (PDT)
Return-Path: <bore...@google.com>
Received: from mail-vb0-f51.google.com (mail-vb0-f51.google.com [209.85.212.51])
by gmr-mx.google.com with ESMTPS id ef10si652300vdb.3.2012.10.05.11.58.20
(version=TLSv1/SSLv3 cipher=OTHER);
Fri, 05 Oct 2012 11:58:20 -0700 (PDT)
Received-SPF: pass (google.com: domain of bore...@google.com designates 209.85.212.51 as permitted sender) client-ip=209.85.212.51;
Authentication-Results: gmr-mx.google.com; spf=pass (google.com: domain of bore...@google.com designates 209.85.212.51 as permitted sender) smtp.mail=bore...@google.com; dkim=pass header...@google.com
Received: by mail-vb0-f51.google.com with SMTP id fn1so2096049vbb.10
for <gyp-developer@googlegroups.com>; Fri, 05 Oct 2012 11:58:20 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
d=google.com; s=20120113;
h=mime-version:in-reply-to:references:date:message-id:subject:from:to
:cc:content-type:x-system-of-record;
bh=qtGVykXa+aWlxGaENiTca5qpQTaVyRfjOT/9dbOp90w=;
b=GsJyj1a7lU9kJ8PChO/8xVAhUSHGCizkNRCoOTetPV09tLQEMMdgzKHwAvjPiDyNBf
jn0PCWTq3m2mLO2DIy6RbEV9Fy60Jf/MjIJ95QGv2QrtpV5aiArbIrX6WlwNUPJBSNET
eo6o1R6bhBpxc6aj6kDU+4DDl4sraFkhYkKzehTD2Gv+YqFLbdMn1kJW6kBHnpwevRZm
o8Oye/MhgkNPef/u6QU5xm1Kx9VpEiDaOSxSpwgKd2N+GvV9QkHkDsa3cL6AnkKsb2MB
FXwfcbUIBoSIqffolgsGca6QCuD8Vpn7xSHT5OUc2GZvia31JCZoTqZkJbpK+qzxHVJN
OLTg==
d=google.com; s=20120113;
h=mime-version:in-reply-to:references:date:message-id:subject:from:to
:cc:content-type:x-system-of-record:x-gm-message-state;
bh=qtGVykXa+aWlxGaENiTca5qpQTaVyRfjOT/9dbOp90w=;
b=n1h4jJUYFg7jCtuhVb4gWqsbZkdYLEYjIG7vzvmANe7VE/Up/GznOMYy61zxUtNYWS
aeiKHMEa26h205O49hq0l0QrgG45dN+WxJmRSE2FBIMN++leWdNasUXZg9sA1pd51XBn
JEIHQaS9G4nW6W3000ibqkLNutAC1cY7mQEcxeYj55/5/kUJKPYm7eHQLOpYHycK6ruW
cZ6LigPc22W1MWipLHAZT7U7eYsQ3c+2rZNrAvtwRipb6eiqXRVBZGA+emyY8xWKunoz
K3RjhfvcGmtSD5HdRiPeK6G8kdHV8Xu++RYhy0u9lzCHLa34h60ZH5ZsCoRtsdJGxMz+
d4yQ==
MIME-Version: 1.0
Received: by 10.52.175.35 with SMTP id bx3mr4680350vdc.4.1349463500266; Fri,
05 Oct 2012 11:58:20 -0700 (PDT)
Received: by 10.59.11.9 with HTTP; Fri, 5 Oct 2012 11:58:20 -0700 (PDT)
In-Reply-To: <CAHk1GDzsgGB4aQUQ60V5noQHZfsF8wffeq=da-3aq7pc23q...@mail.gmail.com>
References: <5ada8a04-8043-45a0-8545-33f4bd9ec420@googlegroups.com>
<CANAQWOUFhy7aXHfg=NiMpaitGW_NmsAfuc48=ETV2iiNEkx...@mail.gmail.com>
<CACvaWvbrotLpfnpdHsJCanKzs8Xyex=ko2zg686DHKMsWQf...@mail.gmail.com>
<CAHk1GDzsgGB4aQUQ60V5noQHZfsF8wffeq=da-3aq7pc23q...@mail.gmail.com>
Date: Fri, 5 Oct 2012 14:58:20 -0400
Message-ID: <CA+pR4LW_Hh6RAEMd=ZpA7Kgai9mFtaPfwuq_EWReQFdH0ds...@mail.gmail.com>
Subject: Re: [gyp-developer] Any way to prepend/append a string to each item
of a list variable?
From: Eric Boren <bore...@google.com>
To: Mark Mentovai <m...@chromium.org>
Cc: Ryan Sleevi <rsle...@chromium.org>, Marc-Antoine Ruel <mar...@chromium.org>,
gyp-developer <gyp-developer@googlegroups.com>
Content-Type: multipart/alternative; boundary=bcaec51a7a86921e3b04cb54747b
X-System-Of-Record: true
X-Gm-Message-State: ALoCoQntKiEMIIiJc/aDr6d4Lg8vmqaLNO09KLWgHZpm4SG1ARahJ/ZqIeTnEN10Z84eZxKUb8EYzjZ1AQV28oItfVHnWMg8yO1jXysTzgGCGrjr+EqFtgTrt0/Y37zCPXlY9yDX/sUKATNehcJ4wvl39TuUss4lolHvpL1ykc3TTD/epXvJRrjFCn2PV8878M9SvLzBUpgAibYT8klhhnQy9JMdJMlpcw==
--bcaec51a7a86921e3b04cb54747b
Content-Type: text/plain; charset=windows-1252
Content-Transfer-Encoding: quoted-printable
Okay. Then is there a way to do what I'm talking about? Basically, I have
a meta-target which has several dependencies in separate files. In my
top-level "all" target, I want to list those same targets (but with a
different path, since that file is in the parent directory), in addition to
the meta-target, so that I can build them all at once with the meta-target
OR build them independently. Right now I have to copy the same list around
several times with slightly different prefixes. It seems like using a list
variable would be the most elegant way to handle it.
On Fri, Oct 5, 2012 at 2:53 PM, Mark Mentovai <m...@chromium.org> wrote:
> It is a bug. It shouldn=92t work. It might trip up gyp --check, and even =
if
> it doesn=92t, it might just stop working in the future.
>
>
> On Fri, Oct 5, 2012 at 2:45 PM, Ryan Sleevi <rsle...@chromium.org> wrote:
>
>> A perhaps off-topic diversion, but are the Pythonic idioms from Eric's
>> example meant to be supported in canonical GYP syntax? I had thought
>> that their ability to be used was more of a "bug" than a "feature",
>> and may be lost at any time, but I wasn't sure if that was a shared
>> feeling.
>>
>> On Fri, Oct 5, 2012 at 11:39 AM, Marc-Antoine Ruel <mar...@chromium.org>
>> wrote:
>> > Create a meta-target in somefile.gyp that depends on a, b, c, d with
>> 'type':
>> > 'none'.
>> >
>> > Then in the other file depend only on the meta-target.
>> >
>> > M-A
>> >
>> >
>> > 2012/10/5 Eric Boren <bore...@google.com>
>> >>
>> >> I have something like this:
>> >> 'variables': {
>> >> 'my_awesome_list': [
>> >> 'a',
>> >> 'b',
>> >> 'c',
>> >> 'd',
>> >> ],
>> >> },
>> >>
>> >> And I want to use it elsewhere like this:
>> >> ......
>> >> 'dependencies': [
>> >> 'somefile.gyp:<@(my_awesome_list)',
>> >> ],
>> >> ......
>> >>
>> >> Which does not work. I've tried doing this with a list comprehension=
:
>> >> ......
>> >> 'dependencies': ['somefile.gyp:%s' % item for item in
>> >> '<@(my_awesome_list)'.split(' ')],
>> >> ......
>> >>
>> >> But that evaluates to:
>> >> 'dependencies': [
>> >> 'somefile.gyp:a b c d',
>> >> ],
>> >>
>> >> If I change it to:
>> >> ......
>> >> 'dependencies': ['%s' % item for item in '<@(my_awesome_list)'.split(=
'
>> >> ')],
>> >> ......
>> >>
>> >> It evaluates to:
>> >> 'dependencies': [
>> >> 'a',
>> >> 'b',
>> >> 'c',
>> >> 'd',
>> >> ],
>> >>
>> >> As I would expect. Why does the above case not work? Is there anoth=
er
>> >> way to do this?
>> >>
>> >> Thanks,
>> >>
>> >> Eric
>> >>
>> >> --
>> >>
>> >>
>> >>
>> >
>> >
>> > --
>> >
>> >
>> >
>>
>
>
--bcaec51a7a86921e3b04cb54747b
Content-Type: text/html; charset=windows-1252
Content-Transfer-Encoding: quoted-printable
Okay. =A0Then is there a way to do what I'm talking about? =A0Basically=
, I have a meta-target which has several dependencies in separate files. =
=A0In my top-level "all" target, I want to list those same target=
s (but with a different path, since that file is in the parent directory), =
in addition to the meta-target, so that I can build them all at once with t=
he meta-target OR build them independently. =A0Right now I have to copy the=
same list around several times with slightly different prefixes. =A0It see=
ms like using a list variable would be the most elegant way to handle it.<d=
iv class=3D"gmail_extra">
<br><br><div class=3D"gmail_quote">On Fri, Oct 5, 2012 at 2:53 PM, Mark Men=
tovai <span dir=3D"ltr"><<a href=3D"mailto:m...@chromium.org" target=3D"=
_blank">m...@chromium.org</a>></span> wrote:<br><blockquote class=3D"gma=
il_quote" style=3D"margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-lef=
t:1ex">
It is a bug. It shouldn=92t work. It might trip up gyp --check, and even if=
it doesn=92t, it might just stop working in the future.<div class=3D"HOEnZ=
b"><div class=3D"h5"><div class=3D"gmail_extra"><br><br><div class=3D"gmail=
_quote">
On Fri, Oct 5, 2012 at 2:45 PM, Ryan Sleevi <span dir=3D"ltr"><<a href=
=3D"mailto:rsle...@chromium.org" target=3D"_blank">rsle...@chromium.org</a>=
></span> wrote:<br>
<blockquote class=3D"gmail_quote" style=3D"margin:0 0 0 .8ex;border-left:1p=
x #ccc solid;padding-left:1ex">A perhaps off-topic diversion, but are the P=
ythonic idioms from Eric's<br>
example meant to be supported in canonical GYP syntax? I had thought<br>
that their ability to be used was more of a "bug" than a "fe=
ature",<br>
and may be lost at any time, but I wasn't sure if that was a shared<br>
feeling.<br>
<div><div><br>
On Fri, Oct 5, 2012 at 11:39 AM, Marc-Antoine Ruel <<a href=3D"mailto:ma=
r...@chromium.org" target=3D"_blank">mar...@chromium.org</a>> wrote:<br>
> Create a meta-target in somefile.gyp that depends on a, b, c, d with &=
#39;type':<br>
> 'none'.<br>
><br>
> Then in the other file depend only on the meta-target.<br>
><br>
> M-A<br>
><br>
><br>
> 2012/10/5 Eric Boren <<a href=3D"mailto:bore...@google.com" target=
=3D"_blank">bore...@google.com</a>><br>
>><br>
>> I have something like this:<br>
>> 'variables': {<br>
>> =A0 'my_awesome_list': [<br>
>> =A0 =A0 'a',<br>
>> =A0 =A0 'b',<br>
>> =A0 =A0 'c',<br>
>> =A0 =A0 'd',<br>
>> =A0 ],<br>
>> },<br>
>><br>
>> And I want to use it elsewhere like this:<br>
>> ......<br>
>> 'dependencies': [<br>
>> =A0 'somefile.gyp:<@(my_awesome_list)',<br>
>> ],<br>
>> ......<br>
>><br>
>> Which does not work. =A0I've tried doing this with a list comp=
rehension:<br>
>> ......<br>
>> 'dependencies': ['somefile.gyp:%s' % item for item=
in<br>
>> '<@(my_awesome_list)'.split(' ')],<br>
>> ......<br>
>><br>
>> But that evaluates to:<br>
>> 'dependencies': [<br>
>> =A0 'somefile.gyp:a b c d',<br>
>> ],<br>
>><br>
>> If I change it to:<br>
>> ......<br>
>> 'dependencies': ['%s' % item for item in '<=
@(my_awesome_list)'.split('<br>
>> ')],<br>
>> ......<br>
>><br>
>> It evaluates to:<br>
>> 'dependencies': [<br>
>> =A0 'a',<br>
>> =A0 'b',<br>
>> =A0 'c',<br>
>> =A0 'd',<br>
>> ],<br>
>><br>
>> As I would expect. =A0Why does the above case not work? =A0Is ther=
e another<br>
>> way to do this?<br>
>><br>
>> Thanks,<br>
>><br>
>> Eric<br>
>><br>
>> --<br>
>><br>
>><br>
>><br>
><br>
><br>
> --<br>
><br>
><br>
><br>
</div></div></blockquote></div><br></div>
</div></div></blockquote></div><br></div>
--bcaec51a7a86921e3b04cb54747b--