← Back to team overview

kicad-developers team mailing list archive

Re: Environment variables (was Re: Config file relocation)

 

2014-09-03 21:14 GMT+02:00 yann jautard <bricofoy@xxxxxxx>:
>
> Le 03/09/2014 20:01, Wayne Stambaugh a écrit :
>
>> On 9/2/2014 11:58 PM, Moses McKnight wrote:
>>>
>>> On 09/02/2014 06:59 PM, Wayne Stambaugh wrote:
>>>>
>>>> On 8/31/2014 4:31 AM, Lorenzo Marcantonio wrote:
>>>
>>> <snip>
>>>>>
>>>>> By the way, I always wondered... why using env vars instead of settings
>>>>> in a config file? IIRC there were really angry people at the prospect
>>>>> of
>>>>> having to set environment variables (which is, by the way, the usual
>>>>> way
>>>>> of doing that on posix systems...)
>>>>>
>>>>> Especially since Debian policy explicitly forbids to have applications
>>>>> relying on them; I don't agree with that and they even patch in
>>>>> defaults
>>>>> which is a Bad Thing(tm) for me:P
>>>>>
>>>> I need to take a look at this.  An order of precedence has already been
>>>> established: environment variable, user configuration, default.  It just
>>>> needs to be coded.  I am not willing to give up being able to trump
>>>> everything with an environment variable for development purposes.
>>>
>>> This was actually the next thing on my list of things I was planning on
>>> looking into.  In fact I had these two links ready to put in my argument
>>> for putting the path variables into config files:
>>>
>>> http://peterlyons.com/problog/2010/02/environment-variables-considered-harmful
>>>
>>>
>>> http://www.insectnation.org/howto/environment-variables-considered-harmful
>>>
>>> The order of precedence you mention is exactly what I had in mind.  My
>>> thought also was to add to the GUI the ability to define path variables,
>>> and save them in "kicad_common" config file.  If you would like me to
>>> continue to look into this let me know, or let me know if you would just
>>> rather do it yourself.
>>>
>>> Thanks,
>>> Moses
>>>
>> If you have time, go ahead and take a look at it.  I'm pretty sure the
>> code to do this is already in place.  I seem to remember Dick mentioning
>> something about it so take a look at his Kiway work before you write
>> your own code to handle the environment variable, configuration setting,
>> and default value.  I think it might be somewhere in the project code.
>> As far as I know, the only required environment variables we support are
>> KISYSMOD and KISYS3DMOD.
>>
>> Wayne
>>
>>
> here is what Nick said about KISYS3DMOD and I noticed the same behaviour :
>
>
> Le 04/08/2014 18:02, Nick Østergaard a écrit :
>>
>> 2014-08-04 16:00 GMT+02:00 Wayne Stambaugh <stambaughw@xxxxxxxxxxx>:
>>>
>>> (...)
>>> You can edit KIPRJMOD, KISYSMOD, AND KISYS3DMOD.  They are environment
>>> variables so you have to edit them either system wide or user specific
>>> depending on your needs using your preferred method for editing
>>> environment variables on your system.  You are not obligated to use any
>>> of these variables.  You can specify the full path and/or file name
>>> (depending on the library type) for each library.
>>
>> Well, that is the thing... it does not work for me to define a
>> KISYS3DMOD environment variable. I does not seem to be defined anywere
>> already on my sytem, when I echo $KISYS3DMOD it is empty. But if I try
>> to export it in a new terminal session as "export KISYS3DMOD=foo", I
>> do get foo when I echo it -- as expected, but kicad do not catch this.
>> I open pcbnew from the same terminal as I set the env var in, then add
>> a random footprint to the canvas, open the properties for it, then I
>> go to the 3D settings tab, here the path is still listed as
>> "/usr/share/kicad/modules/packages3d", which I expected to be "foo". I
>> am on Archlinux, with 5041.
>>
>> Also in that regard I cannot use custom enviroment variables in the
>> "3D Shape Name" list IIRC. (at least last time I tested, I did not
>> test this now, I can do that if requested)
>>
>>

In regard to that I tried to find the relevant section in the code,
which I did find. But the above is not the full story. I DO actually
work, you just _need_ to have the path that you set the environment
variable to _exist_, else it is not set in kicad. So my dummy path
/foo did not work, but i.e. if I did use /home it would work. The code
clearly says this intended. I also concluded that in the thread where
I stated the above.


References