uninstalled: use usercustomize, not sitecustomize

Currently, gst-uninstalled is using sitecustomize.py for adding gi
override tweaks. However, if the standard Python libraries come before
this file in sys.path, then sitecustomize.py will never be run because
the "import sitecustomize" done in site.py will use the standard Python
libraries instead. This can be seen by running "import sitecustomize;
print(sitecustomize.__file__)" inside the uninstalled environment, as
well as by checking gi.override.__path__ and seeing that the tweaks are
missing (and the overrides are misbehaving).

Switch to using usercustomize.py, which has no match in the standard
libraries and thus will be correctly imported.

https://bugzilla.gnome.org/show_bug.cgi?id=797011
This commit is contained in:
Martin Kelly 2018-08-22 09:11:47 -07:00 committed by Thibault Saunier
parent 56130b0edd
commit 4525078098

View file

@ -171,13 +171,13 @@ def setup_python_env(options, env):
else:
sitepackages = site.getusersitepackages()
sitecustomize = os.path.join(
usercustomize = os.path.join(
subprocess.check_output([sys.executable, '-c', 'import site; print(site.USER_SITE)'],
env={"PYTHONUSERBASE": PREFIX_DIR}).decode().strip("\n"), "sitecustomize.py")
env={"PYTHONUSERBASE": PREFIX_DIR}).decode().strip("\n"), "usercustomize.py")
custom_user_sitepackage = os.path.dirname(sitecustomize)
custom_user_sitepackage = os.path.dirname(usercustomize)
os.makedirs(custom_user_sitepackage, exist_ok=True)
with open(sitecustomize, "w") as f:
with open(usercustomize, "w") as f:
f.write("""import os
import gi.overrides