← Back to team overview

kicad-developers team mailing list archive

Re: KiCad scripting supported in the release or not

 

Hi, this is kind of an old message, but I posted about this some time ago, before there were even OS X nightlies.  I mentioned that this would rear its head eventually - as to when, that's for Apple to not tell us until far too short a time before it happens, as they tend to do.   The worry of python2.7 vanishing is not unfounded, especially in light of changes Apple made to it's documentation around 10.9.

 I'll summarize the key point

As of 10.9 and onward, Apple's deployment requirements state that any .app bundle that can be scripted/execute scripts itself in a way that makes OS X API calls (so any GUI stuff) must not use any system provided interpreters and instead embed its own copy of any interpreters used and any extensions link to it.  Yes, you read correct, if your .app is scriptable via python, you have to include your own copy of python specific to that .app within it.  I did this successfully with KiCad, its relatively straightforward, but does require some tweaks to the build system, some extra scripts (mostly to shave down the size of the python framework, but even then it adds ~80MB of bloat) and carefully compiling python such that it links to the newest OS X SDK you wish to support, but with the -mmacosx-version-min=... flag set to the oldest version of the SDK you wish to support.  You can't embed the system's interpreter as it is compiled only for that 10.x revision. 

This is a requirement for inclusion in the App Store, so KiCad has no need of doing this, but that change is fairly worrying, as these documentation changes tend to be good indicators of where the fickle wind that is Apple's developer policies may be blowing soon.  :).  

Oh, and I recall that wxwidgets totally failed to handle -mmacos-verison-min correctly so you have to manually set some defines, MACOSX_DEPLOYMENT_TARGET I believe.  

It's a mess.  I say, lets include python scripting but not worry about embedding it.  FYI, I have a friend who refuses to upgrade from 10.6, so I provide him special KiCad builds that are compatible and python scriptable over the span of 10.6-10.11 (seriously).  Weak linking to the system's python, even across such a wide gap of OS X versions, has not caused us any issues and indeed, the same .app bundle of KiCad can happily work, python scripting and all, across 10.6, 10.7, 10.8, 10.9, 10.10, and 10.11.  Apple has been very careful to maintain compatibility with all prior versions of python for years now.  If you check, python2.7 is still built with gcc 4.2.1 and stdlibc++, despite the rest of the OS using libc++ and clang, entirely to preserve that compatibility.  

For now at least, they seem pretty dedicated to continuing it.  Python is particularly huge amongst mac users, so it would cause a huge poop storm if they broke anything in regards to it heh.

> On Oct 2, 2015, at 4:57 PM, Adam Wolf <adamwolf@xxxxxxxxxxxxxxxxxxxx> wrote:
> 
> I definitely see that there can be problems there.  I hope we can get most users without a lot more work.  
> 
> It would not be a huge amount of work for me to make a different build for each OS X version every night.
> 
> Adam Wolf
> Cofounder and Engineer
> Wayne and Layne, LLC
> 
> On Fri, Oct 2, 2015 at 5:30 PM, Bernhard Stegmaier <stegmaier@xxxxxxxxxxxxx> wrote:
> I think your build didn’t work correctly for me because the paths were just wrong before my patch, so no plugins were found.
> I’ll retest when a new build has been made with the new paths.
> I guess it is not a problem for now.
> 
> The rest about incompatibilities is just speculation, maybe also just my lack of real knowledge how python works under the hood.
> 
> In extreme, imagine you built on a (imaginary) OS X 10.12 which only has python3 installed. 
> So, the app bundle will contain wxPython stuff (binary libs and python packages) built with (or, against) python3, but no python interpreter itself.
> Now, imagine running this bundle on a 10.11 with python 2.7.
> Will this work? 
> I don’t know.
> If python wrt to the wxPython stuff doesn’t know such bad things like ABI changes in binary C++ world, it is maybe no problem at all.
> 
> This example is of course not (yet?) reality, but I hope you get the point I am concerned about.
> But maybe it is nothing to worry about at all…
> 
> 
> Regards,
> Bernhard
> 
> 
>> On 02 Oct 2015, at 21:42, Adam Wolf <adamwolf@xxxxxxxxxxxxxxxxxxxx> wrote:
>> 
>> Don't worry, Andy, I'm not going to stop the OS X dmg releases!
>> 
>> If no one else gets to this soon, I will dig into this.  I need to find out why my build isn't working for Bernhard, and figure out the matrix of OS X release and Python version that is currently supported, and figure out if there's actually a gap.
>> 
>> Adam Wolf
>> 
>> On Fri, Oct 2, 2015 at 2:37 PM, Andy Peters <devel@xxxxxxxxx> wrote:
>> 
>> > On Oct 2, 2015, at 12:32 PM, Bernhard Stegmaier <stegmaier@xxxxxxxxxxxxx> wrote:
>> >
>> > Of course, we could switch back to some package manager like home-brew or MacPorts on OS X, but you would lose the ability to just download and run an app bundle (everyone would have to “build” his own version - even if it is just a pre-built download). This is not very Apple-like (but again, that’s probably only a matter of taste).
>> 
>> I would like to be the voice of MANY Mac users who don’t want to deal with a package manger (homebrew, MacPorts, whatever).  The ideal distribution format is a disk image from which the user drags the executable to any location. The next-to-ideal format is a standard OS X installer package.
>> 
>> -a
>> 
>> _______________________________________________
>> Mailing list: https://launchpad.net/~kicad-developers
>> Post to     : kicad-developers@xxxxxxxxxxxxxxxxxxx
>> Unsubscribe : https://launchpad.net/~kicad-developers
>> More help   : https://help.launchpad.net/ListHelp
>> 
>> _______________________________________________
>> Mailing list: https://launchpad.net/~kicad-developers
>> Post to     : kicad-developers@xxxxxxxxxxxxxxxxxxx
>> Unsubscribe : https://launchpad.net/~kicad-developers
>> More help   : https://help.launchpad.net/ListHelp
> 
> 
> _______________________________________________
> Mailing list: https://launchpad.net/~kicad-developers
> Post to     : kicad-developers@xxxxxxxxxxxxxxxxxxx
> Unsubscribe : https://launchpad.net/~kicad-developers
> More help   : https://help.launchpad.net/ListHelp



Follow ups

References