Re: Fwd: adding text to compile line
Jeremy Elson <[email protected]> Mon, 9 Feb 2026 12:54:15 -0800
| Newsgroups | gmane.comp.programming.tools.scons.user |
|---|---|
| Message-ID | <CAKufN8W7qqaxJTN_-16vP+OBoLF33umNjiDzKWrSS7FimhYZfQ@mail.gmail.com> |
--===============8589194565428317717== Content-Type: multipart/alternative; boundary="0000000000003aef44064a6a5824" --0000000000003aef44064a6a5824 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable They seem orthogonal to me - Progress() gives feedback during graph traversal, but Spinner prints output during graph execution. Users might want both, but it's a little messy because Spinner is attached to an environment whereas Progress is a global property. If you think it makes sense, though, I could add a couple lines to Spinner's generate() to enable Progress. On Mon, Feb 9, 2026 at 12:37=E2=80=AFPM Bill Deegan <bill@baddogconsulting.= com> wrote: > Thanks! Looks good to me. I'll likely give it a try locally before mergin= g. > I did not Progress() provides some similar functionally, maybe it's worth > enabling that as well when you enable your tool? > So you'd get notice that scons is "thinking" and not building things > already built, in addition to the things building? > > On Mon, Feb 9, 2026 at 11:29=E2=80=AFAM Jeremy Elson <[email protected]> w= rote: > >> Hi, sorry for resurrecting this old thread! >> >> 2 years ago I mentioned on this list (quoted below) that I'd made a >> little 'Spinner' utility for scons, which generates more compact build >> output. >> Bill asked if I could contribute it back to the scons-contrib repo, whic= h >> after a mere 2 year delay I have finally done: >> >> https://github.com/SCons/scons-contrib/pull/54 >> >> Best, >> Jeremy >> >> On Mon, Jan 22, 2024 at 11:38=E2=80=AFPM Jeremy Elson <[email protected]>= wrote: >> >>> Sure! >>> >>> >>> On Sun, Jan 21, 2024 at 6:29=E2=80=AFPM Bill Deegan <bill@baddogconsult= ing.com> >>> wrote: >>> >>>> Jeremy, >>>> >>>> Any chance you could contribute that to the >>>> https://github.com/SCons/scons-contrib repo? >>>> >>>> Pretty interesting. >>>> -Bill >>>> >>>> On Sun, Jan 21, 2024 at 1:40=E2=80=AFPM Jeremy Elson <[email protected]= > wrote: >>>> >>>>> This is a lot more than what OP asked for, but I'll describe the >>>>> custom output code I wrote for one of my Scons-based build systems.(I= t's >>>>> not open-source, so I can't link to the full code.) >>>>> >>>>> My goal was to replace all the raw command-line output with something >>>>> like: >>>>> >>>>> Compiling src/app/foo.c >>>>> Compiling src/app/bar.c >>>>> Linking build/libs/libfoo.a >>>>> Linking build/output/foo.elf >>>>> Signing build/output/foo.elf >>>>> >>>>> In this case, "Compiling" and "Linking" are standard scons rules; >>>>> "Signing" is a custom builder. The trick is that for some of the outp= uts, >>>>> such as Compiling, should show the name of the source. Others, such a= s >>>>> Linking, show the name of the target. >>>>> >>>>> First, I defined a class called SpinnerPrinter that looks sort of lik= e >>>>> this: >>>>> >>>>> class SpinnerPrinter: >>>>> SPINNER =3D '<<spinner>>' >>>>> SOURCE =3D 'src' >>>>> TARGET =3D 'trg' >>>>> >>>>> def spin_source(s): >>>>> return SpinnerPrinter.SPINNER + SpinnerPrinter.SOURCE + s >>>>> >>>>> def spin_target(s): >>>>> return SpinnerPrinter.SPINNER + SpinnerPrinter.TARGET + s >>>>> >>>>> Then, in my function that sets up the scons build env, I have code >>>>> that looks like the examples below. I call spin_source to indicate th= e >>>>> build output should use the source filenames, and spin_target to show= it >>>>> should be target. The COMSTRs all end up being configuration strings = for >>>>> the custom output function. >>>>> >>>>> if not build_options.verbose: >>>>> env['PRINT_CMD_LINE_FUNC'] =3D SpinnerPrinter().spinner_print >>>>> # Overrides to standard builders >>>>> env['CCCOMSTR'] =3D SpinnerPrinter.spin_source("Compiling") >>>>> env['ASPPCOMSTR'] =3D SpinnerPrinter.spin_source("Assembling") >>>>> env['LINKCOMSTR'] =3D SpinnerPrinter.spin_target("Linking") >>>>> env['ARCOMSTR'] =3D SpinnerPrinter.spin_target("Creating library") >>>>> >>>>> # locally defined builders >>>>> env['PROTOBUFCOMSTR'] =3D SpinnerPrinter.spin_source("Creating protob= uf" >>>>> ) >>>>> env['SIGNCOMSTR'] =3D SpinnerPrinter.spin_source("Signing") >>>>> >>>>> The SpinnerPrinter class has a function spinner_print that uses the >>>>> config string to generate the output based on the config >>>>> string generated by spin_source and spin_target: >>>>> >>>>> def spinner_print(self, s, target, source, env): >>>>> # Regular (non-spinner-aware) strings just get emitted as >>>>> # usual >>>>> if not s.startswith(self.SPINNER): >>>>> sys.stdout.write(s + "\n") >>>>> return >>>>> >>>>> # take off the marker >>>>> s =3D s[len(self.SPINNER):] >>>>> >>>>> # figure out if we are supposed to print the source or target >>>>> which =3D s[0:3] >>>>> >>>>> # Generate the prefix (the part printed before the filename). >>>>> print_prefix =3D s[3:] >>>>> # Find out what filename to print as part of the output. We'd >>>>> # rather print the name of the source, but steps such as >>>>> # library creation have a zillion sources and one target, so >>>>> # we'll print the target instead for those. >>>>> if which =3D=3D SpinnerPrinter.SOURCE: >>>>> file_to_print =3D source[0] >>>>> else: >>>>> file_to_print =3D target[0] >>>>> fn_to_print =3D os.path.realpath(str(file_to_print)) >>>>> >>>>> # Combine the directive we were given (e.g. "Compiling") >>>>> # with the filename >>>>> sys.stdout.write(f"{print_prefix} {fn_to_print}\n" >>>>> >>>>> This can be made much fancier; I've elided various details. For >>>>> example, the real spinner senses if stdout is a tty. If it is a tty, = it >>>>> uses ANSI escape sequences so the output lines overwrite themselves, = and it >>>>> prints only the part of the filename that fits on a single terminal l= ine >>>>> (after sensing its width). So when our team builds from the command-l= ine, a >>>>> normal build does not use any terminal space at all! When running fro= m a >>>>> script, the "Compiling" and "Linking" lines all appear as separate li= nes. >>>>> And without the --verbose option, the entire custom output block is s= kipped >>>>> and full command-lines get printed (the default scons behavior). >>>>> >>>>> Hopefully this helps someone! We've been very happy with how it works >>>>> (and with scons in general). >>>>> >>>>> -Jeremy >>>>> >>>>> On Sun, Jan 21, 2024 at 1:07=E2=80=AFPM Bill Deegan <bill@baddogconsu= lting.com> >>>>> wrote: >>>>> >>>>>> Dagg, >>>>>> >>>>>> What Mats said.. with more detail. >>>>>> >>>>>> So if your compiling c++, the relevant variables are >>>>>> CXXCOM, CXXCOMSTR >>>>>> SHCXXCOM, SHCXXCOMSTR >>>>>> >>>>>> The *STR variables are what is output to the screen, the non *STR ar= e >>>>>> what's used to build the command line and execute. >>>>>> replace CXX with CC for C compiles.. >>>>>> You can see the complete list of such variables in the manpage: >>>>>> https://scons.org/doc/production/HTML/scons-man.html >>>>>> >>>>>> Hope this helps~! >>>>>> -=3DBill >>>>>> >>>>>> On Sun, Jan 21, 2024 at 11:07=E2=80=AFAM Mats Wichmann <mats@wichman= n.us> >>>>>> wrote: >>>>>> >>>>>>> On January 21, 2024 5:40:14 AM MST, daggs via Scons-users < >>>>>>> [email protected]> wrote: >>>>>>> >Greetings, >>>>>>> > >>>>>>> >I want to add a prefix the compile line scons is displaying, is it >>>>>>> possible? >>>>>>> > >>>>>>> >Thanks, >>>>>>> > >>>>>>> >Dagg >>>>>>> >_______________________________________________ >>>>>>> >Scons-users mailing list >>>>>>> >[email protected] >>>>>>> >https://pairlist4.pair.net/mailman/listinfo/scons-users >>>>>>> >>>>>>> yes. >>>>>>> >>>>>>> sorry not at a place I can answer more fully, but can modify the >>>>>>> relevant COMSTR (command string), or supply your own $PRINT_CMD_LIN= E_FUNC >>>>>>> -- >>>>>>> Sent from my Android device with K-9 Mail. Please excuse my brevity= . >>>>>>> _______________________________________________ >>>>>>> Scons-users mailing list >>>>>>> [email protected] >>>>>>> https://pairlist4.pair.net/mailman/listinfo/scons-users >>>>>>> >>>>>> _______________________________________________ >>>>>> Scons-users mailing list >>>>>> [email protected] >>>>>> https://pairlist4.pair.net/mailman/listinfo/scons-users >>>>>> >>>>> _______________________________________________ >>>>> Scons-users mailing list >>>>> [email protected] >>>>> https://pairlist4.pair.net/mailman/listinfo/scons-users >>>>> >>>> _______________________________________________ >>>> Scons-users mailing list >>>> [email protected] >>>> https://pairlist4.pair.net/mailman/listinfo/scons-users >>>> >>> _______________________________________________ >> Scons-users mailing list -- [email protected] >> To unsubscribe send an email to [email protected] >> > _______________________________________________ > Scons-users mailing list -- [email protected] > To unsubscribe send an email to [email protected] > --0000000000003aef44064a6a5824 Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable <div dir=3D"ltr">They seem orthogonal to me - Progress() gives feedback dur= ing graph traversal, but Spinner prints output during graph execution. User= s might want both, but it's a little messy because Spinner is attached = to an environment whereas Progress is a global property. If you think it ma= kes sense, though, I could add a couple lines to Spinner's generate() t= o enable Progress.<div><br></div></div><br><div class=3D"gmail_quote gmail_= quote_container"><div dir=3D"ltr" class=3D"gmail_attr">On Mon, Feb 9, 2026 = at 12:37=E2=80=AFPM Bill Deegan <<a href=3D"mailto:bill@baddogconsulting= .com">[email protected]</a>> wrote:<br></div><blockquote class= =3D"gmail_quote" style=3D"margin:0px 0px 0px 0.8ex;border-left:1px solid rg= b(204,204,204);padding-left:1ex"><div dir=3D"ltr"><div>Thanks! Looks good t= o me. I'll likely give it a try locally before merging.</div><div>I did= not Progress() provides some similar functionally, maybe it's worth en= abling that as well when you enable your tool?</div><div>So you'd get n= otice that scons is "thinking" and not building things already bu= ilt, in addition=C2=A0to the things building?</div></div><br><div class=3D"= gmail_quote"><div dir=3D"ltr" class=3D"gmail_attr">On Mon, Feb 9, 2026 at 1= 1:29=E2=80=AFAM Jeremy Elson <<a href=3D"mailto:[email protected]" target= =3D"_blank">[email protected]</a>> wrote:<br></div><blockquote class=3D"g= mail_quote" style=3D"margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204= ,204,204);padding-left:1ex"><div dir=3D"ltr"><div class=3D"gmail_quote"><di= v dir=3D"ltr"><div dir=3D"ltr">Hi, sorry for resurrecting this old thread!= =C2=A0</div><div><br></div>2 years ago I mentioned on this list (quoted bel= ow) that I'd made a little 'Spinner' utility=C2=A0for scons, wh= ich generates more compact build output.<div>Bill asked if I could contribu= te it back to the scons-contrib repo, which after a mere 2 year delay I hav= e finally done:</div><div><br></div><div><a href=3D"https://github.com/SCon= s/scons-contrib/pull/54" target=3D"_blank">https://github.com/SCons/scons-c= ontrib/pull/54</a></div><div><br></div><div>Best,</div><div>Jeremy</div><di= v><div><br><div class=3D"gmail_quote"><div dir=3D"ltr" class=3D"gmail_attr"= >On Mon, Jan 22, 2024 at 11:38=E2=80=AFPM Jeremy Elson <<a href=3D"mailt= o:[email protected]" target=3D"_blank">[email protected]</a>> wrote:<br></= div><blockquote class=3D"gmail_quote" style=3D"margin:0px 0px 0px 0.8ex;bor= der-left:1px solid rgb(204,204,204);padding-left:1ex"><div dir=3D"ltr">Sure= !<div><br></div></div><br><div class=3D"gmail_quote"><div dir=3D"ltr" class= =3D"gmail_attr">On Sun, Jan 21, 2024 at 6:29=E2=80=AFPM Bill Deegan <<a = href=3D"mailto:[email protected]" target=3D"_blank">bill@baddogcons= ulting.com</a>> wrote:<br></div><blockquote class=3D"gmail_quote" style= =3D"margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding= -left:1ex"><div dir=3D"ltr"><div>Jeremy,</div><div><br></div><div>Any chanc= e you could contribute that to the <a href=3D"https://github.com/SCons/scon= s-contrib" target=3D"_blank">https://github.com/SCons/scons-contrib</a> rep= o?</div><div><br></div><div>Pretty interesting.</div><div>-Bill<br></div></= div><br><div class=3D"gmail_quote"><div dir=3D"ltr" class=3D"gmail_attr">On= Sun, Jan 21, 2024 at 1:40=E2=80=AFPM Jeremy Elson <<a href=3D"mailto:je= [email protected]" target=3D"_blank">[email protected]</a>> wrote:<br></div>= <blockquote class=3D"gmail_quote" style=3D"margin:0px 0px 0px 0.8ex;border-= left:1px solid rgb(204,204,204);padding-left:1ex"><div dir=3D"ltr"><div dir= =3D"ltr">This is a lot more than what OP asked for, but I'll describe t= he custom output code I wrote for one of my Scons-based build systems.(It&#= 39;s not open-source, so I can't link to the full code.)</div><div dir= =3D"ltr"><div><div><br>My goal was to replace all the raw command-line outp= ut with something like:</div><div><br></div><div><font face=3D"monospace">C= ompiling src/app/foo.c</font></div><div><font face=3D"monospace">Compiling = src/app/bar.c</font></div><div><font face=3D"monospace">Linking build/libs/= libfoo.a</font></div><div><font face=3D"monospace">Linking build/output/foo= .elf</font></div><div><font face=3D"monospace">Signing build/output/foo.elf= </font></div><div><br></div><div>In this case, "Compiling" and &q= uot;Linking" are standard scons rules; "Signing" is a custom= builder. The trick is that for some of the outputs, such as Compiling, sho= uld show the name of the source. Others, such as Linking, show the name of = the target.</div><div><br></div><div>First, I defined a class called Spinne= rPrinter that looks sort of like this:</div><div><br></div><div><div style= =3D"line-height:18px"><div style=3D"color:rgb(0,0,0);font-family:ui-monospa= ce,SFMono-Medium,"SF Mono","Segoe UI Mono","Roboto= Mono","Ubuntu Mono",Menlo,monospace;font-size:13px;white-sp= ace:pre-wrap;background-color:rgb(255,255,254)"><span style=3D"color:rgb(0,= 73,176);font-weight:bold">class </span><span style=3D"color:rgb(166,36,0);f= ont-weight:bold">SpinnerPrinter</span>:</div><div style=3D"color:rgb(0,0,0)= ;font-family:ui-monospace,SFMono-Medium,"SF Mono","Segoe UI = Mono","Roboto Mono","Ubuntu Mono",Menlo,monospace;= font-size:13px;white-space:pre-wrap;background-color:rgb(255,255,254)"> = <span style=3D"color:rgb(101,84,192)">SPINNER</span> =3D <span style=3D"col= or:rgb(9,101,69)">'<<spinner>>'</span></div><div style= =3D"color:rgb(0,0,0);font-family:ui-monospace,SFMono-Medium,"SF Mono&q= uot;,"Segoe UI Mono","Roboto Mono","Ubuntu Mono&qu= ot;,Menlo,monospace;font-size:13px;white-space:pre-wrap;background-color:rg= b(255,255,254)"> <span style=3D"color:rgb(101,84,192)">SOURCE</span> =3D= <span style=3D"color:rgb(9,101,69)">'src'</span></div><div style= =3D"color:rgb(0,0,0);font-family:ui-monospace,SFMono-Medium,"SF Mono&q= uot;,"Segoe UI Mono","Roboto Mono","Ubuntu Mono&qu= ot;,Menlo,monospace;font-size:13px;white-space:pre-wrap;background-color:rg= b(255,255,254)"> <span style=3D"color:rgb(101,84,192)">TARGET</span> =3D= <span style=3D"color:rgb(9,101,69)">'trg'</span></div><br><div sty= le=3D"color:rgb(0,0,0);font-family:ui-monospace,SFMono-Medium,"SF Mono= ","Segoe UI Mono","Roboto Mono","Ubuntu Mono&= quot;,Menlo,monospace;font-size:13px;white-space:pre-wrap;background-color:= rgb(255,255,254)"> <span style=3D"color:rgb(0,73,176);font-weight:bold">= def </span><span style=3D"color:rgb(191,38,0);font-weight:bold">spin_source= </span>(<span style=3D"color:rgb(32,32,32)">s</span>):<br></div><div style= =3D"color:rgb(0,0,0);font-family:ui-monospace,SFMono-Medium,"SF Mono&q= uot;,"Segoe UI Mono","Roboto Mono","Ubuntu Mono&qu= ot;,Menlo,monospace;font-size:13px;white-space:pre-wrap;background-color:rg= b(255,255,254)"> <span style=3D"color:rgb(9,30,66);font-weight:bold"= >return</span> <span style=3D"color:rgb(32,32,32)">SpinnerPrinter</span>.<s= pan style=3D"color:rgb(101,84,192)">SPINNER</span> + <span style=3D"color:r= gb(32,32,32)">SpinnerPrinter</span>.<span style=3D"color:rgb(101,84,192)">S= OURCE</span> + <span style=3D"color:rgb(32,32,32)">s</span></div><br><div s= tyle=3D"color:rgb(0,0,0);font-family:ui-monospace,SFMono-Medium,"SF Mo= no","Segoe UI Mono","Roboto Mono","Ubuntu Mon= o",Menlo,monospace;font-size:13px;white-space:pre-wrap;background-colo= r:rgb(255,255,254)"> <span style=3D"color:rgb(0,73,176);font-weight:bold= ">def </span><span style=3D"color:rgb(191,38,0);font-weight:bold">spin_targ= et</span>(<span style=3D"color:rgb(32,32,32)">s</span>):</div><div style=3D= "color:rgb(0,0,0);font-family:ui-monospace,SFMono-Medium,"SF Mono"= ;,"Segoe UI Mono","Roboto Mono","Ubuntu Mono"= ,Menlo,monospace;font-size:13px;white-space:pre-wrap;background-color:rgb(2= 55,255,254)"> <span style=3D"color:rgb(9,30,66);font-weight:bold">re= turn</span> <span style=3D"color:rgb(32,32,32)">SpinnerPrinter</span>.<span= style=3D"color:rgb(101,84,192)">SPINNER</span> + <span style=3D"color:rgb(= 32,32,32)">SpinnerPrinter</span>.<span style=3D"color:rgb(101,84,192)">TARG= ET</span> + <span style=3D"color:rgb(32,32,32)">s</span></div><br>Then, in = my function that sets up the scons build env, I have code that looks like t= he examples below. I call spin_source to indicate the build output should u= se the source filenames, and spin_target to show it should be target. The C= OMSTRs all end up being configuration strings for the custom output functio= n.</div></div><div style=3D"line-height:18px"><br></div><div style=3D"line-= height:18px"><div style=3D"color:rgb(0,0,0);background-color:rgb(255,255,25= 4);font-family:ui-monospace,SFMono-Medium,"SF Mono","Segoe U= I Mono","Roboto Mono","Ubuntu Mono",Menlo,monospac= e;font-size:13px;line-height:18px;white-space:pre-wrap"><div> <span styl= e=3D"color:rgb(9,30,66);font-weight:bold">if</span> <span style=3D"color:rg= b(9,30,66);font-weight:bold">not</span> <span style=3D"color:rgb(32,32,32)"= >build_options</span>.<span style=3D"color:rgb(32,32,32)">verbose</span>:</= div><div><div style=3D"line-height:18px"><div> <span style=3D"color:= rgb(32,32,32)">env</span>[<span style=3D"color:rgb(9,101,69)">'PRINT_CM= D_LINE_FUNC'</span>] =3D <span style=3D"color:rgb(32,32,32)">SpinnerPri= nter</span>().<span style=3D"color:rgb(32,32,32)">spinner_print</span></div= ></div> </div><div> <span style=3D"color:rgb(160,160,160);font-style:italic"= ># Overrides to standard builders</span><br></div><div> <span style= =3D"color:rgb(32,32,32)">env</span>[<span style=3D"color:rgb(9,101,69)">= 9;CCCOMSTR'</span>] =3D <span style=3D"color:rgb(32,32,32)">SpinnerPrin= ter</span>.<span style=3D"color:rgb(32,32,32)">spin_source</span>(<span sty= le=3D"color:rgb(9,101,69)">"Compiling"</span>)</div><div> = <span style=3D"color:rgb(32,32,32)">env</span>[<span style=3D"color:rgb(9,1= 01,69)">'ASPPCOMSTR'</span>] =3D <span style=3D"color:rgb(32,32,32)= ">SpinnerPrinter</span>.<span style=3D"color:rgb(32,32,32)">spin_source</sp= an>(<span style=3D"color:rgb(9,101,69)">"Assembling"</span>)<br><= /div><div> <span style=3D"color:rgb(32,32,32)">env</span>[<span styl= e=3D"color:rgb(9,101,69)">'LINKCOMSTR'</span>] =3D <span style=3D"c= olor:rgb(32,32,32)">SpinnerPrinter</span>.<span style=3D"color:rgb(32,32,32= )">spin_target</span>(<span style=3D"color:rgb(9,101,69)">"Linking&quo= t;</span>)</div><div> <span style=3D"color:rgb(32,32,32)">env</span>= [<span style=3D"color:rgb(9,101,69)">'ARCOMSTR'</span>] =3D <span s= tyle=3D"color:rgb(32,32,32)">SpinnerPrinter</span>.<span style=3D"color:rgb= (32,32,32)">spin_target</span>(<span style=3D"color:rgb(9,101,69)">"Cr= eating library"</span>)<br></div><div><br></div><div> <span sty= le=3D"color:rgb(160,160,160);font-style:italic"># locally defined builders<= /span></div><div> <span style=3D"color:rgb(32,32,32)">env</span>[<sp= an style=3D"color:rgb(9,101,69)">'PROTOBUFCOMSTR'</span>] =3D <span= style=3D"color:rgb(32,32,32)">SpinnerPrinter</span>.<span style=3D"color:r= gb(32,32,32)">spin_source</span>(<span style=3D"color:rgb(9,101,69)">"= Creating protobuf"</span>)</div></div></div><div><div style=3D"line-he= ight:18px"><div style=3D"color:rgb(0,0,0);font-family:ui-monospace,SFMono-M= edium,"SF Mono","Segoe UI Mono","Roboto Mono"= ,"Ubuntu Mono",Menlo,monospace;font-size:13px;white-space:pre-wra= p;background-color:rgb(255,255,254)"> <span style=3D"color:rgb(32,32= ,32)">env</span>[<span style=3D"color:rgb(9,101,69)">'SIGNCOMSTR'</= span>] =3D <span style=3D"color:rgb(32,32,32)">SpinnerPrinter</span>.<span = style=3D"color:rgb(32,32,32)">spin_source</span>(<span style=3D"color:rgb(9= ,101,69)">"Signing"</span>)</div><br>The SpinnerPrinter class has= a function <font face=3D"monospace">spinner_print</font> that uses the con= fig string to generate the output based on the config</div></div></div><div= style=3D"line-height:18px">string generated by spin_source and spin_target= :</div><div style=3D"line-height:18px"><br></div></div><div><div style=3D"l= ine-height:18px"><div style=3D"font-family:ui-monospace,SFMono-Medium,"= ;SF Mono","Segoe UI Mono","Roboto Mono","Ubun= tu Mono",Menlo,monospace;font-size:13px;white-space:pre-wrap;backgroun= d-color:rgb(255,255,254);color:rgb(0,0,0)"> <span style=3D"color:rgb(0,7= 3,176);font-weight:bold">def </span><span style=3D"color:rgb(191,38,0);font= -weight:bold">spinner_print</span>(<span style=3D"color:rgb(9,30,66);font-w= eight:bold">self</span>, <span style=3D"color:rgb(32,32,32)">s</span>, <spa= n style=3D"color:rgb(32,32,32)">target</span>, <span style=3D"color:rgb(32,= 32,32)">source</span>, <span style=3D"color:rgb(32,32,32)">env</span>):</di= v><div style=3D"font-family:ui-monospace,SFMono-Medium,"SF Mono",= "Segoe UI Mono","Roboto Mono","Ubuntu Mono",M= enlo,monospace;font-size:13px;white-space:pre-wrap;background-color:rgb(255= ,255,254);color:rgb(0,0,0)"> <span style=3D"color:rgb(160,160,160);f= ont-style:italic"># Regular (non-spinner-aware) strings just get emitted as= </span></div><div style=3D"font-family:ui-monospace,SFMono-Medium,"SF = Mono","Segoe UI Mono","Roboto Mono","Ubuntu M= ono",Menlo,monospace;font-size:13px;white-space:pre-wrap;background-co= lor:rgb(255,255,254);color:rgb(0,0,0)"> <span style=3D"color:rgb(160= ,160,160);font-style:italic"># usual</span></div><div style=3D"font-family:= ui-monospace,SFMono-Medium,"SF Mono","Segoe UI Mono",&q= uot;Roboto Mono","Ubuntu Mono",Menlo,monospace;font-size:13p= x;white-space:pre-wrap;background-color:rgb(255,255,254);color:rgb(0,0,0)">= <span style=3D"color:rgb(9,30,66);font-weight:bold">if</span> <span= style=3D"color:rgb(9,30,66);font-weight:bold">not</span> <span style=3D"co= lor:rgb(32,32,32)">s</span>.<span style=3D"color:rgb(32,32,32)">startswith<= /span>(<span style=3D"color:rgb(9,30,66);font-weight:bold">self</span>.<spa= n style=3D"color:rgb(101,84,192)">SPINNER</span>):</div><div style=3D"font-= family:ui-monospace,SFMono-Medium,"SF Mono","Segoe UI Mono&q= uot;,"Roboto Mono","Ubuntu Mono",Menlo,monospace;font-s= ize:13px;white-space:pre-wrap;background-color:rgb(255,255,254);color:rgb(0= ,0,0)"> <span style=3D"color:rgb(32,32,32)">sys</span>.<span sty= le=3D"color:rgb(32,32,32)">stdout</span>.<span style=3D"color:rgb(32,32,32)= ">write</span>(<span style=3D"color:rgb(32,32,32)">s</span> + <span style= =3D"color:rgb(9,101,69)">"\n"</span>)</div><div style=3D"font-fam= ily:ui-monospace,SFMono-Medium,"SF Mono","Segoe UI Mono"= ;,"Roboto Mono","Ubuntu Mono",Menlo,monospace;font-size= :13px;white-space:pre-wrap;background-color:rgb(255,255,254);color:rgb(0,0,= 0)"> <span style=3D"color:rgb(9,30,66);font-weight:bold">return<= /span></div><font color=3D"#000000" style=3D"font-family:ui-monospace,SFMon= o-Medium,"SF Mono","Segoe UI Mono","Roboto Mono&qu= ot;,"Ubuntu Mono",Menlo,monospace;font-size:13px;white-space:pre-= wrap;background-color:rgb(255,255,254)"><br></font><div style=3D"font-famil= y:ui-monospace,SFMono-Medium,"SF Mono","Segoe UI Mono",= "Roboto Mono","Ubuntu Mono",Menlo,monospace;font-size:1= 3px;white-space:pre-wrap;background-color:rgb(255,255,254);color:rgb(0,0,0)= "> <span style=3D"color:rgb(160,160,160);font-style:italic"># take o= ff the marker</span></div><div style=3D"font-family:ui-monospace,SFMono-Med= ium,"SF Mono","Segoe UI Mono","Roboto Mono",&= quot;Ubuntu Mono",Menlo,monospace;font-size:13px;white-space:pre-wrap;= background-color:rgb(255,255,254);color:rgb(0,0,0)"> <span style=3D"= color:rgb(32,32,32)">s</span> =3D <span style=3D"color:rgb(32,32,32)">s</sp= an>[<span style=3D"color:rgb(9,30,66);font-weight:bold">len</span>(<span st= yle=3D"color:rgb(9,30,66);font-weight:bold">self</span>.<span style=3D"colo= r:rgb(101,84,192)">SPINNER</span>):]</div><font color=3D"#000000" style=3D"= font-family:ui-monospace,SFMono-Medium,"SF Mono","Segoe UI M= ono","Roboto Mono","Ubuntu Mono",Menlo,monospace;f= ont-size:13px;white-space:pre-wrap;background-color:rgb(255,255,254)"><br><= /font><div style=3D"font-family:ui-monospace,SFMono-Medium,"SF Mono&qu= ot;,"Segoe UI Mono","Roboto Mono","Ubuntu Mono&quo= t;,Menlo,monospace;font-size:13px;white-space:pre-wrap;background-color:rgb= (255,255,254);color:rgb(0,0,0)"> <span style=3D"color:rgb(160,160,16= 0);font-style:italic"># figure out if we are supposed to print the source o= r target</span></div><div style=3D"font-family:ui-monospace,SFMono-Medium,&= quot;SF Mono","Segoe UI Mono","Roboto Mono","= Ubuntu Mono",Menlo,monospace;font-size:13px;white-space:pre-wrap;backg= round-color:rgb(255,255,254);color:rgb(0,0,0)"> <span style=3D"color= :rgb(32,32,32)">which</span> =3D <span style=3D"color:rgb(32,32,32)">s</spa= n>[<span style=3D"color:rgb(101,84,192)">0</span>:<span style=3D"color:rgb(= 101,84,192)">3</span>]</div><div style=3D"font-family:ui-monospace,SFMono-M= edium,"SF Mono","Segoe UI Mono","Roboto Mono"= ,"Ubuntu Mono",Menlo,monospace;font-size:13px;white-space:pre-wra= p;background-color:rgb(255,255,254);color:rgb(0,0,0)"><br></div><div style= =3D"font-family:ui-monospace,SFMono-Medium,"SF Mono","Segoe = UI Mono","Roboto Mono","Ubuntu Mono",Menlo,monospa= ce;font-size:13px;white-space:pre-wrap;background-color:rgb(255,255,254)"><= div style=3D"line-height:18px"><div><font color=3D"#000000"> </font>= <span style=3D"color:rgb(160,160,160);font-style:italic"># Generate the pre= fix (the part printed before the filename).</span></div><div style=3D"color= :rgb(0,0,0)"> <span style=3D"color:rgb(32,32,32)">print_prefix</span= > =3D <span style=3D"color:rgb(32,32,32)">s</span>[<span style=3D"color:rgb= (101,84,192)">3</span>:]<br></div></div><font color=3D"#000000"> </font></div><div style=3D"font-family:ui-monospace,SFMono-Medium,"SF = Mono","Segoe UI Mono","Roboto Mono","Ubuntu M= ono",Menlo,monospace;font-size:13px;white-space:pre-wrap;background-co= lor:rgb(255,255,254);color:rgb(0,0,0)"> <span style=3D"color:rgb(160= ,160,160);font-style:italic"># Find out what filename to print as part of t= he output. We'd</span><br></div><div style=3D"font-family:ui-monospace,= SFMono-Medium,"SF Mono","Segoe UI Mono","Roboto Mo= no","Ubuntu Mono",Menlo,monospace;font-size:13px;white-space= :pre-wrap;background-color:rgb(255,255,254);color:rgb(0,0,0)"> <span= style=3D"color:rgb(160,160,160);font-style:italic"># rather print the name= of the source, but steps such as</span></div><div style=3D"font-family:ui-= monospace,SFMono-Medium,"SF Mono","Segoe UI Mono","= ;Roboto Mono","Ubuntu Mono",Menlo,monospace;font-size:13px;w= hite-space:pre-wrap;background-color:rgb(255,255,254);color:rgb(0,0,0)"> = <span style=3D"color:rgb(160,160,160);font-style:italic"># library cre= ation have a zillion sources and one target, so</span></div><div style=3D"f= ont-family:ui-monospace,SFMono-Medium,"SF Mono","Segoe UI Mo= no","Roboto Mono","Ubuntu Mono",Menlo,monospace;fo= nt-size:13px;white-space:pre-wrap;background-color:rgb(255,255,254);color:r= gb(0,0,0)"> <span style=3D"color:rgb(160,160,160);font-style:italic"= ># we'll print the target instead for those.</span></div><div style=3D"= font-family:ui-monospace,SFMono-Medium,"SF Mono","Segoe UI M= ono","Roboto Mono","Ubuntu Mono",Menlo,monospace;f= ont-size:13px;white-space:pre-wrap;background-color:rgb(255,255,254);color:= rgb(0,0,0)"> <span style=3D"color:rgb(9,30,66);font-weight:bold">if<= /span> <span style=3D"color:rgb(32,32,32)">which</span> =3D=3D <span style= =3D"color:rgb(32,32,32)">SpinnerPrinter</span>.<span style=3D"color:rgb(101= ,84,192)">SOURCE</span>:</div><div style=3D"font-family:ui-monospace,SFMono= -Medium,"SF Mono","Segoe UI Mono","Roboto Mono&quo= t;,"Ubuntu Mono",Menlo,monospace;font-size:13px;white-space:pre-w= rap;background-color:rgb(255,255,254);color:rgb(0,0,0)"> <span s= tyle=3D"color:rgb(32,32,32)">file_to_print</span> =3D <span style=3D"color:= rgb(32,32,32)">source</span>[<span style=3D"color:rgb(101,84,192)">0</span>= ]</div><div style=3D"font-family:ui-monospace,SFMono-Medium,"SF Mono&q= uot;,"Segoe UI Mono","Roboto Mono","Ubuntu Mono&qu= ot;,Menlo,monospace;font-size:13px;white-space:pre-wrap;background-color:rg= b(255,255,254);color:rgb(0,0,0)"> <span style=3D"color:rgb(9,30,66);= font-weight:bold">else</span>:</div><div style=3D"font-family:ui-monospace,= SFMono-Medium,"SF Mono","Segoe UI Mono","Roboto Mo= no","Ubuntu Mono",Menlo,monospace;font-size:13px;white-space= :pre-wrap;background-color:rgb(255,255,254);color:rgb(0,0,0)"> <= span style=3D"color:rgb(32,32,32)">file_to_print</span> =3D <span style=3D"= color:rgb(32,32,32)">target</span>[<span style=3D"color:rgb(101,84,192)">0<= /span>]</div><div style=3D"font-family:ui-monospace,SFMono-Medium,"SF = Mono","Segoe UI Mono","Roboto Mono","Ubuntu M= ono",Menlo,monospace;font-size:13px;white-space:pre-wrap;background-co= lor:rgb(255,255,254);color:rgb(0,0,0)"> <span style=3D"color:rgb(32,= 32,32)">fn_to_print</span> =3D <span style=3D"color:rgb(32,32,32)">os</span= >.<span style=3D"color:rgb(32,32,32)">path</span>.<span style=3D"color:rgb(= 32,32,32)">realpath</span>(<span style=3D"color:rgb(9,30,66);font-weight:bo= ld">str</span>(<span style=3D"color:rgb(32,32,32)">file_to_print</span>))</= div><div style=3D"font-family:ui-monospace,SFMono-Medium,"SF Mono"= ;,"Segoe UI Mono","Roboto Mono","Ubuntu Mono"= ,Menlo,monospace;font-size:13px;white-space:pre-wrap;background-color:rgb(2= 55,255,254);color:rgb(0,0,0)"><br></div><div style=3D"font-family:ui-monosp= ace,SFMono-Medium,"SF Mono","Segoe UI Mono","Robot= o Mono","Ubuntu Mono",Menlo,monospace;font-size:13px;white-s= pace:pre-wrap;background-color:rgb(255,255,254);color:rgb(0,0,0)"> <= span style=3D"color:rgb(160,160,160);font-style:italic"># Combine the direc= tive we were given (e.g. "Compiling")</span><br></div><div style= =3D"font-family:ui-monospace,SFMono-Medium,"SF Mono","Segoe = UI Mono","Roboto Mono","Ubuntu Mono",Menlo,monospa= ce;font-size:13px;white-space:pre-wrap;background-color:rgb(255,255,254);co= lor:rgb(0,0,0)"> <span style=3D"color:rgb(160,160,160);font-style:it= alic"># with the filename</span></div><div style=3D"font-family:ui-monospac= e,SFMono-Medium,"SF Mono","Segoe UI Mono","Roboto = Mono","Ubuntu Mono",Menlo,monospace;font-size:13px;white-spa= ce:pre-wrap;background-color:rgb(255,255,254)"><span style=3D"color:rgb(0,0= ,0)"> </span><font color=3D"#202020">sys.stdout.write(f</font><span = style=3D"color:rgb(9,101,69)">"{print_prefix} {fn_to_print}\n"</s= pan></div><div style=3D"line-height:18px"><br></div>This can be made much f= ancier; I've elided various details. For example, the real spinner sens= es if stdout is a tty. If it is a tty, it uses ANSI escape sequences so the= output lines overwrite themselves, and it prints only the part of the file= name that fits on a single terminal line (after sensing its width). So when= our team builds from the command-line, a normal build does not use any ter= minal space at all! When running from a script, the "Compiling" a= nd "Linking" lines all appear as separate lines. And without the = --verbose option, the entire custom output block is skipped and full comman= d-lines get printed (the default scons behavior).</div><div style=3D"line-h= eight:18px"><br></div><div style=3D"line-height:18px">Hopefully this helps = someone! We've been very happy with how it works (and with scons in gen= eral).</div><div style=3D"line-height:18px"><br></div><div style=3D"line-he= ight:18px">-Jeremy=C2=A0</div></div><div style=3D"line-height:18px"><br></d= iv><div class=3D"gmail_quote"><div dir=3D"ltr" class=3D"gmail_attr">On Sun,= Jan 21, 2024 at 1:07=E2=80=AFPM Bill Deegan <<a href=3D"mailto:bill@bad= dogconsulting.com" target=3D"_blank">[email protected]</a>> wrot= e:<br></div><blockquote class=3D"gmail_quote" style=3D"margin:0px 0px 0px 0= .8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div dir=3D"l= tr"><div>Dagg,</div><div><br></div><div>What Mats said.. with more detail.<= /div><div><br></div><div>So if your compiling c++, the relevant variables a= re</div><div>CXXCOM, CXXCOMSTR</div><div>SHCXXCOM, SHCXXCOMSTR</div><div><b= r></div><div>The *STR variables are what is output to the screen, the non *= STR are what's used to build the command line and execute.</div><div>re= place CXX with CC for C compiles.. <br></div><div>You can see the complete = list of such variables in the manpage:</div><div><a href=3D"https://scons.o= rg/doc/production/HTML/scons-man.html" target=3D"_blank">https://scons.org/= doc/production/HTML/scons-man.html</a></div><div><br></div><div>Hope this h= elps~!<br></div><div>-=3DBill<br></div></div><br><div class=3D"gmail_quote"= ><div dir=3D"ltr" class=3D"gmail_attr">On Sun, Jan 21, 2024 at 11:07=E2=80= =AFAM Mats Wichmann <<a href=3D"mailto:[email protected]" target=3D"_blan= k">[email protected]</a>> wrote:<br></div><blockquote class=3D"gmail_quot= e" style=3D"margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204)= ;padding-left:1ex">On January 21, 2024 5:40:14 AM MST, daggs via Scons-user= s <<a href=3D"mailto:[email protected]" target=3D"_blank">scons-user= [email protected]</a>> wrote:<br> >Greetings,<br> ><br> >I want to add a prefix the compile line scons is displaying, is it poss= ible?<br> ><br> >Thanks,<br> ><br> >Dagg<br> >_______________________________________________<br> >Scons-users mailing list<br> ><a href=3D"mailto:[email protected]" target=3D"_blank">Scons-users@= scons.org</a><br> ><a href=3D"https://pairlist4.pair.net/mailman/listinfo/scons-users" rel= =3D"noreferrer" target=3D"_blank">https://pairlist4.pair.net/mailman/listin= fo/scons-users</a><br> <br> yes. <br> <br> sorry not at a place I can answer more fully, but can modify the relevant C= OMSTR (command string), or supply your own $PRINT_CMD_LINE_FUNC<br> -- <br> Sent from my Android device with K-9 Mail. Please excuse my brevity.<br> _______________________________________________<br> Scons-users mailing list<br> <a href=3D"mailto:[email protected]" target=3D"_blank">Scons-users@scon= s.org</a><br> <a href=3D"https://pairlist4.pair.net/mailman/listinfo/scons-users" rel=3D"= noreferrer" target=3D"_blank">https://pairlist4.pair.net/mailman/listinfo/s= cons-users</a><br> </blockquote></div> _______________________________________________<br> Scons-users mailing list<br> <a href=3D"mailto:[email protected]" target=3D"_blank">Scons-users@scon= s.org</a><br> <a href=3D"https://pairlist4.pair.net/mailman/listinfo/scons-users" rel=3D"= noreferrer" target=3D"_blank">https://pairlist4.pair.net/mailman/listinfo/s= cons-users</a><br> </blockquote></div></div> _______________________________________________<br> Scons-users mailing list<br> <a href=3D"mailto:[email protected]" target=3D"_blank">Scons-users@scon= s.org</a><br> <a href=3D"https://pairlist4.pair.net/mailman/listinfo/scons-users" rel=3D"= noreferrer" target=3D"_blank">https://pairlist4.pair.net/mailman/listinfo/s= cons-users</a><br> </blockquote></div> _______________________________________________<br> Scons-users mailing list<br> <a href=3D"mailto:[email protected]" target=3D"_blank">Scons-users@scon= s.org</a><br> <a href=3D"https://pairlist4.pair.net/mailman/listinfo/scons-users" rel=3D"= noreferrer" target=3D"_blank">https://pairlist4.pair.net/mailman/listinfo/s= cons-users</a><br> </blockquote></div> </blockquote></div></div></div></div> </div></div> _______________________________________________<br> Scons-users mailing list -- <a href=3D"mailto:[email protected]" targe= t=3D"_blank">[email protected]</a><br> To unsubscribe send an email to <a href=3D"mailto:scons-users-leave@python.= org" target=3D"_blank">[email protected]</a><br> </blockquote></div> _______________________________________________<br> Scons-users mailing list -- <a href=3D"mailto:[email protected]" targe= t=3D"_blank">[email protected]</a><br> To unsubscribe send an email to <a href=3D"mailto:scons-users-leave@python.= org" target=3D"_blank">[email protected]</a><br> </blockquote></div> --0000000000003aef44064a6a5824-- --===============8589194565428317717== Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Disposition: inline _______________________________________________ Scons-users mailing list -- [email protected] To unsubscribe send an email to [email protected] --===============8589194565428317717==--