[Scons-users] adding text to compile line

daggs daggs at gmx.com
Mon Feb 5 08:41:29 EST 2024


tried this,

getting this error:
Traceback (most recent call last):
  File "/usr/lib/scons/SCons/Action.py", line 688, in __call__
    cmd = self.strfunction(target, source, env, executor)
  File "./site_scons/site_init.py", line 10, in my_strfunction
    c = env.subst(self.cmdstr, SUBST_CMD, executor=executor,
TypeError: subst() got an unexpected keyword argument 'overrides'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/usr/lib/scons/SCons/Taskmaster.py", line 255, in execute
    self.targets[0].build()
  File "/usr/lib/scons/SCons/Node/__init__.py", line 766, in build
    self.get_executor()(self, **kw)
  File "/usr/lib/scons/SCons/Executor.py", line 397, in __call__
    return _do_execute_map[self._do_execute](self, target, kw)
  File "/usr/lib/scons/SCons/Executor.py", line 128, in execute_action_list
    status = act(*args, **kw)
  File "/usr/lib/scons/SCons/Action.py", line 1052, in __call__
    return act(target, source, env, exitstatfunc, presub,
  File "/usr/lib/scons/SCons/Action.py", line 1120, in __call__
    return c.__call__(self, target, source, env, *args, **kw)
  File "/usr/lib/scons/SCons/Action.py", line 690, in __call__
    cmd = self.strfunction(target, source, env)
  File "./site_scons/site_init.py", line 13, in my_strfunction
    c = env.subst(self.cmdstr, SUBST_CMD, target, source,
TypeError: subst() got an unexpected keyword argument 'overrides'


> Sent: Friday, February 02, 2024 at 7:59 PM
> From: "Mats Wichmann" <mats at wichmann.us>
> To: scons-users at scons.org
> Subject: Re: [Scons-users] adding text to compile line
>
> On 2/2/24 01:25, daggs via Scons-users wrote:
> > Greetings Bill,
> > I'll try it, just for the heck of it but it isn't a valid solution as I
> > cannot ask multiple devs to make that change in their scons.
> > the question is, can I remove them using the std python code?
> > one of the main features we use is take the compile line and run it
> > manually so we don't need to run the entire build just to test one line.
> > these "addons" will wreck havoc in bash
>
> You don't have to patch scons, you can try it this way:
>
> In the top dir of your project, create a site_scons directory, and put a
> site_init.py into it containing this:
>
> # monkeypatch strfunction() to print a prefix
>
>
> import SCons.Action
> from SCons.Subst import SUBST_CMD
>
> def my_strfunction(self, target, source, env, executor=None, overrides:
> bool = False) -> str:
>      if self.cmdstr is None:
>          return None
>      if self.cmdstr is not SCons.Action._null:
>          if executor:
>              c = env.subst(self.cmdstr, SUBST_CMD, executor=executor,
> overrides=overrides)
>          else:
>              c = env.subst(self.cmdstr, SUBST_CMD, target, source,
> overrides=overrides)
>          if c:
>              return c
>      cmd_list, ignore, silent = self.process(target, source, env,
> executor, overrides=overrides)
>      if silent:
>          return ''
>      return "PREFIX: " + SCons.Action._string_from_cmd_list(cmd_list[0])
>
> SCons.Action.CommandAction.strfunction = my_strfunction
>
>
>
> _______________________________________________
> Scons-users mailing list
> Scons-users at scons.org
> https://pairlist4.pair.net/mailman/listinfo/scons-users
>


More information about the Scons-users mailing list