Install python library with extension

Ciao @PaoloZaffino, if your extension is in the extension manager, you can actually do it directly in the cmake (so they will be packed at compilation time on the kitware factory machines):

  1. add python requirements in the superbuild:
    https://github.com/Punzo/SlicerAstro/blob/master/SuperBuild.cmake#L28
    https://github.com/Punzo/SlicerAstro/blob/master/SuperBuild/slicerastro-requirements.txt
    https://github.com/Punzo/SlicerAstro/blob/master/SuperBuild/External_python-slicerastro-requirements.cmake

  2. ensure the packing directly in Slicer build:
    https://github.com/Punzo/SlicerAstro/blob/master/CMakeLists.txt#L169-L176

    (this will not pollute the Slicer build. They will be installed only when you install the extension)

I tested this recently and it works. However, I tested only on linux.

P.S.: If you don’t have a SuperBuild, I advise to add it if you want to use this approach.

2 Likes