Currently we put our python path as the first one in sys.path. This has several problems:
a) We override the system modules, providing a different implementation than the system expects. This will eventually cause crashes.
b) The module actually loaded is unpredictable. If the module gets loaded before we modify sys.path, then we get the system version. If it gets loaded later then we get our version. Since we don't know what other imports will load, the module actually loaded is somewhat random.
Putting our path at the end would mostly solve these issues. A portion of b) still remains though:
c) Our code can't be sure we loaded our version of a module.
Solving this is non-trivial though...
The best idea so far is to move everything into a new namespace (e.g. under the "thinlinc" module). This will allow us to load our versions without conflicting with the system ones.
One potential problem though is that complex modules (e.g. Cheetah) do internal imports. We need to check that these work properly if we start moving things around.
The things we have left are:
Cheetah does internal imports that can not be handled with Python 2. Therefore this bug must be done after the Python 3 conversion is done.
Pull request/Merge request for upstream projects:
Tested that the following still works on Ubuntu 20.04:
- TLDC UI (in tlwebadm)
- Mounting and unmounting local drives
- Web Access login
- Profile chooser/runner
Everything* is now moved in to the thinlinc namespace. Hiveconf is imported basically everywhere, but I've tested the main bits:
* All services start
* tlwebadm works
* tlwebaccess works
* Login works
* profile chooser works
* tl-config works
* tl-mount-localdrives works
* tl-session-param works
* thinlocal works
* no errors in xinit.log
* Except sitecustomize.py, which must be in the root
Tested on a Fedora 33 machine running Jenkins server build #2244:
- [3/3] General tests
- [X] Login works as expected.
- [X] No errors in xinit.log.
- [X] All affected imports are now made from thinlinc.X instead of X.
- [2/2] pyaes
- [X] tl-sso-password works as intended.
- [X] tl-sso-update-password works as intended.
- [2/2] pyxdg
- [X] Profile chooser works as expected with GNOME/GNOME Classic installed.
- [X] System applications correctly listed in tlwebadm.
- [1/1] mountclient/rpc
- [X] Local drive redirection works as expected.
- [3/3] Cheetah
- [X] All Cheetah files intended for library use uses relative imports.
- [X] All pages on tlwebadm render correctly.
- [X] All pages on tlwebaccess render correctly.
- [2/2] hiveconf
- [X] thinlocal works as expected.
- [X] tl-config works as expected.