blob: cfd0731fc95b3c1518c3acde4e1cc7bd2e6af7d9 [file] [log] [blame]
# Activates the current venv as if the activate script had been sourced
import collections
import os
import sys
# Prepend the venv bin to PATH (without introducing duplicate entries)
path = [os.path.join(sys.prefix, 'bin')] + os.environ['PATH'].split(':')
os.environ['PATH'] = ':'.join(collections.OrderedDict.fromkeys(path).keys())
# Set VIRTUAL_ENV to the venv directory
os.environ['VIRTUAL_ENV'] = sys.prefix