~free.ekanayaka/landscape-charm/install-from-deb

« back to all changes in this revision

Viewing changes to hooks/lib/setup.py

  • Committer: Free Ekanayaka
  • Date: 2015-01-28 11:53:32 UTC
  • mfrom: (222.1.5 testable-install-hook)
  • Revision ID: free.ekanayaka@canonical.com-20150128115332-4fjkh28z3lqf136x
MergeĀ fromĀ testable-install-hook

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
# XXX this is auto-generated charm-tools boilerplate code, eventually we
2
 
#     should pull charmhelpers from a package instead using PIP.
3
 
 
4
 
 
5
 
def pre_install():
6
 
    """
7
 
    Do any setup required before the install hook.
8
 
    """
9
 
    install_charmhelpers()
10
 
 
11
 
 
12
 
def install_charmhelpers():
13
 
    """
14
 
    Install the charmhelpers library, if not present.
15
 
    """
16
 
    try:
17
 
        import charmhelpers  # noqa
18
 
    except ImportError:
19
 
        import subprocess
20
 
        subprocess.check_call(['apt-get', 'install', '-y', 'python-pip'])
21
 
        subprocess.check_call(['pip', 'install', 'charmhelpers'])