Put genconf-generated python in separate package
Description thanks to @clemenci
Currently, all python modules are meant to be installed in one target directory (package). This creates a mess at build time because we need to make it look like the hand-written python and the genconf module are both in the same package.
The current workaround is to create a special python
directory in the build tree which works as a bootstrap for the namespace packages by extending the local path to all the relevant directories and execfile
the main __init__.py
(for example GaudiPython/python/GaudiPython/__init__.py
).
The build time PYTHONPATH
is set to point first to this special directory, so when you import GaudiPython
you find the special __init__.py
that extends the local Python path and calls the main __init__.py
.
The proper solution, I believe, is to avoid that generated Python files go in the same packages as hand written ones. In this scenario we can have all genconf
generated files into a GenConf
namespace package (with the pkgutil
style namespace __init__.py
created at configure time only for Python2) somewhere in the build tree, to then be installed alongside all other Python packages.
While this approach can be implemented transparently for LHCb (we only use the configurables database), we would need an ATLAS backward compatibility hack, because the only use from MyPackage.MyCompLibConf import MyAlg
(we could inject some clever metamodule trick, but it has to be an explicit opt-in (I do not want inject code into each package __init__.py
).