[Scons-users] Merging Environments, Revisited!
Bill Deegan
bill at baddogconsulting.com
Wed Apr 1 17:32:45 EDT 2015
Brian,
I wasn't suggesting that your method would build both.
I was suggesting that both your xilinx and modelsim methods accept a env
and add to it if provided, rather than create a "virgin" one and add to
that.
-Bill
On Mon, Mar 30, 2015 at 2:06 PM, Brian Cody <brian.j.cody at gmail.com> wrote:
> Sorry, I wasn't clear. My intention already takes environments.
>
> def create_modelsim_xilinx_env(modelsim_env, xilinx_env):
> new_env = ...
>
> While ... will be several lines. I'm asking for most generic way to do
> this. The suggestion was to treat the environments as dictionaries, but the
> method for doing this for a dictionary (copy, update) doesn't work just work
>
> Thanks
>
> Sent from my iPad
>
> On Mar 30, 2015, at 1:23 PM, Bill Deegan <bill at baddogconsulting.com>
> wrote:
>
> Change your helper function to optionally take an environment as a
> parameter.
> -Bill
>
> On Mon, Mar 30, 2015 at 12:11 PM, Brian Cody <brian.j.cody at gmail.com>
> wrote:
>
>> This is a timely response to this message, and I'm asking for help:
>>
>>
>> Gary Oberbrunner-: Aug 05, 2011; 1:39pm Re: Merge two environments?
>> How would you like them combined? Replace? Append? Merge? Think
>> about something like LIBS or CPPDEFINES which are themselves lists or
>> dicts, or other vars which are python functions. Anyway, whatever
>> scheme you like could be implemented because you can treat an env just
>> like a dict: iterate over its members and do whatever you like to each
>> one.
>>
>> On Fri, Aug 5, 2011 at 7:16 AM, Julius Ziegler <[hidden email]> wrote:
>>
>> > Hello,
>> >
>> > I wonder if there is a systematic way to merge all the flags contained
>> > in two Environments?
>> >
>> > I would like to do somehting like this (random example):
>> >
>> > env_Qt = ... # setup an environment for building Qt stuff
>> > env_png = ... # setup an environment for building something that uses
>> libpng
>> >
>> > env_Qt_png = env_Qt.Clone()
>> > env_Qt_png.MergeFlags(env_png) # have an environment which combines both
>> >
>> > The last call of course does not work, since it expects either a gcc-ish
>> > string ("-lpng"), or a dictionary.
>> >
>> > Is there a canonic way to achieve this?
>> >
>> > Thanks!
>> > Julius
>>
>>
>>
>> In this case I have a helper function to set up an environment for
>> Xilinx. I have a helper function to set up an environment for Modelsim.
>> These are used separately (Xilinx for building projects, Modelsim for
>> running tests on code) and there are input variables into each. To properly
>> test with Xilinx built-ins, there is a step where you invoke Xilinx to
>> invoke Modelsim to compile Xilinx's built-ins for simulation. I want to
>> have a helper that takes a Xilinx environment and a Modelsim environment
>> and spits out an environment suitable for that particular combination of
>> the tools and settings. I'd like the helper to know the bare minimum of the
>> internals of those environments so when something needs to change, there's
>> the least amount of work possible.
>>
>> In the post above, Gary mentioned that you can treat the environments
>> like a dictionary. The way to combine two dictionaries is usually
>> (depending on what you want to do with the collisions):
>> new_dict = dict1.copy()
>> new_dict.update(dict2)
>>
>> This doesn't actually work though. The environments are not
>> dictionary-like enough to have a copy() method. Could someone suggest an
>> alternative? If I had this behavior, I think the only other step I'd need
>> to do would be to manually modify the path variable.
>>
>> Thank you
>>
>>
>>
>>
>>
>>
>>
>>
>>
>>
>>
>>
>> _______________________________________________
>> Scons-users mailing list
>> Scons-users at scons.org
>> https://pairlist4.pair.net/mailman/listinfo/scons-users
>>
>>
> _______________________________________________
> Scons-users mailing list
> Scons-users at scons.org
> https://pairlist4.pair.net/mailman/listinfo/scons-users
>
>
> _______________________________________________
> Scons-users mailing list
> Scons-users at scons.org
> https://pairlist4.pair.net/mailman/listinfo/scons-users
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://pairlist4.pair.net/pipermail/scons-users/attachments/20150401/77e4ae71/attachment.html>
More information about the Scons-users
mailing list