Python: Support loading from a virtualenv

This commit is contained in:
Vicki Pfau 2017-08-13 18:09:58 -07:00
parent 0ba31c4e67
commit ce07344c7d
1 changed files with 5 additions and 0 deletions

View File

@ -71,6 +71,11 @@ for line in preprocessed.splitlines():
ffi.embedding_api('\n'.join(lines))
ffi.embedding_init_code("""
import os, os.path
venv = os.getenv('VIRTUAL_ENV')
if venv:
activate = os.path.join(venv, 'bin', 'activate_this.py')
execfile(activate, dict(__file__=activate))
from mgba._pylib import ffi, lib
symbols = {}
globalSyms = {