[Scons-users] Is it possible to use Copy Action Functions outside of SConscript?
Pierre-Luc Boily
pierreluc.boily at gmail.com
Fri Mar 16 12:10:31 EDT 2018
Same error with env.Copy and Copy :\
AttributeError: <class 'SCons.Node.FS.File'> object has no attribute
'startswith':
File "/svn/localroot/faa_mx/integ-scons/SConstruct", line 58:
build()
File "/svn/localroot/faa_mx/integ-scons/SConstruct", line 29:
cache = not SConscript(str(script).strip(), exports='envService
vcxprojList', variant_dir=utils.createVariantDir(envService, script),
duplicate=0)
File "/usr/local/lib/scons-2.5.1/SCons/Script/SConscript.py", line 604:
return method(*args, **kw)
File "/usr/local/lib/scons-2.5.1/SCons/Script/SConscript.py", line 541:
return _SConscript(self.fs, *files, **subst_kw)
File "/usr/local/lib/scons-2.5.1/SCons/Script/SConscript.py", line 250:
exec _file_ in call_stack[-1].globals
File "/svn/localroot/faa_mx/integ-scons/fwk/dds_model/dds_model.sc", line
12:
idlGeneratedHeaders = env.compile_idl_files()
File
"/svn/localroot/faa_mx/integ-scons/cm/scons/adacelBuilders/pseudoBuilders.py",
line 132:
action = [Copy(os.path.join(env['LOCALROOT'], variantDirOutput,
idlFile), idlFile),
File "/usr/local/lib/python2.7/posixpath.py", line 68:
if b.startswith('/'):
File "/usr/local/lib/scons-2.5.1/SCons/Node/FS.py", line 682:
(self.__class__, attr))
On Fri, Mar 16, 2018 at 12:05 PM, Bill Deegan <bill at baddogconsulting.com>
wrote:
> Not env.Copy, just Copy().
>
> On Fri, Mar 16, 2018 at 11:56 AM, Pierre-Luc Boily <
> pierreluc.boily at gmail.com> wrote:
>
>> I shall read better the man page. Thx. Now I have this error below. I
>> thought that I might need to import SCons.Node, but no luck.
>>
>> AttributeError: <class 'SCons.Node.FS.File'> object has no attribute
>> 'startswith':
>> File "/svn/localroot/faa_mx/integ-scons/SConstruct", line 58:
>> build()
>> File "/svn/localroot/faa_mx/integ-scons/SConstruct", line 29:
>> cache = not SConscript(str(script).strip(), exports='envService
>> vcxprojList', variant_dir=utils.createVariantDir(envService, script),
>> duplicate=0)
>> File "/usr/local/lib/scons-2.5.1/SCons/Script/SConscript.py", line 604:
>> return method(*args, **kw)
>> File "/usr/local/lib/scons-2.5.1/SCons/Script/SConscript.py", line 541:
>> return _SConscript(self.fs, *files, **subst_kw)
>> File "/usr/local/lib/scons-2.5.1/SCons/Script/SConscript.py", line 250:
>> exec _file_ in call_stack[-1].globals
>> File "/svn/localroot/faa_mx/integ-scons/fwk/dds_model/dds_model.sc",
>> line 12:
>> idlGeneratedHeaders = env.compile_idl_files()
>> File "/svn/localroot/faa_mx/integ-scons/cm/scons/adacelBuilders/pseudoBuilders.py",
>> line 131:
>> action = [env.Copy(env.File(os.path.join(env['LOCALROOT'],
>> variantDirOutput, idlFile)), idlFile),
>> File "/usr/local/lib/python2.7/posixpath.py", line 68:
>> if b.startswith('/'):
>> File "/usr/local/lib/scons-2.5.1/SCons/Node/FS.py", line 682:
>> (self.__class__, attr))
>>
>>
>> On Fri, Mar 16, 2018 at 11:21 AM, Bill Deegan <bill at baddogconsulting.com>
>> wrote:
>>
>>> From manpage:
>>>
>>> Builder methods that can be called without an explicit environment may
>>> be called from custom Python modules that you import into an SConscript
>>> file by adding the following to the Python module:
>>>
>>> from SCons.Script import *
>>>
>>>
>>>
>>> On Fri, Mar 16, 2018 at 11:16 AM, Pierre-Luc Boily <
>>> pierreluc.boily at gmail.com> wrote:
>>>
>>>> But then I have : NameError: global name 'Copy' is not defined:
>>>>
>>>> And I can`t use env.Copy, because it refers to a deprecated function.
>>>>
>>>> I really think it is related with the fact that def
>>>> compile_idl_files(env): function is outside of my SConscript.
>>>>
>>>> On Fri, Mar 16, 2018 at 11:13 AM, Bill Deegan <
>>>> bill at baddogconsulting.com> wrote:
>>>>
>>>>> get rid of env.Execute().. you're building a list of actions, just use
>>>>> Copy.
>>>>>
>>>>> Execute means do it right now.
>>>>>
>>>>>
>>>>> On Fri, Mar 16, 2018 at 10:49 AM, Pierre-Luc Boily <
>>>>> pierreluc.boily at gmail.com> wrote:
>>>>>
>>>>>> No totally a builder, but like that :
>>>>>>
>>>>>> #In my SConscript :
>>>>>> idlGeneratedHeaders = env.compile_idl_files()
>>>>>>
>>>>>> #In my util file (I call those function pseudo-builder, they are not
>>>>>> really builder, but they actually call a builder. In this case,
>>>>>> env.Command)
>>>>>> def compile_idl_files(env):
>>>>>> """
>>>>>> Compile all the IDL with DDS idlpp tool.
>>>>>> returns the list of header files generated.
>>>>>> """
>>>>>> idlFiles = env.Glob('*.idl', exclude=['*Dcps.idl'])
>>>>>> idlGeneratedHeaders = []
>>>>>> variantDirOutput = str(env.Dir('.').path) #Where to generate .h &
>>>>>> .cpp from IDL
>>>>>> for idlFile in idlFiles:
>>>>>> tgtCpp, tgtH, ccpp = create_target_for_idl(env, idlFile)
>>>>>> idlGeneratedHeaders += tgtH + ccpp
>>>>>> env.Command(target = tgtCpp + tgtH + ccpp,
>>>>>> source = idlFile,
>>>>>> action = [env.Execute(Copy(os.path.join(env['LOCALROOT'],
>>>>>> variantDirOutput, idlFile), idlFile)),
>>>>>> 'idlpp -S -l cpp -d ' +
>>>>>> variantDirOutput + ' $SOURCE'])
>>>>>>
>>>>>> return idlGeneratedHeaders
>>>>>>
>>>>>> On Fri, Mar 16, 2018 at 10:30 AM, Bill Deegan <
>>>>>> bill at baddogconsulting.com> wrote:
>>>>>>
>>>>>>> So you want to use the Copy() action inside a builder?
>>>>>>>
>>>>>>> -Bill
>>>>>>>
>>>>>>> On Fri, Mar 16, 2018 at 9:34 AM, Pierre-Luc Boily <
>>>>>>> pierreluc.boily at gmail.com> wrote:
>>>>>>>
>>>>>>>> My SConscript contains the following code :
>>>>>>>>
>>>>>>>> Execute(Copy(os.path.join(env['LOCALROOT'], str(env.Dir('.').path),
>>>>>>>> 'MaxSim.idl'), 'MaxSim.idl'))
>>>>>>>>
>>>>>>>> In order to make my SConscript cleaner, I wanted to move this line
>>>>>>>> into a
>>>>>>>> pseudo-builder, in an utility file.
>>>>>>>>
>>>>>>>> Then, when I am calling this line :
>>>>>>>> Execute(Copy(os.path.join(env['LOCALROOT'], variantDirOutput,
>>>>>>>> str(idlFile)),
>>>>>>>> str(idlFile)))
>>>>>>>>
>>>>>>>> from my utility function, I have error:
>>>>>>>> NameError: global name 'Execute' is not defined
>>>>>>>>
>>>>>>>> I understood that because I am outside of the SConscript context,
>>>>>>>> Execute is
>>>>>>>> not recognized anymore. I then added my env, like that :
>>>>>>>> env.Execute(Copy(os.path.join(env['LOCALROOT'], variantDirOutput,
>>>>>>>> str(idlFile)), str(idlFile)))
>>>>>>>>
>>>>>>>> Now, Execute is recognized, but Copy is not. If I try to add env
>>>>>>>> to the
>>>>>>>> Copy function (env.Copy()), I now have this error : warning: The
>>>>>>>> env.Copy()
>>>>>>>> method is deprecated;
>>>>>>>>
>>>>>>>> I understand the env.Copy() is depracated, but is it possible to
>>>>>>>> use Copy
>>>>>>>> action outside the SConscript the same way I did for env.Execute?
>>>>>>>>
>>>>>>>> Thx
>>>>>>>>
>>>>>>>>
>>>>>>>>
>>>>>>>>
>>>>>>>>
>>>>>>>>
>>>>>>>>
>>>>>>>>
>>>>>>>> --
>>>>>>>> Sent from: http://scons.1086193.n5.nabble.com/Users-f16930.html
>>>>>>>> _______________________________________________
>>>>>>>> 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
>>>>>>>
>>>>>>>
>>>>>>
>>>>>> _______________________________________________
>>>>>> 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
>>>>>
>>>>>
>>>>
>>>> _______________________________________________
>>>> 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
>>>
>>>
>>
>> _______________________________________________
>> 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
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://pairlist4.pair.net/pipermail/scons-users/attachments/20180316/c8aca9b7/attachment-0001.html>
More information about the Scons-users
mailing list