Discussion:
[Scons-users] Is it possible to use Copy Action Functions outside of SConscript?
Pierre-Luc Boily
2018-03-16 13:34:06 UTC
Permalink
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
Bill Deegan
2018-03-16 14:30:25 UTC
Permalink
So you want to use the Copy() action inside a builder?

-Bill
Post by Pierre-Luc Boily
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.
Execute(Copy(os.path.join(env['LOCALROOT'], variantDirOutput,
str(idlFile)),
str(idlFile)))
NameError: global name 'Execute' is not defined
I understood that because I am outside of the SConscript context, Execute is
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
https://pairlist4.pair.net/mailman/listinfo/scons-users
Pierre-Luc Boily
2018-03-16 14:49:03 UTC
Permalink
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
Post by Bill Deegan
So you want to use the Copy() action inside a builder?
-Bill
On Fri, Mar 16, 2018 at 9:34 AM, Pierre-Luc Boily <
Post by Pierre-Luc Boily
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.
Execute(Copy(os.path.join(env['LOCALROOT'], variantDirOutput,
str(idlFile)),
str(idlFile)))
NameError: global name 'Execute' is not defined
I understood that because I am outside of the SConscript context, Execute is
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
https://pairlist4.pair.net/mailman/listinfo/scons-users
_______________________________________________
Scons-users mailing list
https://pairlist4.pair.net/mailman/listinfo/scons-users
Bill Deegan
2018-03-16 15:13:09 UTC
Permalink
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 <
Post by Pierre-Luc Boily
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)
"""
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
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
Post by Bill Deegan
So you want to use the Copy() action inside a builder?
-Bill
On Fri, Mar 16, 2018 at 9:34 AM, Pierre-Luc Boily <
Post by Pierre-Luc Boily
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.
Execute(Copy(os.path.join(env['LOCALROOT'], variantDirOutput, str(idlFile)),
str(idlFile)))
NameError: global name 'Execute' is not defined
I understood that because I am outside of the SConscript context, Execute is
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
https://pairlist4.pair.net/mailman/listinfo/scons-users
_______________________________________________
Scons-users mailing list
https://pairlist4.pair.net/mailman/listinfo/scons-users
_______________________________________________
Scons-users mailing list
https://pairlist4.pair.net/mailman/listinfo/scons-users
Pierre-Luc Boily
2018-03-16 15:16:50 UTC
Permalink
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.
Post by Bill Deegan
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 <
Post by Pierre-Luc Boily
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)
"""
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
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
Post by Bill Deegan
So you want to use the Copy() action inside a builder?
-Bill
On Fri, Mar 16, 2018 at 9:34 AM, Pierre-Luc Boily <
Post by Pierre-Luc Boily
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.
Execute(Copy(os.path.join(env['LOCALROOT'], variantDirOutput, str(idlFile)),
str(idlFile)))
NameError: global name 'Execute' is not defined
I understood that because I am outside of the SConscript context, Execute is
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
https://pairlist4.pair.net/mailman/listinfo/scons-users
_______________________________________________
Scons-users mailing list
https://pairlist4.pair.net/mailman/listinfo/scons-users
_______________________________________________
Scons-users mailing list
https://pairlist4.pair.net/mailman/listinfo/scons-users
_______________________________________________
Scons-users mailing list
https://pairlist4.pair.net/mailman/listinfo/scons-users
Bill Deegan
2018-03-16 15:21:03 UTC
Permalink
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 <
Post by Pierre-Luc Boily
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.
Post by Bill Deegan
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 <
Post by Pierre-Luc Boily
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)
"""
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
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
Post by Bill Deegan
So you want to use the Copy() action inside a builder?
-Bill
On Fri, Mar 16, 2018 at 9:34 AM, Pierre-Luc Boily <
Post by Pierre-Luc Boily
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.
Execute(Copy(os.path.join(env['LOCALROOT'], variantDirOutput, str(idlFile)),
str(idlFile)))
NameError: global name 'Execute' is not defined
I understood that because I am outside of the SConscript context, Execute is
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
https://pairlist4.pair.net/mailman/listinfo/scons-users
_______________________________________________
Scons-users mailing list
https://pairlist4.pair.net/mailman/listinfo/scons-users
_______________________________________________
Scons-users mailing list
https://pairlist4.pair.net/mailman/listinfo/scons-users
_______________________________________________
Scons-users mailing list
https://pairlist4.pair.net/mailman/listinfo/scons-users
_______________________________________________
Scons-users mailing list
https://pairlist4.pair.net/mailman/listinfo/scons-users
Pierre-Luc Boily
2018-03-16 15:56:35 UTC
Permalink
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))
Post by Bill Deegan
Builder methods that can be called without an explicit environment may be
called from custom Python modules that you import into an SConscript file
from SCons.Script import *
On Fri, Mar 16, 2018 at 11:16 AM, Pierre-Luc Boily <
Post by Pierre-Luc Boily
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.
Post by Bill Deegan
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 <
Post by Pierre-Luc Boily
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)
"""
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
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 <
Post by Bill Deegan
So you want to use the Copy() action inside a builder?
-Bill
On Fri, Mar 16, 2018 at 9:34 AM, Pierre-Luc Boily <
Post by Pierre-Luc Boily
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.
Execute(Copy(os.path.join(env['LOCALROOT'], variantDirOutput, str(idlFile)),
str(idlFile)))
NameError: global name 'Execute' is not defined
I understood that because I am outside of the SConscript context, Execute is
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
https://pairlist4.pair.net/mailman/listinfo/scons-users
_______________________________________________
Scons-users mailing list
https://pairlist4.pair.net/mailman/listinfo/scons-users
_______________________________________________
Scons-users mailing list
https://pairlist4.pair.net/mailman/listinfo/scons-users
_______________________________________________
Scons-users mailing list
https://pairlist4.pair.net/mailman/listinfo/scons-users
_______________________________________________
Scons-users mailing list
https://pairlist4.pair.net/mailman/listinfo/scons-users
_______________________________________________
Scons-users mailing list
https://pairlist4.pair.net/mailman/listinfo/scons-users
Bill Deegan
2018-03-16 16:05:18 UTC
Permalink
Not env.Copy, just Copy().

On Fri, Mar 16, 2018 at 11:56 AM, Pierre-Luc Boily <
Post by Pierre-Luc Boily
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
build()
cache = not SConscript(str(script).strip(), exports='envService
vcxprojList', variant_dir=utils.createVariantDir(envService, script),
duplicate=0)
return method(*args, **kw)
return _SConscript(self.fs, *files, **subst_kw)
exec _file_ in call_stack[-1].globals
File "/svn/localroot/faa_mx/integ-scons/fwk/dds_model/dds_model.sc",
idlGeneratedHeaders = env.compile_idl_files()
File "/svn/localroot/faa_mx/integ-scons/cm/scons/adacelBuilders/pseudoBuilders.py",
action = [env.Copy(env.File(os.path.join(env['LOCALROOT'],
variantDirOutput, idlFile)), idlFile),
(self.__class__, attr))
Post by Bill Deegan
Builder methods that can be called without an explicit environment may be
called from custom Python modules that you import into an SConscript file
from SCons.Script import *
On Fri, Mar 16, 2018 at 11:16 AM, Pierre-Luc Boily <
Post by Pierre-Luc Boily
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.
Post by Bill Deegan
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 <
Post by Pierre-Luc Boily
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)
"""
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
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 <
Post by Bill Deegan
So you want to use the Copy() action inside a builder?
-Bill
On Fri, Mar 16, 2018 at 9:34 AM, Pierre-Luc Boily <
Post by Pierre-Luc Boily
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.
Execute(Copy(os.path.join(env['LOCALROOT'], variantDirOutput, str(idlFile)),
str(idlFile)))
NameError: global name 'Execute' is not defined
I understood that because I am outside of the SConscript context, Execute is
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
https://pairlist4.pair.net/mailman/listinfo/scons-users
_______________________________________________
Scons-users mailing list
https://pairlist4.pair.net/mailman/listinfo/scons-users
_______________________________________________
Scons-users mailing list
https://pairlist4.pair.net/mailman/listinfo/scons-users
_______________________________________________
Scons-users mailing list
https://pairlist4.pair.net/mailman/listinfo/scons-users
_______________________________________________
Scons-users mailing list
https://pairlist4.pair.net/mailman/listinfo/scons-users
_______________________________________________
Scons-users mailing list
https://pairlist4.pair.net/mailman/listinfo/scons-users
_______________________________________________
Scons-users mailing list
https://pairlist4.pair.net/mailman/listinfo/scons-users
Pierre-Luc Boily
2018-03-16 16:10:31 UTC
Permalink
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))
Post by Bill Deegan
Not env.Copy, just Copy().
On Fri, Mar 16, 2018 at 11:56 AM, Pierre-Luc Boily <
Post by Pierre-Luc Boily
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
build()
cache = not SConscript(str(script).strip(), exports='envService
vcxprojList', variant_dir=utils.createVariantDir(envService, script),
duplicate=0)
return method(*args, **kw)
return _SConscript(self.fs, *files, **subst_kw)
exec _file_ in call_stack[-1].globals
File "/svn/localroot/faa_mx/integ-scons/fwk/dds_model/dds_model.sc",
idlGeneratedHeaders = env.compile_idl_files()
File "/svn/localroot/faa_mx/integ-scons/cm/scons/adacelBuilders/pseudoBuilders.py",
action = [env.Copy(env.File(os.path.join(env['LOCALROOT'],
variantDirOutput, idlFile)), idlFile),
(self.__class__, attr))
Post by Bill Deegan
Builder methods that can be called without an explicit environment may
be called from custom Python modules that you import into an SConscript
from SCons.Script import *
On Fri, Mar 16, 2018 at 11:16 AM, Pierre-Luc Boily <
Post by Pierre-Luc Boily
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 <
Post by Bill Deegan
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 <
Post by Pierre-Luc Boily
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)
"""
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
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 <
Post by Bill Deegan
So you want to use the Copy() action inside a builder?
-Bill
On Fri, Mar 16, 2018 at 9:34 AM, Pierre-Luc Boily <
Post by Pierre-Luc Boily
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.
Execute(Copy(os.path.join(env['LOCALROOT'], variantDirOutput, str(idlFile)),
str(idlFile)))
NameError: global name 'Execute' is not defined
I understood that because I am outside of the SConscript context, Execute is
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
https://pairlist4.pair.net/mailman/listinfo/scons-users
_______________________________________________
Scons-users mailing list
https://pairlist4.pair.net/mailman/listinfo/scons-users
_______________________________________________
Scons-users mailing list
https://pairlist4.pair.net/mailman/listinfo/scons-users
_______________________________________________
Scons-users mailing list
https://pairlist4.pair.net/mailman/listinfo/scons-users
_______________________________________________
Scons-users mailing list
https://pairlist4.pair.net/mailman/listinfo/scons-users
_______________________________________________
Scons-users mailing list
https://pairlist4.pair.net/mailman/listinfo/scons-users
_______________________________________________
Scons-users mailing list
https://pairlist4.pair.net/mailman/listinfo/scons-users
_______________________________________________
Scons-users mailing list
https://pairlist4.pair.net/mailman/listinfo/scons-users
Bill Deegan
2018-03-16 16:15:37 UTC
Permalink
This looks screwy to me..

