pythonocc-core icon indicating copy to clipboard operation
pythonocc-core copied to clipboard

How do you specify which Python version(s) to build against?

Open salfter opened this issue 3 years ago • 3 comments

The build system appears to just select the newest available Python, as far as I've been able to tell. It's fairly common to have multiple versions installed, but to want most things built against an older, more stable version. Gentoo Linux normally keeps things straight with its distutils-r1 eclass, but right now I have a host where pythonocc was built against Python 3.9 while cadquery (and most everything else) was built against Python 3.8. How do I get pythonocc to build against a specific Python version (or, potentially, multiple versions)?

Update: even after using "eselect python set" to select Python 3.8 as the default, the pythonocc build system still chooses to build against Python 3.9.

salfter avatar Jan 21 '21 23:01 salfter

Passing -DPython3_EXECUTABLE=/usr/bin/python3.8 to cmake looks like it might work to select one version. How about multiple versions?

salfter avatar Jan 21 '21 23:01 salfter

Passing -DPython3_EXECUTABLE=/usr/bin/python3.8 to cmake looks like it might work to select one version.

This is correct.

The project cannot be built for multiple versions at the same time. This is technically impossible. What you can do is to create multiple build directories for the different python versions.

rainman110 avatar Jan 22 '21 12:01 rainman110

@salfter In my overlay you can find a pythonocc ebuild which properly handles multi-python installations, as required by Gentoo QA (python modules must be byte-compiled): https://github.com/Dr-Terrible/ineluctable-overlay/tree/master/dev-python/pythonocc

It's far from being perfect, but it's a starting point and compiles and installs pythonocc correctly as required by upstream. Feel free to use it and test it. Feedback are welcome.

You can also find ebuilds for CadQuery and CQ-editor, in case you want to test all the features of pythonocc extensively.

Dr-Terrible avatar Jan 22 '21 16:01 Dr-Terrible