Skip to content

Correct and radically simplify python-vm startup

Kristian Larsson requested to merge 172-pyvenv-pkgpath into master

Digging out our package path from PYTHONPATH with the previous logic was simply incorrect. It assumed the directory name of the package would be the same as the actual package name (which is defined in package-meta-data.xml). Since we don't have any good tools to read out the package name from the XML file, we've abandoned this approach. It would be possible to use xmlstarlet in NSO in Docker, since it is included, however, I would like this change to be upstreamed into NSO and we can't rely on all NSO installations to have xmlstarlet available.

Instead we adopt a far simpler approach. On startup, the first element of PYTHONPATH is set by NSO to the path of the current python package and so we simply can extract that instead. Simpler although it now has a slightly tighter coupling to NSO, i.e. any changes to the NSO files starting up the Python VM might need to go along with changes to this startup script.

Closes #172 (closed)

Merge request reports