Skip to content

Commit

Permalink
Add missing venv module
Browse files Browse the repository at this point in the history
  • Loading branch information
michaeljoseph committed Jul 6, 2014
1 parent 742c723 commit ca8b607
Showing 1 changed file with 20 additions and 0 deletions.
20 changes: 20 additions & 0 deletions changes/venv.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
import os
import tempfile

import virtualenv


def create_venv(tmp_dir=None):
if not tmp_dir:
tmp_dir = tempfile.mkdtemp()
virtualenv.create_environment(tmp_dir, site_packages=False)
return tmp_dir


def install(package_name, venv_dir):
if not os.path.exists(venv_dir):
venv_dir = create_venv()
virtualenv.install_wheel(
[package_name],
'%s/bin/python' % venv_dir,
)

0 comments on commit ca8b607

Please sign in to comment.