Fwd: adding text to compile line
Jeremy Elson <[email protected]> Mon, 9 Feb 2026 11:28:35 -0800
| Newsgroups | gmane.comp.programming.tools.scons.user |
|---|---|
| Message-ID | <CAKufN8XchdpFDEx3KtUvSsU_F+aOmFuf5ugp5Coy=iyKwP2xOg@mail.gmail.com> |
--===============0181709670773488526== Content-Type: multipart/alternative; boundary="000000000000dbeeff064a69254b" --000000000000dbeeff064a69254b Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable 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, which 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]> wr= ote: > Sure! > > > On Sun, Jan 21, 2024 at 6:29=E2=80=AFPM Bill Deegan <bill@baddogconsultin= g.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.(It'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 output= s, >>> such as Compiling, should show the name of the source. Others, such as >>> Linking, show the name of the target. >>> >>> First, I defined a class called SpinnerPrinter that looks sort of like >>> 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 the build >>> output should use the source filenames, and spin_target to show it shou= ld >>> 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 protobuf= ") >>> 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 ANS= I >>> escape sequences so the output lines overwrite themselves, and it print= s >>> only the part of the filename that fits on a single terminal line (afte= r >>> sensing its width). So when our team builds from the command-line, a no= rmal >>> build does not use any terminal space at all! When running from a scrip= t, >>> the "Compiling" and "Linking" lines all appear as separate lines. And >>> without the --verbose option, the entire custom output block is skipped= 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@baddogconsult= ing.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 are >>>> 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@wichmann.= 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_LINE_= 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 >> > --000000000000dbeeff064a69254b Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable <div dir=3D"ltr"><div class=3D"gmail_quote gmail_quote_container"><div 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 below) th= at I'd made a little 'Spinner' utility=C2=A0for scons, which ge= nerates more compact build output.<div>Bill asked if I could contribute it = back to the scons-contrib repo, which after a mere 2 year delay I have fina= lly done:</div><div><br></div><div><a href=3D"https://github.com/SCons/scon= s-contrib/pull/54" target=3D"_blank">https://github.com/SCons/scons-contrib= /pull/54</a></div><div><br></div><div>Best,</div><div>Jeremy</div><div><div= ><br><div class=3D"gmail_quote"><div dir=3D"ltr" class=3D"gmail_attr">On Mo= n, Jan 22, 2024 at 11:38=E2=80=AFPM Jeremy Elson <<a href=3D"mailto:jels= [email protected]" target=3D"_blank">[email protected]</a>> wrote:<br></div><b= lockquote class=3D"gmail_quote" style=3D"margin:0px 0px 0px 0.8ex;border-le= ft: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"gm= ail_attr">On Sun, Jan 21, 2024 at 6:29=E2=80=AFPM Bill Deegan <<a href= =3D"mailto:[email protected]" target=3D"_blank">bill@baddogconsulti= ng.com</a>> wrote:<br></div><blockquote class=3D"gmail_quote" style=3D"m= argin: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 chance you= could contribute that to the <a href=3D"https://github.com/SCons/scons-con= trib" target=3D"_blank">https://github.com/SCons/scons-contrib</a> repo?</d= iv><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:jelson@= gmail.com" target=3D"_blank">[email protected]</a>> wrote:<br></div><bloc= kquote 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"l= tr">This is a lot more than what OP asked for, but I'll describe the cu= stom output code I wrote for one of my Scons-based build systems.(It's = not open-source, so I can't link to the full code.)</div><div dir=3D"lt= r"><div><div><br>My goal was to replace all the raw command-line output wit= h something like:</div><div><br></div><div><font face=3D"monospace">Compili= ng src/app/foo.c</font></div><div><font face=3D"monospace">Compiling src/ap= p/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 "Li= nking" are standard scons rules; "Signing" is a custom build= er. The trick is that for some of the outputs, such as Compiling, should sh= ow the name of the source. Others, such as Linking, show the name of the ta= rget.</div><div><br></div><div>First, I defined a class called SpinnerPrint= er that looks sort of like this:</div><div><br></div><div><div style=3D"lin= e-height:18px"><div style=3D"color:rgb(0,0,0);font-family:ui-monospace,SFMo= no-Medium,"SF Mono","Segoe UI Mono","Roboto Mono&q= uot;,"Ubuntu Mono",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">class </span><span style=3D"color:rgb(166,36,0);font-wei= ght:bold">SpinnerPrinter</span>:</div><div style=3D"color:rgb(0,0,0);font-f= amily:ui-monospace,SFMono-Medium,"SF Mono","Segoe UI Mono&qu= ot;,"Roboto Mono","Ubuntu Mono",Menlo,monospace;font-si= ze:13px;white-space:pre-wrap;background-color:rgb(255,255,254)"> <span s= tyle=3D"color:rgb(101,84,192)">SPINNER</span> =3D <span style=3D"color:rgb(= 9,101,69)">'<<spinner>>'</span></div><div style=3D"colo= r:rgb(0,0,0);font-family:ui-monospace,SFMono-Medium,"SF Mono",&qu= ot;Segoe UI Mono","Roboto Mono","Ubuntu Mono",Menl= o,monospace;font-size:13px;white-space:pre-wrap;background-color:rgb(255,25= 5,254)"> <span style=3D"color:rgb(101,84,192)">SOURCE</span> =3D <span s= tyle=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","= ;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)">TARGET</span> =3D <span sty= le=3D"color:rgb(9,101,69)">'trg'</span></div><br><div style=3D"colo= r:rgb(0,0,0);font-family:ui-monospace,SFMono-Medium,"SF Mono",&qu= ot;Segoe UI Mono","Roboto Mono","Ubuntu Mono",Menl= o,monospace;font-size:13px;white-space:pre-wrap;background-color:rgb(255,25= 5,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>(<s= pan style=3D"color:rgb(32,32,32)">s</span>):<br></div><div style=3D"color:r= gb(0,0,0);font-family:ui-monospace,SFMono-Medium,"SF Mono","= Segoe UI Mono","Roboto Mono","Ubuntu Mono",Menlo,m= onospace;font-size:13px;white-space:pre-wrap;background-color:rgb(255,255,2= 54)"> <span style=3D"color:rgb(9,30,66);font-weight:bold">return</sp= an> <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)">SOURCE</sp= an> + <span style=3D"color:rgb(32,32,32)">s</span></div><br><div style=3D"c= olor:rgb(0,0,0);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)"> <span style=3D"color:rgb(0,73,176);font-weight:bold">def </s= pan><span style=3D"color:rgb(191,38,0);font-weight:bold">spin_target</span>= (<span style=3D"color:rgb(32,32,32)">s</span>):</div><div style=3D"color:rg= b(0,0,0);font-family:ui-monospace,SFMono-Medium,"SF Mono","S= egoe UI Mono","Roboto Mono","Ubuntu Mono",Menlo,mo= nospace;font-size:13px;white-space:pre-wrap;background-color:rgb(255,255,25= 4)"> <span style=3D"color:rgb(9,30,66);font-weight:bold">return</spa= n> <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)">TARGET</span>= + <span style=3D"color:rgb(32,32,32)">s</span></div><br>Then, in my functi= on that sets up the scons build env, I have code that looks like the exampl= es below. I call spin_source to indicate the build output should use the so= urce filenames, and spin_target to show it should be target. The COMSTRs al= l end up being configuration strings for the custom output function.</div><= /div><div style=3D"line-height:18px"><br></div><div style=3D"line-height:18= px"><div style=3D"color:rgb(0,0,0);background-color:rgb(255,255,254);font-f= amily:ui-monospace,SFMono-Medium,"SF Mono","Segoe UI Mono&qu= ot;,"Roboto Mono","Ubuntu Mono",Menlo,monospace;font-si= ze:13px;line-height:18px;white-space:pre-wrap"><div> <span style=3D"colo= r: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"color:rgb(32,32,32)">build_op= tions</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_CMD_LINE_FU= NC'</span>] =3D <span style=3D"color:rgb(32,32,32)">SpinnerPrinter</spa= n>().<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> --000000000000dbeeff064a69254b-- --===============0181709670773488526== 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] --===============0181709670773488526==--