[Scons-users] Need Help - Renaming an input file does not re-trigger SCons builder

Dirk Baechle tshortik at gmx.de
Fri Feb 2 03:01:37 EST 2018


Hi Basil, 

here's my advice: Drop your current approach and start anew. Have you already read our ToolsForFools guide in the Wiki?
Sorry for being so blunt, but it looks like you're trying hard to link your own "build steps" into SCons. 
Don't do that...wrap the actual transformation of *.grl into "something else" into a proper Builder. SCons will do the rest. 

Best regards, and keep those questions coming, 

Dirk


Am 2. Februar 2018 08:09:31 MEZ schrieb Basil Mathew <iambasilmathew at gmail.com>:
> Hello Bill,
>
>Please ignore my earlier e-mail, there was an error from my side in the
>attached example, I did not intend to modify the target name, the
>target
>name remains the same, please excuse
>
>What I meant to convey was that if I just rename one of the input file
>without modifying the file content (for e.g
>src/work/dds/gtypes_dds_1.grl
>to src/work/dds/gtypes_dds.grl ), I do not see the action
>"command_process_executor_builder" running.
>
>I make the following change:
>
>1. I rename the file src/work/dds/gtypes_dds_1.grl  to
>src/work/dds/gtypes_dds.grl in the file system
>2. I change the SConstruct as shown below
>
>    result1 = env.Foo("__proc_done.txt",    [
>
>"src/work/dds/codeSymbols.grl",
>                                            "src/work/dds/gtypes_dds_1.
>grl",
>
>"src/work/dds/iopt_memmap.grl",
>                                           "src/work/dds/@ecu_add_test.
>grl"
>                                            ]
>                    )
>
>    to
>    result1 = env.Foo( "__proc_done.txt" ,    [
>
>"src/work/dds/codeSymbols.grl",
>
>"src/work/dds/gtypes_dds.grl",
>
>"src/work/dds/iopt_memmap.grl",
>                                           "src/work/dds/@ecu_add_test.
>grl"
>                                            ]
>                    )
>
>Thank you
>
>
>On Fri, Feb 2, 2018 at 12:00 PM, Basil Mathew
><iambasilmathew at gmail.com>
>wrote:
>
>> Hello Bill,
>>
>> Thank you for the reply, sorry about the coloring, intention was to
>make
>> it easier to read
>>
>> What I meant to convey was that if I just rename one of the input
>file
>> without modifying the content (for e.g src/work/dds/gtypes_dds_1.grl 
>to
>> src/work/dds/gtypes_dds.grl ), I do not see the action
>> "command_process_executor_builder" running.
>>
>> I make the following change:
>>
>> 1. I rename the file src/work/dds/gtypes_dds_1.grl  to
>> src/work/dds/gtypes_dds.grl in the file system
>> 2. I change the SConstruct as shown below
>>
>>     result1 = env.Foo("__proc_done.txt",    [
>>
>> "src/work/dds/codeSymbols.grl",
>>
>> "src/work/dds/gtypes_dds_1.grl",
>>
>> "src/work/dds/iopt_memmap.grl",
>>
>> "src/work/dds/@ecu_add_test.grl"
>>                                             ]
>>                     )
>>
>>     to
>>     result1 = env.Foo("src/work/dds/codeSymbols.grl",    [
>>
>> "src/work/dds/codeSymbols.grl",
>>
>> "src/work/dds/gtypes_dds.grl",
>>
>> "src/work/dds/iopt_memmap.grl",
>>
>> "src/work/dds/@ecu_add_test.grl"
>>                                             ]
>>                     )
>>
>> Thank you
>> Basil
>>
>> On Fri, Feb 2, 2018 at 10:50 AM, Bill Deegan
><bill at baddogconsulting.com>
>> wrote:
>>
>>> So if you change:
>>>     result1 = env.Foo("__proc_done.txt",    [
>>>
>>> "src/work/dds/codeSymbols.grl",
>>>
>>> "src/work/dds/gtypes_dds_1.grl",
>>>
>>> "src/work/dds/iopt_memmap.grl",
>>>                                                 "src/work/dds/@
>>> ecu_add_test.grl"
>>>                                             ]
>>>                     )
>>>
>>> to
>>>     result1 = env.Foo("src/work/dds/codeSymbols.grl",    [
>>>
>>> "src/work/dds/codeSymbols.grl",
>>>
>>> "src/work/dds/gtypes_dds_1.grl",
>>>
>>> "src/work/dds/iopt_memmap.grl",
>>>                                                 "src/work/dds/@
>>> ecu_add_test.grl"
>>>                                             ]
>>>                     )
>>>
>>> It doesn't rebuild?
>>> I'm not sure what you're saying you're changing which is not
>resulting in
>>> an action running.
>>> (Also please don't change the color of the text, it makes it quite
>hard
>>> to read)
>>>
>>> -Bill
>>> SCons Project Co-Manager
>>>
>>> On Thu, Feb 1, 2018 at 8:41 PM, Basil Mathew
><iambasilmathew at gmail.com>
>>> wrote:
>>>
>>>> Hello all,
>>>>
>>>> I am fairly new to SCons and to Python; hence, please excuse if
>this is
>>>> a silly question.
>>>>
>>>> I am using SCons version "v2.4.0.rel_2.4.0:3365:9259ea1c13d7". I
>was
>>>> playing around with some very basic topics in SCons to get myself
>>>> acquainted with SCons when I came across the strange scenario that
>SCons
>>>> does not execute the builder when I rename one of the input file to
>a
>>>> target without changing its content. I was really surprised since I
>was
>>>> expecting the SCons to recognize that the input files list has
>>>> changed(though not its content) and execute the builder. Please see
>the
>>>> content of the SConstruct file that I have been using.
>>>>
>>>> import os
>>>> import sys
>>>> import SCons
>>>> import subprocess
>>>>
>>>> DefaultEnvironment(tools = [])
>>>>
>>>> input_files_list = []
>>>> process_option_list = []
>>>> process_exec_cmd_line = ''
>>>> target_name = ''
>>>>
>>>> def command_process_executor_builder(target, source, env):
>>>>     target_file_path_name = target[0].get_abspath()
>>>>
>>>>     print "############### Executing Process"
>>>>
>>>>     return None
>>>>
>>>> def build():
>>>>     global input_files_list, process_option_list,
>process_exec_cmd_line,
>>>> target_name
>>>>
>>>>     env = DefaultEnvironment(tools = [])
>>>>     a = Action(command_process_executor_builder, varlist=['my_arg',
>>>> 'PROCESS_EXEC_CMD_LINE', 'PROCESS_OPTION_LIST'])
>>>>
>>>>     proc_exec_bldr = Builder(action = a)
>>>>
>>>>     env['my_arg'] = 'default-value'
>>>>     env['PROCESS_EXEC_CMD_LINE'] = process_exec_cmd_line
>>>>     env['PROCESS_OPTION_LIST'] = process_option_list
>>>>
>>>>     env.Append(BUILDERS = {'Foo' : proc_exec_bldr})
>>>>
>>>>     result1 = env.Foo("__proc_done.txt",    [
>>>>
>>>> "src/work/dds/codeSymbols.grl",
>>>>
>>>> "src/work/dds/gtypes_dds_1.grl",
>>>>
>>>> "src/work/dds/iopt_memmap.grl",
>>>>                                                 "src/work/dds/@
>>>> ecu_add_test.grl"
>>>>                                             ]
>>>>                     )
>>>>
>>>>
>>>> build()
>>>>
>>>> I was wondering if this is the default behaviour of SCons when it
>comes
>>>> to renaming input files or if there is some mistake with the way I
>am using
>>>> SCons. If this is indeed the default behaviour of SCons, can some
>one let
>>>> me know the reason behind this.
>>>>
>>>> Thank you
>>>>
>>>> Basil Mathew
>>>>
>>>>
>>>>
>>>> _______________________________________________
>>>> Scons-users mailing list
>>>> Scons-users at scons.org
>>>> https://pairlist4.pair.net/mailman/listinfo/scons-users
>>>>
>>>>
>>>
>>> _______________________________________________
>>> Scons-users mailing list
>>> Scons-users at scons.org
>>> https://pairlist4.pair.net/mailman/listinfo/scons-users
>>>
>>>
>>

-- 
Sent from my Android with K-9 Mail.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://pairlist4.pair.net/pipermail/scons-users/attachments/20180202/5b98e583/attachment-0001.html>


More information about the Scons-users mailing list