forked from django-cache-machine/django-cache-machine
-
Notifications
You must be signed in to change notification settings - Fork 0
/
fabfile.py
57 lines (43 loc) · 1.53 KB
/
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
46
47
48
49
50
51
52
53
54
55
56
57
"""
Creating standalone Django apps is a PITA because you're not in a project, so
you don't have a settings.py file. I can never remember to define
DJANGO_SETTINGS_MODULE, so I run these commands which get the right env
automatically.
"""
import functools
import os
import sys
from fabric.api import local, cd, env
from fabric.contrib.project import rsync_project
NAME = os.path.basename(os.path.dirname(__file__))
ROOT = os.path.abspath(os.path.dirname(__file__))
os.environ['PYTHONPATH'] = os.pathsep.join([ROOT,
os.path.join(ROOT, 'examples')])
env.hosts = ['jbalogh.me']
local = functools.partial(local, capture=False)
def doc(kind='html'):
with cd('docs'):
local('make clean %s' % kind)
SETTINGS = ('locmem_settings',
'settings',
'memcache_byid',
'custom_backend')
try:
import redis
redis.Redis(host='localhost', port=6379).info()
SETTINGS += ('redis_settings', 'redis_byid')
except Exception:
print 'WARNING: Skipping redis tests.'
def test():
if sys.version_info[0] == 2 and sys.version_info[1] < 7:
import django
if django.VERSION[1] >= 7:
print("Skipping becuase Django >= 1.7 doesn't work with Python < 2.7")
return
for settings in SETTINGS:
print(settings)
os.environ['DJANGO_SETTINGS_MODULE'] = 'cache_machine.%s' % settings
local('django-admin.py test')
def updoc():
doc('dirhtml')
rsync_project('p/%s' % NAME, 'docs/_build/dirhtml/', delete=True)