-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathops.py
38 lines (31 loc) · 1.04 KB
/
ops.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
"""Operations module for <Django Project Name>
Copyright 2011-2012 Plexical. See LICENCE for permissions.
"""
from paver.easy import *
import sys
from glob import glob
class DependencyNeeded(Exception):
pass
def have(name):
return ('command not found' not in
sh(name, capture=True, ignore_error=True) )
def check(name):
if not have(name):
raise DependencyNeeded('Please install %s first' % name)
def software(name):
def missing():
raise DependencyNeeded('Please install %s first '
'using your package manager' % name)
if have(name):
return ''
elif sys.platform == 'darwin':
if have('brew'):
path = glob('/usr/local/Cellar/%s/**/bin' % name)
if path:
return 'PATH=%s:$PATH' % path[0]
missing()
else:
raise DependencyNeeded('Please install homebrew: '
'http://mxcl.github.com/homebrew/')
elif sys.platform.startswith('linux'):
missing()