action = [Copy(os.path.join(env['LOCALROOT'],
variantDirOutput, idlFile), idlFile),
'idlpp -S -l cpp -d ' + variantDirOutput + '
$SOURCE'])

Why are you building up the target file path?
Are you using duplicate=0?

Looks like you're trying to copy the source file to the variant dir, and
then calling idlpp on the source?

Why did you want add Copy in the first place?


On Fri, Mar 16, 2018 at 12:10 PM, Pierre-Luc Boily <
Post by Pierre-Luc Boily
Same error with env.Copy and Copy :\
AttributeError: <class 'SCons.Node.FS.File'> object has no attribute
build()
cache = not SConscript(str(script).strip(), exports='envService
vcxprojList', variant_dir=utils.createVariantDir(envService, script),
duplicate=0)
return method(*args, **kw)
return _SConscript(self.fs, *files, **subst_kw)
exec _file_ in call_stack[-1].globals
File "/svn/localroot/faa_mx/integ-scons/fwk/dds_model/dds_model.sc",
idlGeneratedHeaders = env.compile_idl_files()
File "/svn/localroot/faa_mx/integ-scons/cm/scons/adacelBuilders/pseudoBuilders.py",
action = [Copy(os.path.join(env['LOCALROOT'], variantDirOutput,
idlFile), idlFile),
(self.__class__, attr))
Post by Bill Deegan
Not env.Copy, just Copy().
On Fri, Mar 16, 2018 at 11:56 AM, Pierre-Luc Boily <
Post by Pierre-Luc Boily
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
build()
cache = not SConscript(str(script).strip(), exports='envService
vcxprojList', variant_dir=utils.createVariantDir(envService, script),
duplicate=0)
return method(*args, **kw)
return _SConscript(self.fs, *files, **subst_kw)
exec _file_ in call_stack[-1].globals
File "/svn/localroot/faa_mx/integ-scons/fwk/dds_model/dds_model.sc",
idlGeneratedHeaders = env.compile_idl_files()
File "/svn/localroot/faa_mx/integ-scons/cm/scons/adacelBuilders/pseudoBuilders.py",
action = [env.Copy(env.File(os.path.join(env['LOCALROOT'],
variantDirOutput, idlFile)), idlFile),
(self.__class__, attr))
Post by Bill Deegan
Builder methods that can be called without an explicit environment may
be called from custom Python modules that you import into an SConscript
from SCons.Script import *
On Fri, Mar 16, 2018 at 11:16 AM, Pierre-Luc Boily <
Post by Pierre-Luc Boily
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 <
Post by Bill Deegan
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 <
Post by Pierre-Luc Boily
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)
"""
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
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 <
Post by Bill Deegan
So you want to use the Copy() action inside a builder?
-Bill
On Fri, Mar 16, 2018 at 9:34 AM, Pierre-Luc Boily <
Post by Pierre-Luc Boily
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.
Execute(Copy(os.path.join(env['LOCALROOT'], variantDirOutput,
str(idlFile)),
str(idlFile)))
NameError: global name 'Execute' is not defined
I understood that because I am outside of the SConscript context,
Execute is
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
https://pairlist4.pair.net/mailman/listinfo/scons-users
_______________________________________________
Scons-users mailing list
https://pairlist4.pair.net/mailman/listinfo/scons-users
_______________________________________________
Scons-users mailing list
https://pairlist4.pair.net/mailman/listinfo/scons-users
_______________________________________________
Scons-users mailing list
https://pairlist4.pair.net/mailman/listinfo/scons-users
_______________________________________________
Scons-users mailing list
https://pairlist4.pair.net/mailman/listinfo/scons-users
_______________________________________________
Scons-users mailing list
https://pairlist4.pair.net/mailman/listinfo/scons-users
_______________________________________________
Scons-users mailing list
https://pairlist4.pair.net/mailman/listinfo/scons-users
_______________________________________________
Scons-users mailing list
https://pairlist4.pair.net/mailman/listinfo/scons-users
_______________________________________________
Scons-users mailing list
https://pairlist4.pair.net/mailman/listinfo/scons-users
Pierre-Luc Boily
2018-03-16 16:34:58 UTC
Permalink
It is screwy I agree with you :)

We have two different version of open splice, one on windows and one on
linux.

When scons invoke
'idlpp -S -l cpp -d ' + variantDirOutput + ' $SOURCE'
on windows, there is no problem, it works

When scons invoke the same command on linux, I get the following error :
idlpp -S -l cpp -d build/debug/fwk/dds_model fwk/dds_model/MaxSim.idl
"build/debug/fwk/dds_model/MaxSimDcps.idl", line 7: can't find include file
MaxSim.idl

As you can see the opensplice version of linux doesn't like the variantdir,
he is not aware of MaxSim.idl, located in src dir. This is the reason why
I am trying to copy the source MaxSim.idl to the variant dir.

Now, this bring back the question of duplicate=0. Yes, when I am calling
my SConscript, I am giving duplicate=0. In this unique case, duplicate=1
should work I guess, but it is unfortunately not a solution in our current
architecture. We have a top down approach where all SConscript are blindly
called from the SConstruct with duplicate=0 . SConstruct has no clues which
env is needed, he gives a class containing multiple env and SConscript
takes the decision which env to take. All decisional stuff are inside
SConscript

This serve us well so far. We just migrated a project containing almost
600 make files. That is the only case were duplicate=1 would be needed.
So, you have the full context of my screwy fix =)
Post by Bill Deegan
This looks screwy to me..
action = [Copy(os.path.join(env['LOCALROOT'],
variantDirOutput, idlFile), idlFile),
'idlpp -S -l cpp -d ' + variantDirOutput + '
$SOURCE'])
Why are you building up the target file path?
Are you using duplicate=0?
Looks like you're trying to copy the source file to the variant dir, and
then calling idlpp on the source?
Why did you want add Copy in the first place?
On Fri, Mar 16, 2018 at 12:10 PM, Pierre-Luc Boily <
Post by Pierre-Luc Boily
Same error with env.Copy and Copy :\
AttributeError: <class 'SCons.Node.FS.File'> object has no attribute
build()
cache = not SConscript(str(script).strip(), exports='envService
vcxprojList', variant_dir=utils.createVariantDir(envService, script),
duplicate=0)
return method(*args, **kw)
return _SConscript(self.fs, *files, **subst_kw)
exec _file_ in call_stack[-1].globals
File "/svn/localroot/faa_mx/integ-scons/fwk/dds_model/dds_model.sc",
idlGeneratedHeaders = env.compile_idl_files()
File "/svn/localroot/faa_mx/integ-scons/cm/scons/adacelBuilders/pseudoBuilders.py",
action = [Copy(os.path.join(env['LOCALROOT'], variantDirOutput,
idlFile), idlFile),
(self.__class__, attr))
Post by Bill Deegan
Not env.Copy, just Copy().
On Fri, Mar 16, 2018 at 11:56 AM, Pierre-Luc Boily <
Post by Pierre-Luc Boily
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
build()
cache = not SConscript(str(script).strip(), exports='envService
vcxprojList', variant_dir=utils.createVariantDir(envService, script),
duplicate=0)
return method(*args, **kw)
return _SConscript(self.fs, *files, **subst_kw)
exec _file_ in call_stack[-1].globals
File "/svn/localroot/faa_mx/integ-scons/fwk/dds_model/dds_model.sc",
idlGeneratedHeaders = env.compile_idl_files()
File "/svn/localroot/faa_mx/integ-scons/cm/scons/adacelBuilders/pseudoBuilders.py",
action = [env.Copy(env.File(os.path.join(env['LOCALROOT'],
variantDirOutput, idlFile)), idlFile),
(self.__class__, attr))
On Fri, Mar 16, 2018 at 11:21 AM, Bill Deegan <
Post by Bill Deegan
Builder methods that can be called without an explicit environment may
be called from custom Python modules that you import into an SConscript
from SCons.Script import *
On Fri, Mar 16, 2018 at 11:16 AM, Pierre-Luc Boily <
Post by Pierre-Luc Boily
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 <
Post by Bill Deegan
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 <
Post by Pierre-Luc Boily
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)
"""
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
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 <
Post by Bill Deegan
So you want to use the Copy() action inside a builder?
-Bill
On Fri, Mar 16, 2018 at 9:34 AM, Pierre-Luc Boily <
Post by Pierre-Luc Boily
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.
Execute(Copy(os.path.join(env['LOCALROOT'], variantDirOutput,
str(idlFile)),
str(idlFile)))
NameError: global name 'Execute' is not defined
I understood that because I am outside of the SConscript context,
Execute is
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
https://pairlist4.pair.net/mailman/listinfo/scons-users
_______________________________________________
Scons-users mailing list
https://pairlist4.pair.net/mailman/listinfo/scons-users
_______________________________________________
Scons-users mailing list
https://pairlist4.pair.net/mailman/listinfo/scons-users
_______________________________________________
Scons-users mailing list
https://pairlist4.pair.net/mailman/listinfo/scons-users
_______________________________________________
Scons-users mailing list
https://pairlist4.pair.net/mailman/listinfo/scons-users
_______________________________________________
Scons-users mailing list
https://pairlist4.pair.net/mailman/listinfo/scons-users
_______________________________________________
Scons-users mailing list
https://pairlist4.pair.net/mailman/listinfo/scons-users
_______________________________________________
Scons-users mailing list
https://pairlist4.pair.net/mailman/listinfo/scons-users
_______________________________________________
Scons-users mailing list
https://pairlist4.pair.net/mailman/listinfo/scons-users
_______________________________________________
Scons-users mailing list
https://pairlist4.pair.net/mailman/listinfo/scons-users
Matthew Marinets
2018-03-16 16:40:36 UTC
Permalink
The SCons Copy() action factory is in SCons/Defaults.py, defined on line 272. I think you just need to import it from there.

