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!)
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?
buildinfo = // how do you initialize a variable that has fields?
buildinfo.objectFiles = []; // list of the object files
buildinfo.sourceFiles = []; // list of the source files
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.)
// 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);
Is there a shorter way? this isn't too long but it's long enough to be error-prone.
edit: or better yet, I want to define a simple class that has two fields, objectFiles and sourceFiles, and if I call
object1.append(object2)
then object1 will append object2's objectFiles and sourceFiles fields onto its own, so I could just do:
buildinfo = BuildInfo([],[]);
buildinfo.append(f(...));
buildinfo.append(f(...));
buildinfo.append(f(...));