← Back to team overview

kicad-developers team mailing list archive

Re: Building with local Python3 etc

 

That's good news Adam! I'll stop trying here then and just wait for
the next step. Let me know when there's anything to test.

FYI, I installed wxpython via pip since the homebrew'd one didn't
install any 'wx' module in site-packages.

Cheers

On Thu, Apr 29, 2021 at 3:34 PM Adam Wolf <adamwolf@xxxxxxxxxxxxxxxxxxxx> wrote:
>
> Thanks Jon and Jonatan!
>
> I think we are only a little bit away from having this work well for developers who want to have fast local incremental builds, packagers who need robust from-scratch relocatable redistributable builds, and users who want signed and notarized builds with Python 3.
>
> The aim is that developers will be able to use a system Python and not need to make install or run wrangle-bundle, and that the CI builder will produce signed, notarized builds and upload them to the CERN download servers.
>
> The CI builder part is already producing signed builds, and I've uploaded notarized and signed ones to osx/testing.
>
> The next steps on improving the developer experience is to make sure folks can use a system Python, and then to make sure that devs don't need to make install.
>
> Adam
>
> On Thu, Apr 29, 2021, 7:30 AM Jon Evans <jon@xxxxxxxxxxxxx> wrote:
>>
>> Hi Jonatan,
>>
>> Adam and I have been bouncing ideas back and forth and he helped me get to a working setup, most recently with Seth's new_python branch but I think this should work with current master too.
>>
>> The key point is that we don't yet have a working way to use your system Python (but Adam has ideas on that and is working on it)
>>
>> So, the steps that worked for me are:
>>
>> 1) Use kicad-mac-builder to set up the dependencies.
>> As described in the readme: https://gitlab.com/kicad/packaging/kicad-mac-builder
>> run ./build.py --target setup-kicad-dependencies
>>
>> Note: this will install everything, including wxwidgets, wxpython, etc.  There isn't currently a way to skip some if you already have them built outside kicad-mac-builder.
>> Really you and I mostly need Python out of this, as it's the only dependency that is hard to manage right now.
>>
>> 2) At the end of its run, build.py will spit out a lot of suggested CMake flags.  Save these, and then do a merge with your current CMake flags that you are building with.
>> In particular, you'll want to carry over the flags that point at the Python framework created by build.py.
>>
>> 3) Use Adam's wrangle-bundle script to fixup the installed bundle.
>> Obtain that from https://gitlab.com/adamwwolf/dyldstyle and install it (I used the venv method suggested by Adam in the readme)
>> Run something like wrangle-bundle --python-version 3.8 --fix path/to/KiCad.app
>>
>> 4) At this point, your build should work and make install should also work (at least it did for me).  Please let us know if you don't have success
>>
>> 5) There are additional steps and complications if you want to run and debug targets without first doing make install, as is possible on other platforms.  I have figured out a workaround that makes this work, but it is not awesome, so Adam and I are discussing an easier route.
>>
>> We will update the documentation accordingly, things are just moving quickly at the moment and we're trying to have them settle down in a way that is easy to follow for developers.
>>
>> Best,
>> Jon
>>
>> On Thu, Apr 29, 2021 at 7:16 AM Jonatan Liljedahl <lijon@xxxxxxxxxxxx> wrote:
>>>
>>> I now tried manually copying my system site-packages into the bundle:
>>>
>>> cp -a /usr/local/lib/python3.9/site-packages/*
>>> /Users/lijon/Coding/kicad/build/install_py3/KiCad.app/Contents/Frameworks/Python.framework/Versions/3.9/lib/python3.9/site-packages/
>>>
>>> Now when starting pcbnew, console gives a lot of:
>>>
>>> Class wxSTCPopupBaseView is implemented in both
>>> /Users/lijon/Coding/kicad/build/install_py3/KiCad.app/Contents/Frameworks/libwx_osx_cocoau-3.1.5.0.0.dylib
>>> (0x10f13c8d8) and
>>> /Users/lijon/Coding/kicad/build/install_py3/KiCad.app/Contents/Frameworks/Python.framework/Versions/3.9/lib/python3.9/site-packages/wx/libwx_osx_cocoau_stc-3.1.5.0.0.dylib
>>> (0x1198ddbf8). One of the two will be used. Which one is undefined.
>>>
>>> And trying to open scripting console says:
>>>
>>> Traceback (most recent call last):
>>>   File "<string>", line 5, in <module>
>>>   File "/Users/lijon/Coding/kicad/build/install_py3/KiCad.app/Contents/SharedSupport/scripting/kicad_pyshell/__init__.py",
>>> line 230, in makePcbnewShellWindow
>>>     pyshell = PcbnewPyShell(parent, id=-1, title=INTRO)
>>>   File "/Users/lijon/Coding/kicad/build/install_py3/KiCad.app/Contents/Frameworks/Python.framework/Versions/3.9/lib/python3.9/site-packages/wx/py/editor.py",
>>> line 265, in __init__
>>>     EditorFrame.__init__(self, parent, id, title, pos,
>>>   File "/Users/lijon/Coding/kicad/build/install_py3/KiCad.app/Contents/Frameworks/Python.framework/Versions/3.9/lib/python3.9/site-packages/wx/py/editor.py",
>>> line 29, in __init__
>>>     frame.Frame.__init__(self, parent, id, title, pos, size, style)
>>>   File "/Users/lijon/Coding/kicad/build/install_py3/KiCad.app/Contents/Frameworks/Python.framework/Versions/3.9/lib/python3.9/site-packages/wx/py/frame.py",
>>> line 69, in __init__
>>>     wx.Frame.__init__(self, parent, id, title, pos, size, style)
>>> wx._core.PyNoAppError: The wx.App object must be created first!
>>>
>>> Hopefully this helps!
>>>
>>> On Thu, Apr 29, 2021 at 1:09 PM Jonatan Liljedahl <lijon@xxxxxxxxxxxx> wrote:
>>> >
>>> > So, I updated my CMake and tweaked some variables, and now 'make
>>> > install' succeeds without "app verification failed". Also I can start
>>> > pcbnew without crashing. However, trying to open the scripting console
>>> > in pcbnew gives an error popup. The console reveals that it couldn't
>>> > import the 'wx' module.
>>> >
>>> > During make install, I saw this:
>>> >
>>> > cp: cannot overwrite directory
>>> > /Users/lijon/Coding/kicad/build/install_py3/KiCad.app/Contents/Frameworks/Python.framework/Versions/3.9/lib/python3.9/site-packages
>>> > with non-directory
>>> > /usr/local/Cellar/python@3.9/3.9.2_1/Frameworks/Python.framework/Versions/3.9/lib/python3.9/site-packages
>>> >
>>> > It's non-directory because it's a symlink. It points to
>>> > /usr/local/lib/python3.9/site-packages, which does contain the 'wx'
>>> > module.
>>> >
>>> > I've tried rerunning cmake with
>>> > -DPYTHON_SITE_PACKAGE_PATH=/usr/local/lib/python3.9/site-packages but
>>> > I get the same error at make install. Perhaps it's cached somewhere,
>>> > how can I clear that without doing the whole build again from scratch?
>>> > (which takes a couple of hours on my slow machine...)
>>> >
>>> > --
>>> > /Jonatan
>>> > http://kymatica.com
>>>
>>>
>>>
>>> --
>>> /Jonatan
>>> http://kymatica.com
>>>
>>> _______________________________________________
>>> 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



-- 
/Jonatan
http://kymatica.com


References