Skip to content
Snippets Groups Projects
Commit 4bf5007b authored by Jared Hirsch's avatar Jared Hirsch
Browse files

Merge pull request #2376 from graingert/patch-4

use pkg_resources instead of which() for modules
parents 4adffd41 681cb29a
No related branches found
No related tags found
No related merge requests found
......@@ -5,6 +5,7 @@ import os
import platform
import subprocess
import sys
import pkg_resources
# used to check for existence of virtualenv and pip.
......@@ -59,13 +60,10 @@ def main():
exit(1)
# 2. check that virtualenv and pip exist. if not, bail.
if not which('pip'):
sys.stderr.write('pip must be installed; do "easy_install pip", ' +
' then try again\n')
exit(1)
if not which('virtualenv'):
sys.stderr.write('virtualenv must be installed; do "pip install ' +
'virtualenv", then try again\n')
try:
pkg_resources.WorkingSet().require('pip', 'virtualenv')
except pkg_resources.DistributionNotFound as e:
sys.stderr.write('{package} must be installed\n'.format(package=e.message))
exit(1)
# 3. create the virtualenv if they asked you to install it or it's missing
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment