Skip to content

WIP: Python 3

Adam Wolf requested to merge adamwolf/py3test into master

Based on the discussions over at !321 (closed) (Thanks @nickoe @imcinerney @StefanBruens and anyone I missed), and the work @nickoe and I had done before, I have been hammering away at getting this ready.

It builds! Before I get it all wrapped up, I wanted to get it up here.

You should be able to play along at home with ./build.py --target=package-kicad-nightly --no-retry-failed-build --kicad-git-url=https://gitlab.com/adamwwolf/kicad.git --kicad-ref macos-python3. I'll start a clean build shortly, and touch this PR up with any necessary changes.

There are a few different things we have to do before this is ready.

We need to make sure this works! We need to run through the tests in the README for Python:

  • Open up pcbnew.app, and open up the Python scripting console. Type import pcbnew and press enter. It shouldn't show an error. Verify that the build date of Python is the same as the build date of the package.
  • Open up KiCad.app, and open up the Python scripting console. Type import pcbnew and press enter. It shouldn't show an error. Verify that the build date of Pytohn is the same as the build date of the package.
  • Open up the terminal, and run kicad.app/Contents/Frameworks/Python.framework/Versions/Current/bin/python. It shouldn't show an error. Verify that the build date of Python is the same as the build date of the package.
  • Open up the terminal, and run cd kicad.app/Contents/Frameworks/python/site-packages/; ../../Python.framework/Versions/Current/bin/python -m pcbnew. It shouldn't show an error.

If we need more tests to make sure Python is working, we should add them to the README.

We need to check on some of the CMake variables. I do not recall why I set them the way I did, and my notes from this step are sparse, but we should look into KICAD_SCRIPTING_WXPYTHON, KICAD_SCRIPTING_WXPYTHON_PHOENIX, and KICAD_SCRIPTING_ACTION_MENU=OFF. If we include them and they're working, we should put tests for them in the README.

Beyond functionality, we need to get the wx, Phoenix and KiCad parts reviewed and handled. The wx and Phoenix pieces in this branch are preset to go to my wx and Phoenix branches. We'll need to pull that out before this is merged.

  • Clean up the history and edit the Vagrant commit (@adamwwolf)
  • Check on GetPrerequisites and BundleUtilties upstream issue and figure out agreeable solution (besides edit them locally...)
  • Confirm Python3 compile-time optional features we want, and their dependencies
  • Turn on appropriate CMake variables and placate FindwxWidgets
  • Figure out gettext dependency for Python3. (Options include pulling it into the bundle, and looking into how macOS is doing it?)
  • See if we still have to ignore Python in fixup bundle, and if we do, make sure we re-verify the bundle.
  • Confirm PYTHONPATH for pcbnew
  • Confirm PYTHONPATH for eeschema (for running the BOM plugins et al)
Edited by Adam Wolf

Merge request reports