(make sure SCons-3.0.0 is in your PYTHONPATH)
From SCons.Defaults import Copy

And you should be able to use it.

If that doesn’t work, try importing the copy_func function from the same place and building Copy() from it, just copy-paste the four lines starting from ln. 272 of Defaults.py into the top of your module

I’m using SCons 3.0.0 (if the directory didn’t make it obvious), but the solution should be similar in other versions.

Hope this helps

-Matthew

From: Scons-users [mailto:scons-users-***@scons.org] On Behalf Of Pierre-Luc Boily
Sent: March 16, 2018 09:35
To: SCons users mailing list <scons-***@scons.org>
Subject: Re: [Scons-users] Is it possible to use Copy Action Functions outside of SConscript?

It is screwy I agree with you :)

We have two different version of open splice, one on windows and one on linux.

When scons invoke
'idlpp -S -l cpp -d ' + variantDirOutput + ' $SOURCE'
on windows, there is no problem, it works

When scons invoke the same command on linux, I get the following error :
idlpp -S -l cpp -d build/debug/fwk/dds_model fwk/dds_model/MaxSim.idl
"build/debug/fwk/dds_model/MaxSimDcps.idl", line 7: can't find include file MaxSim.idl

As you can see the opensplice version of linux doesn't like the variantdir, he is not aware of MaxSim.idl, located in src dir. This is the reason why I am trying to copy the source MaxSim.idl to the variant dir.

Now, this bring back the question of duplicate=0. Yes, when I am calling my SConscript, I am giving duplicate=0. In this unique case, duplicate=1 should work I guess, but it is unfortunately not a solution in our current architecture. We have a top down approach where all SConscript are blindly called from the SConstruct with duplicate=0 . SConstruct has no clues which env is needed, he gives a class containing multiple env and SConscript takes the decision which env to take. All decisional stuff are inside SConscript

This serve us well so far. We just migrated a project containing almost 600 make files. That is the only case were duplicate=1 would be needed. So, you have the full context of my screwy fix =)



On Fri, Mar 16, 2018 at 12:15 PM, Bill Deegan <***@baddogconsulting.com<mailto:***@baddogconsulting.com>> wrote:
This looks screwy to me..

action = [Copy(os.path.join(env['LOCALROOT'], variantDirOutput, idlFile), idlFile),
'idlpp -S -l cpp -d ' + variantDirOutput + ' $SOURCE'])

Why are you building up the target file path?
Are you using duplicate=0?

Looks like you're trying to copy the source file to the variant dir, and then calling idlpp on the source?

Why did you want add Copy in the first place?


On Fri, Mar 16, 2018 at 12:10 PM, Pierre-Luc Boily <***@gmail.com<mailto:***@gmail.com>> wrote:
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<http://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 <***@baddogconsulting.com<mailto:***@baddogconsulting.com>> wrote:
Not env.Copy, just Copy().

On Fri, Mar 16, 2018 at 11:56 AM, Pierre-Luc Boily <***@gmail.com<mailto:***@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<http://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 <***@baddogconsulting.com<mailto:***@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 <***@gmail.com<mailto:***@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 <***@baddogconsulting.com<mailto:***@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 <***@gmail.com<mailto:***@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 <***@baddogconsulting.com<mailto:***@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 <***@gmail.com<mailto:***@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-***@scons.org<mailto:Scons-***@scons.org>
https://pairlist4.pair.net/mailman/listinfo/scons-users


_______________________________________________
Scons-users mailing list
Scons-***@scons.org<mailto:Scons-***@scons.org>
https://pairlist4.pair.net/mailman/listinfo/scons-users


_______________________________________________
Scons-users mailing list
Scons-***@scons.org<mailto:Scons-***@scons.org>
https://pairlist4.pair.net/mailman/listinfo/scons-users


_______________________________________________
Scons-users mailing list
Scons-***@scons.org<mailto:Scons-***@scons.org>
https://pairlist4.pair.net/mailman/listinfo/scons-users


_______________________________________________
Scons-users mailing list
Scons-***@scons.org<mailto:Scons-***@scons.org>
https://pairlist4.pair.net/mailman/listinfo/scons-users


_______________________________________________
Scons-users mailing list
Scons-***@scons.org<mailto:Scons-***@scons.org>
https://pairlist4.pair.net/mailman/listinfo/scons-users


_______________________________________________
Scons-users mailing list
Scons-***@scons.org<mailto:Scons-***@scons.org>
https://pairlist4.pair.net/mailman/listinfo/scons-users


_______________________________________________
Scons-users mailing list
Scons-***@scons.org<mailto:Scons-***@scons.org>
https://pairlist4.pair.net/mailman/listinfo/scons-users


_______________________________________________
Scons-users mailing list
Scons-***@scons.org<mailto:Scons-***@scons.org>
https://pairlist4.pair.net/mailman/listinfo/scons-users


_______________________________________________
Scons-users mailing list
Scons-***@scons.org<mailto:Scons-***@scons.org>
https://pairlist4.pair.net/mailman/listinfo/scons-users
Pierre-Luc Boily
2018-03-16 17:21:58 UTC
Permalink
I tried both solutions but still no luck. It appears that scons does not
like the Copy inside the Command builder :

