-
Notifications
You must be signed in to change notification settings - Fork 13
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Use fabric to create a tmp venv and install
- Loading branch information
1 parent
57d341f
commit ada17f5
Showing
2 changed files
with
11 additions
and
17 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,20 +1,17 @@ | ||
import os | ||
import tempfile | ||
|
||
import virtualenv | ||
from fabric.api import local | ||
|
||
|
||
def create_venv(tmp_dir=None): | ||
if not tmp_dir: | ||
tmp_dir = tempfile.mkdtemp() | ||
virtualenv.create_environment(tmp_dir, site_packages=False) | ||
local('virtualenv --no-site-packages %s' % tmp_dir) | ||
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, | ||
) | ||
local('%s/bin/pip install %s' % (venv_dir, package_name)) |