-
Notifications
You must be signed in to change notification settings - Fork 4
/
fabfile.py
45 lines (33 loc) · 1001 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
35
36
37
38
39
40
41
42
43
44
45
from fabric.api import local, cd, prefix, shell_env
from contextlib import contextmanager as _contextmanager
import os
root = os.path.realpath(os.path.dirname(__file__))
venv = '.env'
project = 'mailqueue'
specific_env = {
'Darwin': dict(
# solution of http://goo.gl/J6GEyh
CFLAGS='-Qunused-arguments',
CPPFLAGS='-Qunused-arguments',
),
}
@_contextmanager
def _virtualenv():
if not os.path.exists(venv):
init_venv()
with prefix('source {}/bin/activate'.format(venv)):
yield
def init_venv():
with cd(root):
local('virtualenv ' + venv)
with _virtualenv():
with shell_env(**specific_env.get(os.uname()[0], {})):
local('pip install -r requirements.txt')
local('pip install nose coverage django_nose')
def test():
local('tox')
def build():
with cd(root):
with _virtualenv():
local('python setup.py build sdist')
local('rm -rf build')