Персональные инструменты
 

SconsDynamicallyAddTargetToExecutor — различия между версиями

Материал из CustisWiki

Перейти к: навигация, поиск
м
м
 
Строка 41: Строка 41:
 
  Generator.executor.targets.append(env.fs.Entry(GeneratedN))
 
  Generator.executor.targets.append(env.fs.Entry(GeneratedN))
 
but it seems not working…
 
but it seems not working…
 +
 +
 +
 +
== Addition 01==
 +
 +
<graph>
 +
digraph G{
 +
rankdir=LR
 +
ResultFile [fontsize=8 shape=box3d]
 +
MainFile1->ResultFile;
 +
MainFile2->ResultFile;
 +
edge [style=dashed label="included in" fontsize=8]
 +
Generated1->MainFile1
 +
Generated2->MainFile1
 +
Generated3->MainFile2
 +
Generated4->MainFile2
 +
 +
Generated1 [style=filled fillcolor=yellow]
 +
Generated2 [style=filled fillcolor=yellow]
 +
Generated3 [style=filled fillcolor=yellow]
 +
Generated4 [style=filled fillcolor=yellow]
 +
 +
edge [color=blue style=solid label=generated]
 +
Generator->Generated1
 +
Generator->Generated2
 +
Generator->Generated3
 +
Generator->Generated4
 +
Generator->Generated5
 +
Generator->Generated6
 +
}
 +
</graph>
 +
 +
 +
Situation may be a little complex:
 +
 +
* There are a list of «mainfiles»: <tt>MainFile1</tt>, <tt>MainFile2</tt>…
 +
* <tt>MainFileX</tt> includes some <tt>GeneratedNN</tt> files (count of these files is unknown)
 +
* All these <tt>GeneratedNN</tt> files (+some other files) generated by one <tt>Generator</tt> file (for example, python script).
 +
* All included <tt>GeneratedNN</tt> files needed to be rescanned after generation (they can include other files).
 +
 +
I scan <tt>MainFileX</tt>, and then I see inclusion of <tt>Generated1</tt> file,
 +
I add something like this:
 +
    cmd=env.Command(Generated1, Generator, RunMePlease)
 +
 +
Actually I need after scanning and before starting build process:
 +
    cmd=env.Command([Generated1,Generated2,…,GeneratedN], Generator, RunMePlease)

Текущая версия на 15:21, 9 октября 2009

[svg]


Consider the following situation.

  • MainFile includes some GeneratedNN files (count of these files is unknown)
  • All these GeneratedNN files (+some other files) generated by one Generator file (for example, python script).
  • All included GeneratedNN files needed to be rescanned after generation (they can include other files).

I scan MainFile, and then I see inclusion of Generated1 file, I add something like this:

    cmd=env.Command(Generated1, Generator, RunMePlease)

But actually I need

    cmd=env.Command([Generated1,Generated2,…,GeneratedN], Generator, RunMePlease) 

but I must add targets incrementally during MainFile scan…

Question.svg So the question is: How to dynamically add targets to Command? I try something like

Generator.executor.targets.append(env.fs.Entry(GeneratedN))

but it seems not working…


Addition 01

[svg]


Situation may be a little complex:

  • There are a list of «mainfiles»: MainFile1, MainFile2
  • MainFileX includes some GeneratedNN files (count of these files is unknown)
  • All these GeneratedNN files (+some other files) generated by one Generator file (for example, python script).
  • All included GeneratedNN files needed to be rescanned after generation (they can include other files).

I scan MainFileX, and then I see inclusion of Generated1 file, I add something like this:

    cmd=env.Command(Generated1, Generator, RunMePlease)

Actually I need after scanning and before starting build process:

    cmd=env.Command([Generated1,Generated2,…,GeneratedN], Generator, RunMePlease)