env.Command(target = tgtCpp + tgtH + ccpp,
source = idlFile,
action = [Copy(os.path.join(env['LOCALROOT'],
variantDirOutput, idlFile), idlFile),
'idlpp -S -l cpp -d ' + variantDirOutput + '
$SOURCE'])

I am am calling directly

Copy(os.path.join(env['LOCALROOT'], str(env.Dir('.').path), 'MaxSim.idl'),
Glob('*.idl')[0])

scons is OK

On Fri, Mar 16, 2018 at 12:40 PM, Matthew Marinets <
Post by Matthew Marinets
The SCons Copy() action factory is in SCons/Defaults.py, defined on line
272. I think you just need to import it from there.
(make sure SCons-3.0.0 is in your PYTHONPATH)
From SCons.Defaults import Copy
And you should be able to use it.
If that doesn’t work, try importing the copy_func function from the same
place and building Copy() from it, just copy-paste the four lines starting
from ln. 272 of Defaults.py into the top of your module
I’m using SCons 3.0.0 (if the directory didn’t make it obvious), but the
solution should be similar in other versions.
Hope this helps
-Matthew
Boily
*Sent:* March 16, 2018 09:35
*Subject:* Re: [Scons-users] Is it possible to use Copy Action Functions
outside of SConscript?
It is screwy I agree with you :)
We have two different version of open splice, one on windows and one on linux.
When scons invoke
'idlpp -S -l cpp -d ' + variantDirOutput + ' $SOURCE'
on windows, there is no problem, it works
idlpp -S -l cpp -d build/debug/fwk/dds_model fwk/dds_model/MaxSim.idl
"build/debug/fwk/dds_model/MaxSimDcps.idl", line 7: can't find include file MaxSim.idl
As you can see the opensplice version of linux doesn't like the
variantdir, he is not aware of MaxSim.idl, located in src dir. This is the
reason why I am trying to copy the source MaxSim.idl to the variant dir.
Now, this bring back the question of duplicate=0. Yes, when I am calling
my SConscript, I am giving duplicate=0. In this unique case, duplicate=1
should work I guess, but it is unfortunately not a solution in our current
architecture. We have a top down approach where all SConscript are blindly
called from the SConstruct with duplicate=0 . SConstruct has no clues
which env is needed, he gives a class containing multiple env and
SConscript takes the decision which env to take. All decisional stuff are
inside SConscript
This serve us well so far. We just migrated a project containing almost
600 make files. That is the only case were duplicate=1 would be needed.
So, you have the full context of my screwy fix =)
This looks screwy to me..
action = [Copy(os.path.join(env['LOCALROOT'],
variantDirOutput, idlFile), idlFile),
'idlpp -S -l cpp -d ' + variantDirOutput + ' $SOURCE'])
Why are you building up the target file path?
Are you using duplicate=0?
Looks like you're trying to copy the source file to the variant dir, and
then calling idlpp on the source?
Why did you want add Copy in the first place?
On Fri, Mar 16, 2018 at 12:10 PM, Pierre-Luc Boily <
Same error with env.Copy and Copy :\
build()
cache = not SConscript(str(script).strip(), exports='envService
vcxprojList', variant_dir=utils.createVariantDir(envService, script),
duplicate=0)
return method(*args, **kw)
return _SConscript(self.fs, *files, **subst_kw)
exec _file_ in call_stack[-1].globals
File "/svn/localroot/faa_mx/integ-scons/fwk/dds_model/dds_model.sc",
idlGeneratedHeaders = env.compile_idl_files()
File "/svn/localroot/faa_mx/integ-scons/cm/scons/adacelBuilders/pseudoBuilders.py",
action = [Copy(os.path.join(env['LOCALROOT'], variantDirOutput, idlFile), idlFile),
(self.__class__, attr))
Not env.Copy, just Copy().
On Fri, Mar 16, 2018 at 11:56 AM, Pierre-Luc Boily <
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.
build()
cache = not SConscript(str(script).strip(), exports='envService
vcxprojList', variant_dir=utils.createVariantDir(envService, script),
duplicate=0)
return method(*args, **kw)
return _SConscript(self.fs, *files, **subst_kw)
exec _file_ in call_stack[-1].globals
File "/svn/localroot/faa_mx/integ-scons/fwk/dds_model/dds_model.sc",
idlGeneratedHeaders = env.compile_idl_files()
File "/svn/localroot/faa_mx/integ-scons/cm/scons/adacelBuilders/pseudoBuilders.py",
action = [env.Copy(env.File(os.path.join(env['LOCALROOT'],
variantDirOutput, idlFile)), idlFile),
(self.__class__, attr))
Builder methods that can be called without an explicit environment may be
called from custom Python modules that you import into an SConscript file
from SCons.Script import *
On Fri, Mar 16, 2018 at 11:16 AM, Pierre-Luc Boily <
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.
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 <
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)
"""
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
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
So you want to use the Copy() action inside a builder?
-Bill
On Fri, Mar 16, 2018 at 9:34 AM, Pierre-Luc Boily <
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.
Execute(Copy(os.path.join(env['LOCALROOT'], variantDirOutput,
str(idlFile)),
str(idlFile)))
NameError: global name 'Execute' is not defined
I understood that because I am outside of the SConscript context, Execute is
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
https://pairlist4.pair.net/mailman/listinfo/scons-users
_______________________________________________
Scons-users mailing list
https://pairlist4.pair.net/mailman/listinfo/scons-users
_______________________________________________
Scons-users mailing list
https://pairlist4.pair.net/mailman/listinfo/scons-users
_______________________________________________
Scons-users mailing list
https://pairlist4.pair.net/mailman/listinfo/scons-users
_______________________________________________
Scons-users mailing list
https://pairlist4.pair.net/mailman/listinfo/scons-users
_______________________________________________
Scons-users mailing list
https://pairlist4.pair.net/mailman/listinfo/scons-users
_______________________________________________
Scons-users mailing list
https://pairlist4.pair.net/mailman/listinfo/scons-users
_______________________________________________
Scons-users mailing list
https://pairlist4.pair.net/mailman/listinfo/scons-users
_______________________________________________
Scons-users mailing list
https://pairlist4.pair.net/mailman/listinfo/scons-users
_______________________________________________
Scons-users mailing list
https://pairlist4.pair.net/mailman/listinfo/scons-users
_______________________________________________
Scons-users mailing list
https://pairlist4.pair.net/mailman/listinfo/scons-users
Bill Deegan
2018-03-16 17:34:32 UTC
Permalink
what does the -d argument do?
-Bill
Post by Pierre-Luc Boily
I tried both solutions but still no luck. It appears that scons does not
env.Command(target = tgtCpp + tgtH + ccpp,
source = idlFile,
action = [Copy(os.path.join(env['LOCALROOT'],
variantDirOutput, idlFile), idlFile),
'idlpp -S -l cpp -d ' + variantDirOutput + ' $SOURCE'])
I am am calling directly
Copy(os.path.join(env['LOCALROOT'], str(env.Dir('.').path),
'MaxSim.idl'), Glob('*.idl')[0])
scons is OK
On Fri, Mar 16, 2018 at 12:40 PM, Matthew Marinets <
Post by Matthew Marinets
The SCons Copy() action factory is in SCons/Defaults.py, defined on line
272. I think you just need to import it from there.
(make sure SCons-3.0.0 is in your PYTHONPATH)
From SCons.Defaults import Copy
And you should be able to use it.
If that doesn’t work, try importing the copy_func function from the same
place and building Copy() from it, just copy-paste the four lines starting
from ln. 272 of Defaults.py into the top of your module
I’m using SCons 3.0.0 (if the directory didn’t make it obvious), but the
solution should be similar in other versions.
Hope this helps
-Matthew
*Pierre-Luc Boily
*Sent:* March 16, 2018 09:35
*Subject:* Re: [Scons-users] Is it possible to use Copy Action Functions
outside of SConscript?
It is screwy I agree with you :)
We have two different version of open splice, one on windows and one on linux.
When scons invoke
'idlpp -S -l cpp -d ' + variantDirOutput + ' $SOURCE'
on windows, there is no problem, it works
idlpp -S -l cpp -d build/debug/fwk/dds_model fwk/dds_model/MaxSim.idl
"build/debug/fwk/dds_model/MaxSimDcps.idl", line 7: can't find include file MaxSim.idl
As you can see the opensplice version of linux doesn't like the
variantdir, he is not aware of MaxSim.idl, located in src dir. This is the
reason why I am trying to copy the source MaxSim.idl to the variant dir.
Now, this bring back the question of duplicate=0. Yes, when I am calling
my SConscript, I am giving duplicate=0. In this unique case, duplicate=1
should work I guess, but it is unfortunately not a solution in our current
architecture. We have a top down approach where all SConscript are blindly
called from the SConstruct with duplicate=0 . SConstruct has no clues
which env is needed, he gives a class containing multiple env and
SConscript takes the decision which env to take. All decisional stuff are
inside SConscript
This serve us well so far. We just migrated a project containing almost
600 make files. That is the only case were duplicate=1 would be needed.
So, you have the full context of my screwy fix =)
This looks screwy to me..
action = [Copy(os.path.join(env['LOCALROOT'],
variantDirOutput, idlFile), idlFile),
'idlpp -S -l cpp -d ' + variantDirOutput + ' $SOURCE'])
Why are you building up the target file path?
Are you using duplicate=0?
Looks like you're trying to copy the source file to the variant dir, and
then calling idlpp on the source?
Why did you want add Copy in the first place?
On Fri, Mar 16, 2018 at 12:10 PM, Pierre-Luc Boily <
Same error with env.Copy and Copy :\
build()
cache = not SConscript(str(script).strip(), exports='envService
vcxprojList', variant_dir=utils.createVariantDir(envService, script),
duplicate=0)
return method(*args, **kw)
return _SConscript(self.fs, *files, **subst_kw)
exec _file_ in call_stack[-1].globals
File "/svn/localroot/faa_mx/integ-scons/fwk/dds_model/dds_model.sc",
idlGeneratedHeaders = env.compile_idl_files()
File "/svn/localroot/faa_mx/integ-scons/cm/scons/adacelBuilders/pseudoBuilders.py",
action = [Copy(os.path.join(env['LOCALROOT'], variantDirOutput, idlFile), idlFile),
(self.__class__, attr))
Not env.Copy, just Copy().
On Fri, Mar 16, 2018 at 11:56 AM, Pierre-Luc Boily <
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.
build()
cache = not SConscript(str(script).strip(), exports='envService
vcxprojList', variant_dir=utils.createVariantDir(envService, script),
duplicate=0)
return method(*args, **kw)
return _SConscript(self.fs, *files, **subst_kw)
exec _file_ in call_stack[-1].globals
File "/svn/localroot/faa_mx/integ-scons/fwk/dds_model/dds_model.sc",
idlGeneratedHeaders = env.compile_idl_files()
File "/svn/localroot/faa_mx/integ-scons/cm/scons/adacelBuilders/pseudoBuilders.py",
action = [env.Copy(env.File(os.path.join(env['LOCALROOT'],
variantDirOutput, idlFile)), idlFile),
(self.__class__, attr))
Builder methods that can be called without an explicit environment may be
called from custom Python modules that you import into an SConscript file
from SCons.Script import *
On Fri, Mar 16, 2018 at 11:16 AM, Pierre-Luc Boily <
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.
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 <
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)
"""
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
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
So you want to use the Copy() action inside a builder?
-Bill
On Fri, Mar 16, 2018 at 9:34 AM, Pierre-Luc Boily <
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.
Execute(Copy(os.path.join(env['LOCALROOT'], variantDirOutput,
str(idlFile)),
str(idlFile)))
NameError: global name 'Execute' is not defined
I understood that because I am outside of the SConscript context, Execute is
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
https://pairlist4.pair.net/mailman/listinfo/scons-users
_______________________________________________
Scons-users mailing list
https://pairlist4.pair.net/mailman/listinfo/scons-users
_______________________________________________
Scons-users mailing list
https://pairlist4.pair.net/mailman/listinfo/scons-users
_______________________________________________
Scons-users mailing list
https://pairlist4.pair.net/mailman/listinfo/scons-users
_______________________________________________
Scons-users mailing list
https://pairlist4.pair.net/mailman/listinfo/scons-users
_______________________________________________
Scons-users mailing list
https://pairlist4.pair.net/mailman/listinfo/scons-users
_______________________________________________
Scons-users mailing list
https://pairlist4.pair.net/mailman/listinfo/scons-users
_______________________________________________
Scons-users mailing list
https://pairlist4.pair.net/mailman/listinfo/scons-users
_______________________________________________
Scons-users mailing list
https://pairlist4.pair.net/mailman/listinfo/scons-users
_______________________________________________
Scons-users mailing list
https://pairlist4.pair.net/mailman/listinfo/scons-users
_______________________________________________
Scons-users mailing list
https://pairlist4.pair.net/mailman/listinfo/scons-users
_______________________________________________
Scons-users mailing list
https://pairlist4.pair.net/mailman/listinfo/scons-users
Matthew Marinets
2018-03-16 17:43:09 UTC
Permalink
I got it working in a minimal case, maybe you could take a look at what I did:

SConstruct:


env = Environment()

from ExtraModule import generate

generate( env )

src = Dir( 'src' )
build = Dir( 'build' )

env.CustomCopy( target = build.File( 'someFile.txt' ),
source = src.File( 'someFile.txt' ) )

ExtraModule.py:

from SCons.Defaults import Copy
import SCons.Builder

def customAction( target, source, env, for_signature ):
return [Copy( str(target[0]), str(source[0]) )]

def generate( env ):
customActionBuilder = SCons.Builder.Builder( generator = customAction )
env.Append( BUILDERS = {'CustomCopy': customActionBuilder} )

