Note that there are some explanatory texts on larger screens.

plurals
  1. POpython/scons help: maintaining lists of source files + object files
    text
    copied!<p>I know next to nothing about Python and I'm using scons. (if you're reading this and know Python but not scons, you can probably help me!)</p> <p>Could someone help me out and explain how I could have a variable that contains two lists? I'm not sure of the syntax. Is this right?</p> <pre><code>buildinfo = // how do you initialize a variable that has fields? buildinfo.objectFiles = []; // list of the object files buildinfo.sourceFiles = []; // list of the source files </code></pre> <p>If I have a function f() that returns a variable of this structure, what's the shortest way to append f()'s return value onto both lists? (Really f() is Sconscript() but never mind.)</p> <pre><code>// call f() several times and append the results onto buildinfo buildinfo_sub = f(...); buildinfo.objectFiles.append(buildinfo_sub.objectFiles); buildinfo.sourceFiles.append(buildinfo_sub.sourceFiles); buildinfo_sub = f(...); buildinfo.objectFiles.append(buildinfo_sub.objectFiles); buildinfo.sourceFiles.append(buildinfo_sub.sourceFiles); buildinfo_sub = f(...); buildinfo.objectFiles.append(buildinfo_sub.objectFiles); buildinfo.sourceFiles.append(buildinfo_sub.sourceFiles); </code></pre> <p>Is there a shorter way? this isn't too long but it's long enough to be error-prone.</p> <p><strong>edit</strong>: or better yet, I want to define a simple class that has two fields, objectFiles and sourceFiles, and if I call</p> <pre><code>object1.append(object2) </code></pre> <p>then object1 will append object2's objectFiles and sourceFiles fields onto its own, so I could just do:</p> <pre><code>buildinfo = BuildInfo([],[]); buildinfo.append(f(...)); buildinfo.append(f(...)); buildinfo.append(f(...)); </code></pre>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload