Browse files

Make srrun handle mac AND development in virtualenv

This way we can use it locally to run the wpr exploder (coming in the
next commit), which needs access to our local copy of the wpr library.
  • Loading branch information...
nwgh committed Mar 14, 2013
1 parent 776dd15 commit ebf0d3bcbe9050c26aa5cb31a4c0512078683c3c
Showing with 17 additions and 1 deletion.
  1. +17 −1
@@ -11,9 +11,25 @@
mypath = os.path.abspath(__file__)
mydir = os.path.split(mypath)[0]
-if platform.system().lower() == 'windows':
+if os.getenv('VIRTUAL_ENV'):
+ # If we're running in a virtualenv, then we're doing development, and we
+ # want to use the virtualenv's python, no matter what system we're running
+ # on, since the virtualenv is the only python guaranteed to have all our
+ # required third-party modules installed.
srpython = sys.executable
+elif platform.system().lower() == 'windows':
+ # Windows doesn't have any special installation, since python doesn't come
+ # on windows by default.
+ srpython = sys.executable
+elif platform.system().lower() == 'darwin':
+ # For Mac, we need to make sure we use the homebrew-installed python,
+ # instead of the system one, which is out of date.
+ srpython = '/usr/local/bin/python'
+ # This should handle linux, where we install our own built python in the
+ # srhome directory to ensure we're using a modern-enough python instead of
+ # whatever may have been installed with the system (which may or may not
+ # be modern enough for our purposes).
srhome = os.path.join(mydir, '..')
srhome = os.path.abspath(srhome)
srbin = os.path.join(srhome, 'bin')

0 comments on commit ebf0d3b

Please sign in to comment.