obviously, there’s a file called “someFile.txt” in the src directory. Again, I’m using SCons 3.0.0, Python 2.7

-Matthew


From: Scons-users [mailto:scons-users-***@scons.org] On Behalf Of Bill Deegan
Sent: March 16, 2018 10:35
To: SCons users mailing list <scons-***@scons.org>
Subject: Re: [Scons-users] Is it possible to use Copy Action Functions outside of SConscript?

what does the -d argument do?
-Bill

On Fri, Mar 16, 2018 at 1:21 PM, Pierre-Luc Boily <***@gmail.com<mailto:***@gmail.com>> wrote:
I tried both solutions but still no luck. It appears that scons does not like the Copy inside the Command builder :

env.Command(target = tgtCpp + tgtH + ccpp,
source = idlFile,
action = [Copy(os.path.join(env['LOCALROOT'], variantDirOutput, idlFile), idlFile),
'idlpp -S -l cpp -d ' + variantDirOutput + ' $SOURCE'])

I am am calling directly

Copy(os.path.join(env['LOCALROOT'], str(env.Dir('.').path), 'MaxSim.idl'), Glob('*.idl')[0])

scons is OK

On Fri, Mar 16, 2018 at 12:40 PM, Matthew Marinets <***@kardium.com<mailto:***@kardium.com>> wrote:
The SCons Copy() action factory is in SCons/Defaults.py, defined on line 272. I think you just need to import it from there.

(make sure SCons-3.0.0 is in your PYTHONPATH)
From SCons.Defaults import Copy

And you should be able to use it.

If that doesn’t work, try importing the copy_func function from the same place and building Copy() from it, just copy-paste the four lines starting from ln. 272 of Defaults.py into the top of your module

I’m using SCons 3.0.0 (if the directory didn’t make it obvious), but the solution should be similar in other versions.

Hope this helps

-Matthew

From: Scons-users [mailto:scons-users-***@scons.org<mailto:scons-users-***@scons.org>] On Behalf Of Pierre-Luc Boily
Sent: March 16, 2018 09:35
To: SCons users mailing list <scons-***@scons.org<mailto:scons-***@scons.org>>
Subject: Re: [Scons-users] Is it possible to use Copy Action Functions outside of SConscript?

It is screwy I agree with you :)

We have two different version of open splice, one on windows and one on linux.

When scons invoke
'idlpp -S -l cpp -d ' + variantDirOutput + ' $SOURCE'
on windows, there is no problem, it works

When scons invoke the same command on linux, I get the following error :
idlpp -S -l cpp -d build/debug/fwk/dds_model fwk/dds_model/MaxSim.idl
"build/debug/fwk/dds_model/MaxSimDcps.idl", line 7: can't find include file MaxSim.idl

As you can see the opensplice version of linux doesn't like the variantdir, he is not aware of MaxSim.idl, located in src dir. This is the reason why I am trying to copy the source MaxSim.idl to the variant dir.

Now, this bring back the question of duplicate=0. Yes, when I am calling my SConscript, I am giving duplicate=0. In this unique case, duplicate=1 should work I guess, but it is unfortunately not a solution in our current architecture. We have a top down approach where all SConscript are blindly called from the SConstruct with duplicate=0 . SConstruct has no clues which env is needed, he gives a class containing multiple env and SConscript takes the decision which env to take. All decisional stuff are inside SConscript

This serve us well so far. We just migrated a project containing almost 600 make files. That is the only case were duplicate=1 would be needed. So, you have the full context of my screwy fix =)



On Fri, Mar 16, 2018 at 12:15 PM, Bill Deegan <***@baddogconsulting.com<mailto:***@baddogconsulting.com>> wrote:
This looks screwy to me..

action = [Copy(os.path.join(env['LOCALROOT'], variantDirOutput, idlFile), idlFile),
'idlpp -S -l cpp -d ' + variantDirOutput + ' $SOURCE'])

Why are you building up the target file path?
Are you using duplicate=0?

Looks like you're trying to copy the source file to the variant dir, and then calling idlpp on the source?

Why did you want add Copy in the first place?


On Fri, Mar 16, 2018 at 12:10 PM, Pierre-Luc Boily <***@gmail.com<mailto:***@gmail.com>> wrote:
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<http://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 <***@baddogconsulting.com<mailto:***@baddogconsulting.com>> wrote:
Not env.Copy, just Copy().

On Fri, Mar 16, 2018 at 11:56 AM, Pierre-Luc Boily <***@gmail.com<mailto:***@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<http://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 <***@baddogconsulting.com<mailto:***@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 <***@gmail.com<mailto:***@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 <***@baddogconsulting.com<mailto:***@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 <***@gmail.com<mailto:***@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 <***@baddogconsulting.com<mailto:***@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 <***@gmail.com<mailto:***@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-***@scons.org<mailto:Scons-***@scons.org>
https://pairlist4.pair.net/mailman/listinfo/scons-users


_______________________________________________
Scons-users mailing list
Scons-***@scons.org<mailto:Scons-***@scons.org>
https://pairlist4.pair.net/mailman/listinfo/scons-users


_______________________________________________
Scons-users mailing list
Scons-***@scons.org<mailto:Scons-***@scons.org>
https://pairlist4.pair.net/mailman/listinfo/scons-users


_______________________________________________
Scons-users mailing list
Scons-***@scons.org<mailto:Scons-***@scons.org>
https://pairlist4.pair.net/mailman/listinfo/scons-users


_______________________________________________
Scons-users mailing list
Scons-***@scons.org<mailto:Scons-***@scons.org>
https://pairlist4.pair.net/mailman/listinfo/scons-users


_______________________________________________
Scons-users mailing list
Scons-***@scons.org<mailto:Scons-***@scons.org>
https://pairlist4.pair.net/mailman/listinfo/scons-users


_______________________________________________
Scons-users mailing list
Scons-***@scons.org<mailto:Scons-***@scons.org>
https://pairlist4.pair.net/mailman/listinfo/scons-users


_______________________________________________
Scons-users mailing list
Scons-***@scons.org<mailto:Scons-***@scons.org>
https://pairlist4.pair.net/mailman/listinfo/scons-users


_______________________________________________
Scons-users mailing list
Scons-***@scons.org<mailto:Scons-***@scons.org>
https://pairlist4.pair.net/mailman/listinfo/scons-users


_______________________________________________
Scons-users mailing list
Scons-***@scons.org<mailto:Scons-***@scons.org>
https://pairlist4.pair.net/mailman/listinfo/scons-users


_______________________________________________
Scons-users mailing list
Scons-***@scons.org<mailto:Scons-***@scons.org>
https://pairlist4.pair.net/mailman/listinfo/scons-users


_______________________________________________
Scons-users mailing list
Scons-***@scons.org<mailto:Scons-***@scons.org>
https://pairlist4.pair.net/mailman/listinfo/scons-users
Bill Deegan
2018-03-16 18:04:37 UTC
Permalink
See comment below.
Regardless, I think the solution for Pierre-Luc using Copy is not the right
direction..

