Update check-requirements for py3
This updates the virtual environment handling to assume it is running with Python 3.7 instead of 2.7. It also updates the virtualenv detection to recognize if it is running python from a virtualenv without the virtualenv actually being activated. Change-Id: Ib841f1d6a683eff4836bfeeb73678199745a3a2f Signed-off-by: Sean McGinnis <sean.mcginnis@gmail.com>
This commit is contained in:
parent
ca652db8e8
commit
50f69d5296
@ -78,17 +78,21 @@ def tempdir():
|
||||
|
||||
|
||||
def install_and_load_requirements(reqroot, reqdir):
|
||||
if os.environ.get('VIRTUAL_ENV'):
|
||||
"""This makes sure a virtualenv is used before attempting to import."""
|
||||
if os.environ.get('VIRTUAL_ENV') or hasattr(sys, 'real_prefix'):
|
||||
print('It looks like we are running from a virtualenv.')
|
||||
print('SKIPPING INSTALLATION')
|
||||
else:
|
||||
sha = run_command("git --git-dir %s/.git rev-parse HEAD" % reqdir)[0]
|
||||
print("requirements git sha: %s" % sha)
|
||||
version = sys.version_info
|
||||
req_venv = os.path.join(reqroot, 'venv')
|
||||
req_pip = os.path.join(req_venv, 'bin/pip')
|
||||
req_lib = os.path.join(req_venv, 'lib/python2.7/site-packages')
|
||||
out, err = run_command("virtualenv " + req_venv)
|
||||
out, err = run_command(req_pip + " install " + reqdir)
|
||||
req_pip = os.path.join(req_venv, 'bin/pip3')
|
||||
req_lib = os.path.join(
|
||||
req_venv,
|
||||
'lib/python%s.%s/site-packages' % (version[0], version[1]))
|
||||
_, _ = run_command("virtualenv " + req_venv)
|
||||
_, _ = run_command(req_pip + " install " + reqdir)
|
||||
sys.path.append(req_lib)
|
||||
global check
|
||||
global project
|
||||
|
Loading…
x
Reference in New Issue
Block a user