~corey.bryant/charms/trusty/ceilometer/git-ods

« back to all changes in this revision

Viewing changes to hooks/charmhelpers/__init__.py

  • Committer: james.page at ubuntu
  • Date: 2014-12-15 09:22:07 UTC
  • mfrom: (57.1.8 ceilometer)
  • Revision ID: james.page@ubuntu.com-20141215092207-fe1sx9p4izbdyw61
[corey.bryant,r=james-page] Sort out charmhelpers issues.

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
# Bootstrap charm-helpers, installing its dependencies if necessary using
 
2
# only standard libraries.
 
3
import subprocess
 
4
import sys
 
5
 
 
6
try:
 
7
    import six  # flake8: noqa
 
8
except ImportError:
 
9
    if sys.version_info.major == 2:
 
10
        subprocess.check_call(['apt-get', 'install', '-y', 'python-six'])
 
11
    else:
 
12
        subprocess.check_call(['apt-get', 'install', '-y', 'python3-six'])
 
13
    import six  # flake8: noqa
 
14
 
 
15
try:
 
16
    import yaml  # flake8: noqa
 
17
except ImportError:
 
18
    if sys.version_info.major == 2:
 
19
        subprocess.check_call(['apt-get', 'install', '-y', 'python-yaml'])
 
20
    else:
 
21
        subprocess.check_call(['apt-get', 'install', '-y', 'python3-yaml'])
 
22
    import yaml  # flake8: noqa