AcademySoftwareFoundation / OpenColorIO

A color management framework for visual effects and animation.
https://opencolorio.org
BSD 3-Clause "New" or "Revised" License
1.76k stars 437 forks source link

Fix python packaging #1778

Closed remia closed 1 year ago

remia commented 1 year ago

Following #1759, that changed the Python distribution layout by adding a folder containing a __init__.py file, I encountered some issues while using the Python bindings locally for development. The RPATH was no longer correct and the __init__.py also did not import everything (variables starting with underscores like __version__ are not imported).

This PR fix these issues and further try to have the in-build Python package structure close to the install so that unittest are performed in conditions that reflect the distributed package.

While all this is not strictly necessary for the wheels (they are built in static mode so the new __init__.py has little use in the first place I'd imagine), I still updated the Python package structure in the setup.py so that it reflects what we do in the regular build process. This is to avoid having 2 different structures to maintain. I uploaded a new PyPI test version in case you want to compare and test. PyOpenColorIO is now a folder in site-packages, containing __init__.py, PyOpenColorIO.so|pyd, tests and data modules.