mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-11-26 03:31:05 +00:00
gst-uninstalled: make override hacks work in virtualenv
virtualenv ships its own version of site.py, which does not expose a getusersitepackages function. An alternative method is thus used when we detect that we are running in a virtualenv.
This commit is contained in:
parent
a5ed8944e3
commit
a484ed4124
1 changed files with 11 additions and 1 deletions
|
@ -11,6 +11,8 @@ import subprocess
|
||||||
import sys
|
import sys
|
||||||
import tempfile
|
import tempfile
|
||||||
|
|
||||||
|
from distutils.sysconfig import get_python_lib
|
||||||
|
|
||||||
from common import get_meson
|
from common import get_meson
|
||||||
|
|
||||||
SCRIPTDIR = os.path.dirname(os.path.realpath(__file__))
|
SCRIPTDIR = os.path.dirname(os.path.realpath(__file__))
|
||||||
|
@ -137,6 +139,10 @@ def get_subprocess_env(options):
|
||||||
|
|
||||||
return env
|
return env
|
||||||
|
|
||||||
|
# https://stackoverflow.com/questions/1871549/determine-if-python-is-running-inside-virtualenv
|
||||||
|
def in_venv():
|
||||||
|
return (hasattr(sys, 'real_prefix') or
|
||||||
|
(hasattr(sys, 'base_prefix') and sys.base_prefix != sys.prefix))
|
||||||
|
|
||||||
def python_env(options, unset_env=False):
|
def python_env(options, unset_env=False):
|
||||||
"""
|
"""
|
||||||
|
@ -150,7 +156,11 @@ def python_env(options, unset_env=False):
|
||||||
not os.path.exists(gst_python_path):
|
not os.path.exists(gst_python_path):
|
||||||
return False
|
return False
|
||||||
|
|
||||||
sitepackages = site.getusersitepackages()
|
if in_venv ():
|
||||||
|
sitepackages = get_python_lib()
|
||||||
|
else:
|
||||||
|
sitepackages = site.getusersitepackages()
|
||||||
|
|
||||||
if not sitepackages:
|
if not sitepackages:
|
||||||
return False
|
return False
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue