mirror of
https://github.com/kennethreitz-archive/dotfiles.git
synced 2026-06-05 23:40:16 +00:00
automatically write .workon when creating new env w/ mk
This commit is contained in:
@@ -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')
|
||||
|
||||
Reference in New Issue
Block a user