[Scons-users] Is there a way to ensure that actions have SConscript-relative paths ?

Paweł Tomulik ptomulik at meil.pw.edu.pl
Wed Jun 21 17:52:57 EDT 2017


W dniu 31.05.2017 o 05:20, Zarko Berberski (Aditi Staffing LLC) via
Scons-users pisze:
> Say a /foo/src/place_1/SConscript 
> 
> Registers env.Command('FStar_Parser_Parse.ml', File('parse.mly'), generate_fstar_parser_parse_ml)
> 
> The paths used for registration are SConscript-relative but when the action (meaning a Python function in this context) runs it "sees" SConstuct-relative path, say  /foo/src/.
> 
> Is there a systematic way keep such action (and transitively everything registered by a given SConscript) in the folder where that SConscript is?
> 
> I know that an action could do something like target[0].get_path() but then it has to parse which is error prone.
> 
> Would adding ... ,chdir=1) be the way to achieve that? Would the same hold for env.Builder ? Some other builders/pseudo-builders ? Some other command-arg that would be for SConscript-relativ path (if chdir=1 means target-relative path) ? 
> 
> Is there something like a list of additional args that are actually commands? Is there a way to pass additional key=val args that would reach the action at the time of its running?
> 

I remember, I was struggling with similar problems in one of my tools.
Maybe looking through the following code will help?

https://github.com/ptomulik/scons-tool-gnuplot/blob/master/gnuplot/__init__.py

Just look for _GplotRelTo (how it's implemented and used).

Regards!


-- 
Pawel Tomulik


More information about the Scons-users mailing list