On 16:44 Mon 09 Sep , Klaus Aehlig wrote:
> -- The python package will be installed to
> ``${pythondir}/ganeti-${VERSION}``.
> +- The python package will be installed to ``${pythondir}/ganeti/${VERSION}``.
> Here ${VERSION} is, depending on configure options, either the full
> qualified
> version number, consisting of major, minor, revision, and suffix, or it is
> just a major.minor pair. All python executables will be changed
> to import the correct version of the ganeti package.
I think this is actually a good time to discuss supporting the private
Python module layout, as proposed in GanetiCon. Instead of shipping to
${pythondir}, all python code should live under
${prefix}/share/ganeti/${VERSION}/, e.g:
/usr/share/ganeti/2.10/ganeti/cmdlib/__init__.py
/usr/share/ganeti/2.10/ganeti/qlang.py
...
/usr/share/ganeti/2.10/gnt-instance
/usr/share/ganeti/2.10/gnt-node
...
/usr/share/ganeti/default -> /etc/ganeti/share
/etc/ganeti/share -> /usr/share/ganeti/2.10
/usr/sbin/gnt-instance -> /usr/share/ganeti/default/gnt-instance
This way, Python scripts do not need to be changed to import the correct
version; upon startup, the Python interpreter performs a readlink() and
sets sys.path to include the canonical script's base directory. In the
case above, calling /usr/sbin/gnt-instance will result in
/usr/share/ganeti/2.10 being automatically prepended to sys.path. Again,
this is already done in the current Debian package (2.7.1-3) for
practical reasons (avoid byte-compiling with all installed Python
versions, do not make unstable APIs available under the global Python
path), so you can also check it out in practice.
Regards,
Apollon