[Scons-users] Problems with env.Install()
    William Deegan 
    bill at baddogconsulting.com
       
    Fri Jan 25 12:54:49 EST 2013
    
    
  
Michel,
I've removed/reformatted your top posting so it's easier to understand..
On 01/25/2013 09:21 AM, Michel Lestrade wrote:
> Hi,
>
>
>
>
>
> Michel Lestrade
>
> On 24/01/2013 11:57 PM, William Deegan wrote:
>> Michel,
>> On Jan 24, 2013, at 3:59 PM, Michel Lestrade 
>> <michel.lestrade at crosslight.com> wrote:
>>
>>> Hi,
>>>
>>> I think the documentation is pretty clear that you can install 
>>> multiple targets at the same time but I have some trouble making 
>>> that work.
>>>
>>> What I am doing is building up a list of DLLs used by my test 
>>> programs in environment variable and then installing those in my 
>>> build folders:
>>>
>>>> env['DLLS'] = SCons.Node.NodeList()
>> Why do this?
    The idea of storing my list of DLLs into the environment variable is
    to make it easier to propagate it to various SConscript in
    sub-folders; I named that key 'DLLS' to match the existing 'LIBS'
    key which contains the link libraries. I guess I could pass the list
    as a separate variable but since I can print the contents properly,
    that should not really matter; it seems to be imported properly.
    In each of those sub-folders I mainly build libraries for a
    top-level project but there are test programs which need those
    earlier DLLs to run properly. I don't actually need those test
    programs for my final project but it helps to be able to run them in
    the early stages to make sure I did not mess anything up when
    porting the original Makefiles. Once the final project is built it
    would also be convenient to have all those files copied to a single
    install/redistributable folder, hence the idea of having a single
    list of those binary files.
    The project dependency basically looks like this (omitting the MPI
    code which is linked pretty much everywhere):
    linear solver exe -> MUMPS DLL -> PT-Scotch DLL -> Pthread for
    Windows DLL
    So the PT-Scotch test programs need the ptscotch and pthread DLLs
    while the MUMPS test programs need that DLL on top of those two from
    before. Each of those projects is in its own folder and has one ore
    more SConscript files.
    Now, as to the reason why I initialize with a NodeList() it's
    because that if I create the 'DLLS' key in my environment straight
    with env.Append(DLLS=pthread[0]), it will store it as a File() node
    and subsequent Append() commands will fail since File() does not
    support insert (at least, that's the error message I seem to
    remember). It's the same thing that happens when the first thing you
    store in a key is a string: sometimes SCons will concatenate that
    string on the next Append() rather than adding another list item. I
    have also tried simply initializing with a regular empty Python list
    ([]) but I get the same behavior.
env[DLLS] = []
env[DLLS].append(pthread[0])
Should work.
>>>> env.Append(DLLS=pthread[0])
>>>> etc .... (more DLLS added in SConscript)
>>> The list appears to be populated correctly but env.Install() only 
>>> copies the last item:
>>>
>>>> for x in env['DLLS']: print 'Debug:', x.abspath
>>>> env.Install('scotch_dll',env['DLLS'])
>>> which produces the following output:
>>>
>>>> Debug: D:\Source\MUMPS_scons\build\pthread64\pthread64.dll
>>>> Debug: D:\Source\MUMPS_scons\build\scotch64\scotch_wexit64.dll
>>>> scons: done reading SConscript files.
>>>> scons: Building targets ...
>>>> Install file: "build\scotch64\scotch_wexit64.dll" as 
>>>> "build\scotch64\scotch_dll\
>>>> scotch_wexit64.dll"
>>>> scons: done building targets.
>>> Before doing this, I deleted all the DLLs in that folder so it is 
>>> not simply that this single build target was missing. After scons 
>>> finishes, only 1 DLL is in my scotch_dll directory instead of the 
>>> expected 2. It's maddening that something so simple does not work. 
>>> Even doing it the brute force way (for x in env['DLLS']: 
>>> env.Install('scotch_dll',x)) produces the same behavior.
>>>
>>> As a complete newbie, am I missing something obvious ?
>> You need to post more of your logic to be able to help you.
    Is this enough information ? I can attach a couple of my SCons files
    but I have pretty much tailored everything to the Intel compiler so
    it is not very portable yet. Not quite sure about sending
    attachments to a mailing list either.
Minimally create a small test case which reproduces your issue.
Without code it's unlikely we'll find your issue.
-Bill
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://four.pairlist.net/pipermail/scons-users/attachments/20130125/2f9bd27f/attachment-0001.htm>
    
    
More information about the Scons-users
mailing list