-
Notifications
You must be signed in to change notification settings - Fork 0
/
fabfile.py
34 lines (27 loc) · 844 Bytes
/
fabfile.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
import sys
from fabric.api import env, task, local
env.ve_directory = 'env'
class venv(object):
def __enter__(self):
if sys.platform == 'win32':
local(r'{}\Scripts\activate'.format(env.ve_directory))
else:
local(r'{}/bin/activate'.format(env.ve_directory))
def __exit__(self, _type, value, traceback):
if sys.platform == 'win32':
local(r'{}\Scripts\deactivate'.format(env.ve_directory))
else:
local(r'{}/bin/deactivate'.format(env.ve_directory))
@task
def bootstrap():
local('rm -rf {}'.format(env.ve_directory))
local('virtualenv {}'.format(env.ve_directory))
@task
def setup():
bootstrap()
with venv():
local('pip install -r requirements.txt')
@task
def runserver():
with venv():
local('python clockserver.py')