On Fri, Mar 16, 2018 at 1:43 PM, Matthew Marinets <
Post by Matthew Marinets
env = Environment()
from ExtraModule import generate
generate( env )
src = Dir( 'src' )
build = Dir( 'build' )
env.CustomCopy( target = build.File( 'someFile.txt' ),
source = src.File( 'someFile.txt' ) )
from SCons.Defaults import Copy
import SCons.Builder
return [Copy( str(target[0]), str(source[0]) )]
^^^ - Why are you converting to string? Nodes should be fine.
Post by Matthew Marinets
customActionBuilder = SCons.Builder.Builder( generator = customAction )
env.Append( BUILDERS = {'CustomCopy': customActionBuilder} )
obviously, there’s a file called “someFile.txt” in the src directory.
Again, I’m using SCons 3.0.0, Python 2.7
-Matthew
Deegan
*Sent:* March 16, 2018 10:35
*Subject:* Re: [Scons-users] Is it possible to use Copy Action Functions
outside of SConscript?
what does the -d argument do?
-Bill
On Fri, Mar 16, 2018 at 1:21 PM, Pierre-Luc Boily <
I tried both solutions but still no luck. It appears that scons does not
env.Command(target = tgtCpp + tgtH + ccpp,
source = idlFile,
action = [Copy(os.path.join(env['LOCALROOT'],
variantDirOutput, idlFile), idlFile),
'idlpp -S -l cpp -d ' + variantDirOutput + ' $SOURCE'])
I am am calling directly
Copy(os.path.join(env['LOCALROOT'], str(env.Dir('.').path),
'MaxSim.idl'), Glob('*.idl')[0])
scons is OK
On Fri, Mar 16, 2018 at 12:40 PM, Matthew Marinets <
The SCons Copy() action factory is in SCons/Defaults.py, defined on line
272. I think you just need to import it from there.
(make sure SCons-3.0.0 is in your PYTHONPATH)
From SCons.Defaults import Copy
And you should be able to use it.
If that doesn’t work, try importing the copy_func function from the same
place and building Copy() from it, just copy-paste the four lines starting
from ln. 272 of Defaults.py into the top of your module
I’m using SCons 3.0.0 (if the directory didn’t make it obvious), but the
solution should be similar in other versions.
Hope this helps
-Matthew
Boily
*Sent:* March 16, 2018 09:35
*Subject:* Re: [Scons-users] Is it possible to use Copy Action Functions
outside of SConscript?
It is screwy I agree with you :)
We have two different version of open splice, one on windows and one on linux.
When scons invoke
'idlpp -S -l cpp -d ' + variantDirOutput + ' $SOURCE'
on windows, there is no problem, it works
idlpp -S -l cpp -d build/debug/fwk/dds_model fwk/dds_model/MaxSim.idl
"build/debug/fwk/dds_model/MaxSimDcps.idl", line 7: can't find include file MaxSim.idl
As you can see the opensplice version of linux doesn't like the
variantdir, he is not aware of MaxSim.idl, located in src dir. This is the
reason why I am trying to copy the source MaxSim.idl to the variant dir.
Now, this bring back the question of duplicate=0. Yes, when I am calling
my SConscript, I am giving duplicate=0. In this unique case, duplicate=1
should work I guess, but it is unfortunately not a solution in our current
architecture. We have a top down approach where all SConscript are blindly
called from the SConstruct with duplicate=0 . SConstruct has no clues
which env is needed, he gives a class containing multiple env and
SConscript takes the decision which env to take. All decisional stuff are
inside SConscript
This serve us well so far. We just migrated a project containing almost
600 make files. That is the only case were duplicate=1 would be needed.
So, you have the full context of my screwy fix =)
This looks screwy to me..
action = [Copy(os.path.join(env['LOCALROOT'],
variantDirOutput, idlFile), idlFile),
'idlpp -S -l cpp -d ' + variantDirOutput + ' $SOURCE'])
Why are you building up the target file path?
Are you using duplicate=0?
Looks like you're trying to copy the source file to the variant dir, and
then calling idlpp on the source?
Why did you want add Copy in the first place?
On Fri, Mar 16, 2018 at 12:10 PM, Pierre-Luc Boily <
Same error with env.Copy and Copy :\
build()
cache = not SConscript(str(script).strip(), exports='envService
vcxprojList', variant_dir=utils.createVariantDir(envService, script),
duplicate=0)
return method(*args, **kw)
return _SConscript(self.fs, *files, **subst_kw)
exec _file_ in call_stack[-1].globals
File "/svn/localroot/faa_mx/integ-scons/fwk/dds_model/dds_model.sc",
idlGeneratedHeaders = env.compile_idl_files()
File "/svn/localroot/faa_mx/integ-scons/cm/scons/adacelBuilders/pseudoBuilders.py",
action = [Copy(os.path.join(env['LOCALROOT'], variantDirOutput, idlFile), idlFile),
(self.__class__, attr))
Not env.Copy, just Copy().
On Fri, Mar 16, 2018 at 11:56 AM, Pierre-Luc Boily <
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.
build()
cache = not SConscript(str(script).strip(), exports='envService
vcxprojList', variant_dir=utils.createVariantDir(envService, script),
duplicate=0)
return method(*args, **kw)
return _SConscript(self.fs, *files, **subst_kw)
exec _file_ in call_stack[-1].globals
File "/svn/localroot/faa_mx/integ-scons/fwk/dds_model/dds_model.sc",
idlGeneratedHeaders = env.compile_idl_files()
File "/svn/localroot/faa_mx/integ-scons/cm/scons/adacelBuilders/pseudoBuilders.py",
action = [env.Copy(env.File(os.path.join(env['LOCALROOT'],
variantDirOutput, idlFile)), idlFile),
(self.__class__, attr))
Builder methods that can be called without an explicit environment may be
called from custom Python modules that you import into an SConscript file
from SCons.Script import *
On Fri, Mar 16, 2018 at 11:16 AM, Pierre-Luc Boily <
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.
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 <
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)
"""
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
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
So you want to use the Copy() action inside a builder?
-Bill
On Fri, Mar 16, 2018 at 9:34 AM, Pierre-Luc Boily <
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.
Execute(Copy(os.path.join(env['LOCALROOT'], variantDirOutput,
str(idlFile)),
str(idlFile)))
NameError: global name 'Execute' is not defined
I understood that because I am outside of the SConscript context, Execute is
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
https://pairlist4.pair.net/mailman/listinfo/scons-users
_______________________________________________
Scons-users mailing list
https://pairlist4.pair.net/mailman/listinfo/scons-users
_______________________________________________
Scons-users mailing list
https://pairlist4.pair.net/mailman/listinfo/scons-users
_______________________________________________
Scons-users mailing list
https://pairlist4.pair.net/mailman/listinfo/scons-users
_______________________________________________
Scons-users mailing list
https://pairlist4.pair.net/mailman/listinfo/scons-users
_______________________________________________
Scons-users mailing list
https://pairlist4.pair.net/mailman/listinfo/scons-users
_______________________________________________
Scons-users mailing list
https://pairlist4.pair.net/mailman/listinfo/scons-users
_______________________________________________
Scons-users mailing list
https://pairlist4.pair.net/mailman/listinfo/scons-users
_______________________________________________
Scons-users mailing list
https://pairlist4.pair.net/mailman/listinfo/scons-users
_______________________________________________
Scons-users mailing list
https://pairlist4.pair.net/mailman/listinfo/scons-users
_______________________________________________
Scons-users mailing list
https://pairlist4.pair.net/mailman/listinfo/scons-users
_______________________________________________
Scons-users mailing list
https://pairlist4.pair.net/mailman/listinfo/scons-users
_______________________________________________
Scons-users mailing list
https://pairlist4.pair.net/mailman/listinfo/scons-users
Pierre-Luc Boily
2018-03-16 18:09:08 UTC
Permalink
Bill, for your previous question regarding -d, this argument tells to idlpp
where to generate the files. I am telling to idlpp to generate the output
from MaxSim.idl into variant dir. So what happen is, a file is being
generated there :

build/debug/dds/MaxSimDcps.idl

And this generated file include MaxSim.idl. idlpp compilator complains
that he cannot find MaxSim.idl in the src dir. This is why I want to copy
it to variant dir.
Post by Bill Deegan
See comment below.
Regardless, I think the solution for Pierre-Luc using Copy is not the
right direction..
On Fri, Mar 16, 2018 at 1:43 PM, Matthew Marinets <
Post by Matthew Marinets
env = Environment()
from ExtraModule import generate
generate( env )
src = Dir( 'src' )
build = Dir( 'build' )
env.CustomCopy( target = build.File( 'someFile.txt' ),
source = src.File( 'someFile.txt' ) )
from SCons.Defaults import Copy
import SCons.Builder
return [Copy( str(target[0]), str(source[0]) )]
^^^ - Why are you converting to string? Nodes should be fine.
Post by Matthew Marinets
customActionBuilder = SCons.Builder.Builder( generator = customAction )
env.Append( BUILDERS = {'CustomCopy': customActionBuilder} )
obviously, there’s a file called “someFile.txt” in the src directory.
Again, I’m using SCons 3.0.0, Python 2.7
-Matthew
*Bill Deegan
*Sent:* March 16, 2018 10:35
*Subject:* Re: [Scons-users] Is it possible to use Copy Action Functions
outside of SConscript?
what does the -d argument do?
-Bill
On Fri, Mar 16, 2018 at 1:21 PM, Pierre-Luc Boily <
I tried both solutions but still no luck. It appears that scons does not
env.Command(target = tgtCpp + tgtH + ccpp,
source = idlFile,
action = [Copy(os.path.join(env['LOCALROOT'],
variantDirOutput, idlFile), idlFile),
'idlpp -S -l cpp -d ' + variantDirOutput + ' $SOURCE'])
I am am calling directly
Copy(os.path.join(env['LOCALROOT'], str(env.Dir('.').path),
'MaxSim.idl'), Glob('*.idl')[0])
scons is OK
On Fri, Mar 16, 2018 at 12:40 PM, Matthew Marinets <
The SCons Copy() action factory is in SCons/Defaults.py, defined on line
272. I think you just need to import it from there.
(make sure SCons-3.0.0 is in your PYTHONPATH)
From SCons.Defaults import Copy
And you should be able to use it.
If that doesn’t work, try importing the copy_func function from the same
place and building Copy() from it, just copy-paste the four lines starting
from ln. 272 of Defaults.py into the top of your module
I’m using SCons 3.0.0 (if the directory didn’t make it obvious), but the
solution should be similar in other versions.
Hope this helps
-Matthew
*Pierre-Luc Boily
*Sent:* March 16, 2018 09:35
*Subject:* Re: [Scons-users] Is it possible to use Copy Action Functions
outside of SConscript?
It is screwy I agree with you :)
We have two different version of open splice, one on windows and one on linux.
When scons invoke
'idlpp -S -l cpp -d ' + variantDirOutput + ' $SOURCE'
on windows, there is no problem, it works
idlpp -S -l cpp -d build/debug/fwk/dds_model fwk/dds_model/MaxSim.idl
"build/debug/fwk/dds_model/MaxSimDcps.idl", line 7: can't find include file MaxSim.idl
As you can see the opensplice version of linux doesn't like the
variantdir, he is not aware of MaxSim.idl, located in src dir. This is the
reason why I am trying to copy the source MaxSim.idl to the variant dir.
Now, this bring back the question of duplicate=0. Yes, when I am calling
my SConscript, I am giving duplicate=0. In this unique case, duplicate=1
should work I guess, but it is unfortunately not a solution in our current
architecture. We have a top down approach where all SConscript are blindly
called from the SConstruct with duplicate=0 . SConstruct has no clues
which env is needed, he gives a class containing multiple env and
SConscript takes the decision which env to take. All decisional stuff are
inside SConscript
This serve us well so far. We just migrated a project containing almost
600 make files. That is the only case were duplicate=1 would be needed.
So, you have the full context of my screwy fix =)
This looks screwy to me..
action = [Copy(os.path.join(env['LOCALROOT'],
variantDirOutput, idlFile), idlFile),
'idlpp -S -l cpp -d ' + variantDirOutput + ' $SOURCE'])
Why are you building up the target file path?
Are you using duplicate=0?
Looks like you're trying to copy the source file to the variant dir, and
then calling idlpp on the source?
Why did you want add Copy in the first place?
On Fri, Mar 16, 2018 at 12:10 PM, Pierre-Luc Boily <
Same error with env.Copy and Copy :\
build()
cache = not SConscript(str(script).strip(), exports='envService
vcxprojList', variant_dir=utils.createVariantDir(envService, script),
duplicate=0)
return method(*args, **kw)
return _SConscript(self.fs, *files, **subst_kw)
exec _file_ in call_stack[-1].globals
File "/svn/localroot/faa_mx/integ-scons/fwk/dds_model/dds_model.sc",
idlGeneratedHeaders = env.compile_idl_files()
File "/svn/localroot/faa_mx/integ-scons/cm/scons/adacelBuilders/pseudoBuilders.py",
action = [Copy(os.path.join(env['LOCALROOT'], variantDirOutput, idlFile), idlFile),
(self.__class__, attr))
Not env.Copy, just Copy().
On Fri, Mar 16, 2018 at 11:56 AM, Pierre-Luc Boily <
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.
build()
cache = not SConscript(str(script).strip(), exports='envService
vcxprojList', variant_dir=utils.createVariantDir(envService, script),
duplicate=0)
return method(*args, **kw)
return _SConscript(self.fs, *files, **subst_kw)
exec _file_ in call_stack[-1].globals
File "/svn/localroot/faa_mx/integ-scons/fwk/dds_model/dds_model.sc",
idlGeneratedHeaders = env.compile_idl_files()
File "/svn/localroot/faa_mx/integ-scons/cm/scons/adacelBuilders/pseudoBuilders.py",
action = [env.Copy(env.File(os.path.join(env['LOCALROOT'],
variantDirOutput, idlFile)), idlFile),
(self.__class__, attr))
Builder methods that can be called without an explicit environment may be
called from custom Python modules that you import into an SConscript file
from SCons.Script import *
On Fri, Mar 16, 2018 at 11:16 AM, Pierre-Luc Boily <
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.
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 <
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)
"""
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
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
So you want to use the Copy() action inside a builder?
-Bill
On Fri, Mar 16, 2018 at 9:34 AM, Pierre-Luc Boily <
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.
Execute(Copy(os.path.join(env['LOCALROOT'], variantDirOutput,
str(idlFile)),
str(idlFile)))
NameError: global name 'Execute' is not defined
I understood that because I am outside of the SConscript context, Execute is
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
https://pairlist4.pair.net/mailman/listinfo/scons-users
_______________________________________________
Scons-users mailing list
https://pairlist4.pair.net/mailman/listinfo/scons-users
_______________________________________________
Scons-users mailing list
https://pairlist4.pair.net/mailman/listinfo/scons-users
_______________________________________________
Scons-users mailing list
https://pairlist4.pair.net/mailman/listinfo/scons-users
_______________________________________________
Scons-users mailing list
https://pairlist4.pair.net/mailman/listinfo/scons-users
_______________________________________________
Scons-users mailing list
https://pairlist4.pair.net/mailman/listinfo/scons-users
_______________________________________________
Scons-users mailing list
https://pairlist4.pair.net/mailman/listinfo/scons-users
_______________________________________________
Scons-users mailing list
https://pairlist4.pair.net/mailman/listinfo/scons-users
_______________________________________________
Scons-users mailing list
https://pairlist4.pair.net/mailman/listinfo/scons-users
_______________________________________________
Scons-users mailing list
https://pairlist4.pair.net/mailman/listinfo/scons-users
_______________________________________________
Scons-users mailing list
https://pairlist4.pair.net/mailman/listinfo/scons-users
_______________________________________________
Scons-users mailing list
https://pairlist4.pair.net/mailman/listinfo/scons-users
_______________________________________________
Scons-users mailing list
https://pairlist4.pair.net/mailman/listinfo/scons-users
_______________________________________________
Scons-users mailing list
https://pairlist4.pair.net/mailman/listinfo/scons-users
Pierre-Luc Boily
2018-03-16 18:05:41 UTC
Permalink
Holy.... shame on me. I found what my problem is and it is so shameful !

