← Back to team overview

kicad-developers team mailing list archive

Re: Mac OSX build, with scripting, codename "wife"


On 03/11/2013 10:20 AM, Adam Wolf wrote:
> If we store all the python modules in a user's home directory, how
> do they get there?  Does kicad put them there, or does the installer?
> While we should provide the python modules like footprint_wizard.py
> for download, we cannot easily provide the swiggy modules like
> pcbnew.py for download, because they depend upon both the kicad
> source and state on the user's system.
> If the installer is putting them there, I hope we don't have a
> situation where the dll-like swiggy python modules are only in one
> home directory.  This could create issues if you delete your
> dotfiles or another user wants to use Python support.
> Adam Wolf

Lets start by solving the big problem first.  (Then fine tune over
time.  The package maintainers always have an option to trump what we
do in CMakeLists.txt for their distro.)

CMAKE_INSTALL_PREFIX is nice.  But it is only one variable, and this
forces the assumption that everything must be relative to one tree
root.  Sometimes that is inadequate.

I would suggest that, on MY linux computer, I would like my kicad data
(projects, work, and personal libraries) all to go under ~/kicad/*

And that ALL the kicad python modules are best placed into
~/kicad/python/*.   Maybe a subtree in there is appropriate, or flat.

Broadly speaking, I consider python scripts to be mostly like *data*
files, just as much as my schematics and boards.  Mostly because I
want to be able to edit them easily.

KICAD_DATA_DIR could be a cache variable, and its default could be

KICAD_PYTHON could be a cache variable, and its default could be

For a linux computer shared by more than one user, the installer could
route the python modules to something like /home/kicad/python by
overriding the KICAD_PYTHON setting, then give rights to /home/kicad
to more than one user, some read only, but those that edit python
scripts, write permissions.

BTW, Python can now read *.py files out of a zip file, just like Java
and *.class files.

If someone wants to they can zip up *.py files and put them on the
PYTHONPATH, that would be an option for CMakeLists.txt's install
strategy, pertaining to the swig *.py files.  But again, this is
1/20th as important to me as being able to edit what we are
optimistically calling "scripts".  To me a script is something I edit
every 20 seconds until I get it right.  And of course "getting it
right" is where it gets personal.

> On Mar 11, 2013 9:39 AM, "Miguel Angel Ajo Pelayo"
> <miguelangel@xxxxxxx <mailto:miguelangel@xxxxxxx>> wrote:
>     That looks quite much to the wrapping I had to do in MacOX to
>     avoid static linking, 
>     where it's uncommon for normal users to put new libraries in the
>     system paths:
>     I rename pcbnew to pcbnew.bin and put the loader as "pcbnew",
>     same for all the other apps,
>     it just builds a pointer to the libraries, the python path, and
>     kicad stock libraries, and then
>     boots the app itself.
>     #!/bin/sh
>     # this is script wraps the original binary application,
>     # and sets the library paths just before launching
>     DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
>     export KICAD_APP=$DIR/../../../kicad.app
>     export KICAD_DATA=$DIR/../../../data
>     # let the apps find the libraries at startup
>     export
>     # let python scripting find our modules
>     export
>     PYTHONPATH=$KICAD_APP/Contents/Frameworks/python2.7/site-packages/:$PYTHONPATH
>     export KICAD=$KICAD_DATA
>     $DIR/`basename $0`.bin $*
>     Miguel Angel Ajo
>     http://www.nbee.es
>     +34911407752 <tel:%2B34911407752>
>     skype: ajoajoajo
>     On 11/03/2013, at 15:33, Dick Hollenbeck <dick@xxxxxxxxxxx
>     <mailto:dick@xxxxxxxxxxx>> wrote:
>>     For the 4th time, yes.  And it would not bother me at all to be
>>     different from a decade of other python users, but like blender
>>     users.
>>     I am happy to be different, when I know I am helping myself.
>>     Maintaining a distinction between two categories of kicad python
>>     modules is a low priority to me.
>>     For linux users, the installer can set PYTHONPATH on the
>>     commandline,
>>     and this can be done in a desktop launcher (icon or menu):
>>     $ PYTHONPATH=<writeable-convenient-dir>:$PATHONPATH  pcbnew
>>     $ PYTHONPATH=<writeable-convenient-dir>:$PATHONPATH  kicad
>>     I believe these settings would last as long as the program is
>>     running,
>>     only.  Which is about what we want.
>>     Might need to to put sh in front of that.