[Scons-users] Command fails if action is simply $SOURCE
    William Deegan 
    bill at baddogconsulting.com
       
    Thu Feb 28 14:28:02 EST 2013
    
    
  
On Feb 28, 2013, at 11:11 AM, Carnë Draug <carandraug+dev at gmail.com> wrote:
> On 28 February 2013 18:56, William Deegan <bill at baddogconsulting.com> wrote:
>> On Feb 28, 2013, at 10:15 AM, Carnë Draug <carandraug+dev at gmail.com> wrote:
>>> I'm trying to set a bunch of scripts as commands which are then
>>> grouped as a single target with Alias. I'm doing something like this
>>> 
>>> analysis1 = env.Command(target = "result1", source = "script1.pl",
>>> action = "$SOURCE")
>>> analysis2 = env.Command(target = "result2", source = "script2.pl",
>>> action = "$SOURCE")
>>> analysis3 = env.Command(target = "result3", source = "script3.pl",
>>> action = "$SOURCE")
>>> 
>>> env.Alias("analysis", [analysis1, analysis2, analysis3])
>>> 
>>> 
>>> However, this fails. All I get is:
>>> 
>>> $scons analysis
>>> scons: Reading SConscript files ...
>>> scons: done reading SConscript files.
>>> scons: Building targets ...
>>> scons: done building targets.
>>> 
>>> I can make SCons run the scripts if I set the action to "./$SOURCE",
>>> "perl $SOURCE", "$SOURCE --" or anything like that. The files should
>>> have the correct permissions (744). Even if I set $SOURCE to a path, I
>>> get the same problem so shouldn't be a matter of adding anything to
>>> the search path.
>>> 
>>> Is this a bug in SCons or am I doing something wrong? And is there a
>>> better way to do this?
>> 
>> Try: "scons --debug=explain analysis"
> 
> This shows me that SCons recognizes the target as something to build
> but then does nothing about it:
> 
> $ scons --debug=explain analysis
> scons: Reading SConscript files ...
> scons: done reading SConscript files.
> scons: Building targets ...
> scons: building `result1' because it doesn't exist
> scons: building `result2' because it doesn't exist
> scons: building `result3' because it doesn't exist
> scons: done building targets.
> 
> Nothing is done with the scripts. Just for test, I made the scripts to
> just print something, or give an error but nothing happens ever.
> 
>> Also can you paste the output from:
>> scons --tree=prune analysis
> 
> scons: Reading SConscript files ...
> scons: done reading SConscript files.
> scons: Building targets ...
> +-analysis
>  +-result1
>  | +-scripts/script1.pl
>  +-result2
>  | +-scripts/script2.pl
>  +-result3
>    +-scripts/script3.pl
> scons: done building targets.
> 
> I have attached a tarball with the example, for ease of replication.
> 
> I have tried to pass the path for the scripts with os.path.join() and
> os.path.abspath() but none worked.
Try:
analysis3 = env.Command(target = "result3", source = "script3.pl", action = "${SOURCE.abspath}")
?
-Bill
    
    
More information about the Scons-users
mailing list