In the line
Copy(os.path.join(env['LOCALROOT'], variantDirOutput, idlFile), idlFile ))

The problem is
os.path.join(env['LOCALROOT'], variantDirOutput, idlFile)

Where idlFile is a FS.Node file.

I was trying to join something totally incorrect! The correct syntax is
os.path.join(env['LOCALROOT'], variantDirOutput,
os.path.basename(str(idlFile))

Forgive me please!



On Fri, Mar 16, 2018 at 1:43 PM, Matthew Marinets <
Post by Matthew Marinets
env = Environment()
from ExtraModule import generate
generate( env )
src = Dir( 'src' )
build = Dir( 'build' )
env.CustomCopy( target = build.File( 'someFile.txt' ),
source = src.File( 'someFile.txt' ) )
from SCons.Defaults import Copy
import SCons.Builder
return [Copy( str(target[0]), str(source[0]) )]
customActionBuilder = SCons.Builder.Builder( generator = customAction )
env.Append( BUILDERS = {'CustomCopy': customActionBuilder} )
obviously, there’s a file called “someFile.txt” in the src directory.
Again, I’m using SCons 3.0.0, Python 2.7
-Matthew
Deegan
*Sent:* March 16, 2018 10:35
*Subject:* Re: [Scons-users] Is it possible to use Copy Action Functions
outside of SConscript?
what does the -d argument do?
-Bill
On Fri, Mar 16, 2018 at 1:21 PM, Pierre-Luc Boily <
I tried both solutions but still no luck. It appears that scons does not
env.Command(target = tgtCpp + tgtH + ccpp,
source = idlFile,
action = [Copy(os.path.join(env['LOCALROOT'],
variantDirOutput, idlFile), idlFile),
'idlpp -S -l cpp -d ' + variantDirOutput + ' $SOURCE'])
I am am calling directly
Copy(os.path.join(env['LOCALROOT'], str(env.Dir('.').path),
'MaxSim.idl'), Glob('*.idl')[0])
scons is OK
On Fri, Mar 16, 2018 at 12:40 PM, Matthew Marinets <
The SCons Copy() action factory is in SCons/Defaults.py, defined on line
272. I think you just need to import it from there.
(make sure SCons-3.0.0 is in your PYTHONPATH)
From SCons.Defaults import Copy
And you should be able to use it.
If that doesn’t work, try importing the copy_func function from the same
place and building Copy() from it, just copy-paste the four lines starting
from ln. 272 of Defaults.py into the top of your module
I’m using SCons 3.0.0 (if the directory didn’t make it obvious), but the
solution should be similar in other versions.
Hope this helps
-Matthew
Boily
*Sent:* March 16, 2018 09:35
*Subject:* Re: [Scons-users] Is it possible to use Copy Action Functions
outside of SConscript?
It is screwy I agree with you :)
We have two different version of open splice, one on windows and one on linux.
When scons invoke
'idlpp -S -l cpp -d ' + variantDirOutput + ' $SOURCE'
on windows, there is no problem, it works
idlpp -S -l cpp -d build/debug/fwk/dds_model fwk/dds_model/MaxSim.idl
"build/debug/fwk/dds_model/MaxSimDcps.idl", line 7: can't find include file MaxSim.idl
As you can see the opensplice version of linux doesn't like the
variantdir, he is not aware of MaxSim.idl, located in src dir. This is the
reason why I am trying to copy the source MaxSim.idl to the variant dir.
Now, this bring back the question of duplicate=0. Yes, when I am calling
my SConscript, I am giving duplicate=0. In this unique case, duplicate=1
should work I guess, but it is unfortunately not a solution in our current
architecture. We have a top down approach where all SConscript are blindly
called from the SConstruct with duplicate=0 . SConstruct has no clues
which env is needed, he gives a class containing multiple env and
SConscript takes the decision which env to take. All decisional stuff are
inside SConscript
This serve us well so far. We just migrated a project containing almost
600 make files. That is the only case were duplicate=1 would be needed.
So, you have the full context of my screwy fix =)
This looks screwy to me..
action = [Copy(os.path.join(env['LOCALROOT'],
variantDirOutput, idlFile), idlFile),
'idlpp -S -l cpp -d ' + variantDirOutput + ' $SOURCE'])
Why are you building up the target file path?
Are you using duplicate=0?
Looks like you're trying to copy the source file to the variant dir, and
then calling idlpp on the source?
Why did you want add Copy in the first place?
On Fri, Mar 16, 2018 at 12:10 PM, Pierre-Luc Boily <
Same error with env.Copy and Copy :\
build()
cache = not SConscript(str(script).strip(), exports='envService
vcxprojList', variant_dir=utils.createVariantDir(envService, script),
duplicate=0)
return method(*args, **kw)
return _SConscript(self.fs, *files, **subst_kw)
exec _file_ in call_stack[-1].globals
File "/svn/localroot/faa_mx/integ-scons/fwk/dds_model/dds_model.sc",
idlGeneratedHeaders = env.compile_idl_files()
File "/svn/localroot/faa_mx/integ-scons/cm/scons/adacelBuilders/pseudoBuilders.py",
action = [Copy(os.path.join(env['LOCALROOT'], variantDirOutput, idlFile), idlFile),
(self.__class__, attr))
Not env.Copy, just Copy().
On Fri, Mar 16, 2018 at 11:56 AM, Pierre-Luc Boily <
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.
build()
cache = not SConscript(str(script).strip(), exports='envService
vcxprojList', variant_dir=utils.createVariantDir(envService, script),
duplicate=0)
return method(*args, **kw)
return _SConscript(self.fs, *files, **subst_kw)
exec _file_ in call_stack[-1].globals
File "/svn/localroot/faa_mx/integ-scons/fwk/dds_model/dds_model.sc",
idlGeneratedHeaders = env.compile_idl_files()
File "/svn/localroot/faa_mx/integ-scons/cm/scons/adacelBuilders/pseudoBuilders.py",
action = [env.Copy(env.File(os.path.join(env['LOCALROOT'],
variantDirOutput, idlFile)), idlFile),
(self.__class__, attr))
Builder methods that can be called without an explicit environment may be
called from custom Python modules that you import into an SConscript file
from SCons.Script import *
On Fri, Mar 16, 2018 at 11:16 AM, Pierre-Luc Boily <
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.
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 <
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)
"""
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
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
So you want to use the Copy() action inside a builder?
-Bill
On Fri, Mar 16, 2018 at 9:34 AM, Pierre-Luc Boily <
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.
Execute(Copy(os.path.join(env['LOCALROOT'], variantDirOutput,
str(idlFile)),
str(idlFile)))
NameError: global name 'Execute' is not defined
I understood that because I am outside of the SConscript context, Execute is
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
https://pairlist4.pair.net/mailman/listinfo/scons-users
_______________________________________________
Scons-users mailing list
https://pairlist4.pair.net/mailman/listinfo/scons-users
_______________________________________________
Scons-users mailing list
https://pairlist4.pair.net/mailman/listinfo/scons-users
_______________________________________________
Scons-users mailing list
https://pairlist4.pair.net/mailman/listinfo/scons-users
_______________________________________________
Scons-users mailing list
https://pairlist4.pair.net/mailman/listinfo/scons-users
_______________________________________________
Scons-users mailing list
https://pairlist4.pair.net/mailman/listinfo/scons-users
_______________________________________________
Scons-users mailing list
https://pairlist4.pair.net/mailman/listinfo/scons-users
_______________________________________________
Scons-users mailing list
https://pairlist4.pair.net/mailman/listinfo/scons-users
_______________________________________________
Scons-users mailing list
https://pairlist4.pair.net/mailman/listinfo/scons-users
_______________________________________________
Scons-users mailing list
https://pairlist4.pair.net/mailman/listinfo/scons-users
_______________________________________________
Scons-users mailing list
https://pairlist4.pair.net/mailman/listinfo/scons-users
_______________________________________________
Scons-users mailing list
https://pairlist4.pair.net/mailman/listinfo/scons-users
_______________________________________________
Scons-users mailing list
https://pairlist4.pair.net/mailman/listinfo/scons-users
Bill Deegan
2018-03-16 18:08:02 UTC
Permalink
Likely you don't need to us os.path.join at all.

Can you construct the proper command line and the full path to source and
targets and paste.
There's likely a much simpler way to do this.
Post by Pierre-Luc Boily
Holy.... shame on me. I found what my problem is and it is so shameful !
In the line
Copy(os.path.join(env['LOCALROOT'], variantDirOutput, idlFile), idlFile ))
The problem is
os.path.join(env['LOCALROOT'], variantDirOutput, idlFile)
Where idlFile is a FS.Node file.
I was trying to join something totally incorrect! The correct syntax is
os.path.join(env['LOCALROOT'], variantDirOutput,
os.path.basename(str(idlFile))
Forgive me please!
On Fri, Mar 16, 2018 at 1:43 PM, Matthew Marinets <
Post by Matthew Marinets
env = Environment()
from ExtraModule import generate
generate( env )
src = Dir( 'src' )
build = Dir( 'build' )
env.CustomCopy( target = build.File( 'someFile.txt' ),
source = src.File( 'someFile.txt' ) )
from SCons.Defaults import Copy
import SCons.Builder
return [Copy( str(target[0]), str(source[0]) )]
customActionBuilder = SCons.Builder.Builder( generator = customAction )
env.Append( BUILDERS = {'CustomCopy': customActionBuilder} )
obviously, there’s a file called “someFile.txt” in the src directory.
Again, I’m using SCons 3.0.0, Python 2.7
-Matthew
*Bill Deegan
*Sent:* March 16, 2018 10:35
*Subject:* Re: [Scons-users] Is it possible to use Copy Action Functions
outside of SConscript?
what does the -d argument do?
-Bill
On Fri, Mar 16, 2018 at 1:21 PM, Pierre-Luc Boily <
I tried both solutions but still no luck. It appears that scons does not
env.Command(target = tgtCpp + tgtH + ccpp,
source = idlFile,
action = [Copy(os.path.join(env['LOCALROOT'],
variantDirOutput, idlFile), idlFile),
'idlpp -S -l cpp -d ' + variantDirOutput + ' $SOURCE'])
I am am calling directly
Copy(os.path.join(env['LOCALROOT'], str(env.Dir('.').path),
'MaxSim.idl'), Glob('*.idl')[0])
scons is OK
On Fri, Mar 16, 2018 at 12:40 PM, Matthew Marinets <
The SCons Copy() action factory is in SCons/Defaults.py, defined on line
272. I think you just need to import it from there.
(make sure SCons-3.0.0 is in your PYTHONPATH)
From SCons.Defaults import Copy
And you should be able to use it.
If that doesn’t work, try importing the copy_func function from the same
place and building Copy() from it, just copy-paste the four lines starting
from ln. 272 of Defaults.py into the top of your module
I’m using SCons 3.0.0 (if the directory didn’t make it obvious), but the
solution should be similar in other versions.
Hope this helps
-Matthew
*Pierre-Luc Boily
*Sent:* March 16, 2018 09:35
*Subject:* Re: [Scons-users] Is it possible to use Copy Action Functions
outside of SConscript?
It is screwy I agree with you :)
We have two different version of open splice, one on windows and one on linux.
When scons invoke
'idlpp -S -l cpp -d ' + variantDirOutput + ' $SOURCE'
on windows, there is no problem, it works
idlpp -S -l cpp -d build/debug/fwk/dds_model fwk/dds_model/MaxSim.idl
"build/debug/fwk/dds_model/MaxSimDcps.idl", line 7: can't find include file MaxSim.idl
As you can see the opensplice version of linux doesn't like the
variantdir, he is not aware of MaxSim.idl, located in src dir. This is the
reason why I am trying to copy the source MaxSim.idl to the variant dir.
Now, this bring back the question of duplicate=0. Yes, when I am calling
my SConscript, I am giving duplicate=0. In this unique case, duplicate=1
should work I guess, but it is unfortunately not a solution in our current
architecture. We have a top down approach where all SConscript are blindly
called from the SConstruct with duplicate=0 . SConstruct has no clues
which env is needed, he gives a class containing multiple env and
SConscript takes the decision which env to take. All decisional stuff are
inside SConscript
This serve us well so far. We just migrated a project containing almost
600 make files. That is the only case were duplicate=1 would be needed.
So, you have the full context of my screwy fix =)
This looks screwy to me..
action = [Copy(os.path.join(env['LOCALROOT'],
variantDirOutput, idlFile), idlFile),
'idlpp -S -l cpp -d ' + variantDirOutput + ' $SOURCE'])
Why are you building up the target file path?
Are you using duplicate=0?
Looks like you're trying to copy the source file to the variant dir, and
then calling idlpp on the source?
Why did you want add Copy in the first place?
On Fri, Mar 16, 2018 at 12:10 PM, Pierre-Luc Boily <
Same error with env.Copy and Copy :\
build()
cache = not SConscript(str(script).strip(), exports='envService
vcxprojList', variant_dir=utils.createVariantDir(envService, script),
duplicate=0)
return method(*args, **kw)
return _SConscript(self.fs, *files, **subst_kw)
exec _file_ in call_stack[-1].globals
File "/svn/localroot/faa_mx/integ-scons/fwk/dds_model/dds_model.sc",
idlGeneratedHeaders = env.compile_idl_files()
File "/svn/localroot/faa_mx/integ-scons/cm/scons/adacelBuilders/pseudoBuilders.py",
action = [Copy(os.path.join(env['LOCALROOT'], variantDirOutput, idlFile), idlFile),
(self.__class__, attr))
Not env.Copy, just Copy().
On Fri, Mar 16, 2018 at 11:56 AM, Pierre-Luc Boily <
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.
build()
cache = not SConscript(str(script).strip(), exports='envService
vcxprojList', variant_dir=utils.createVariantDir(envService, script),
duplicate=0)
return method(*args, **kw)
return _SConscript(self.fs, *files, **subst_kw)
exec _file_ in call_stack[-1].globals
File "/svn/localroot/faa_mx/integ-scons/fwk/dds_model/dds_model.sc",
idlGeneratedHeaders = env.compile_idl_files()
File "/svn/localroot/faa_mx/integ-scons/cm/scons/adacelBuilders/pseudoBuilders.py",
action = [env.Copy(env.File(os.path.join(env['LOCALROOT'],
variantDirOutput, idlFile)), idlFile),
(self.__class__, attr))
Builder methods that can be called without an explicit environment may be
called from custom Python modules that you import into an SConscript file
from SCons.Script import *
On Fri, Mar 16, 2018 at 11:16 AM, Pierre-Luc Boily <
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.
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 <
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)
"""
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
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
So you want to use the Copy() action inside a builder?
-Bill
On Fri, Mar 16, 2018 at 9:34 AM, Pierre-Luc Boily <
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.
Execute(Copy(os.path.join(env['LOCALROOT'], variantDirOutput,
str(idlFile)),
str(idlFile)))
NameError: global name 'Execute' is not defined
I understood that because I am outside of the SConscript context, Execute is
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
https://pairlist4.pair.net/mailman/listinfo/scons-users
_______________________________________________
Scons-users mailing list
https://pairlist4.pair.net/mailman/listinfo/scons-users
_______________________________________________
Scons-users mailing list
https://pairlist4.pair.net/mailman/listinfo/scons-users
_______________________________________________
Scons-users mailing list
https://pairlist4.pair.net/mailman/listinfo/scons-users
_______________________________________________
Scons-users mailing list
https://pairlist4.pair.net/mailman/listinfo/scons-users
_______________________________________________
Scons-users mailing list
https://pairlist4.pair.net/mailman/listinfo/scons-users
_______________________________________________
Scons-users mailing list
https://pairlist4.pair.net/mailman/listinfo/scons-users
_______________________________________________
Scons-users mailing list
https://pairlist4.pair.net/mailman/listinfo/scons-users
_______________________________________________
Scons-users mailing list
https://pairlist4.pair.net/mailman/listinfo/scons-users
_______________________________________________
Scons-users mailing list
https://pairlist4.pair.net/mailman/listinfo/scons-users
_______________________________________________
Scons-users mailing list
https://pairlist4.pair.net/mailman/listinfo/scons-users
_______________________________________________
Scons-users mailing list
https://pairlist4.pair.net/mailman/listinfo/scons-users
_______________________________________________
Scons-users mailing list
https://pairlist4.pair.net/mailman/listinfo/scons-users
_______________________________________________
Scons-users mailing list
https://pairlist4.pair.net/mailman/listinfo/scons-users
Loading...