automatically write .workon when creating new env w/ mk

This commit is contained in:
Kenneth Reitz
2011-08-12 09:55:36 -04:00
parent 54e72ce3a8
commit 18e84dffe6
+4 -4
View File
@@ -7,7 +7,7 @@ import sys
def find_above(*names):
"""Attempt to locate a .workon file by searching parent dirs."""
path = '.'
while os.path.split(os.path.abspath(path))[1]:
@@ -19,11 +19,11 @@ def find_above(*names):
if __name__ == '__main__':
wo_file = find_above('.workon')
if wo_file and not 'VIRTUAL_ENV' in os.environ.keys():
with open(wo_file) as f:
print('source {0}/bin/activate'.format(f.read()))
print('source {0}/bin/activate'.format(f.readlines()[0]))
elif not wo_file and 'VIRTUAL_ENV' in os.environ.keys():
print('deactivate')