github.com/niedbalski/juju@v0.0.0-20190215020005-8ff100488e47/acceptancetests/repository/trusty/haproxy/hooks/charmhelpers/__init__.py (about) 1 # Copyright 2014-2015 Canonical Limited. 2 # 3 # This file is part of charm-helpers. 4 # 5 # charm-helpers is free software: you can redistribute it and/or modify 6 # it under the terms of the GNU Lesser General Public License version 3 as 7 # published by the Free Software Foundation. 8 # 9 # charm-helpers is distributed in the hope that it will be useful, 10 # but WITHOUT ANY WARRANTY; without even the implied warranty of 11 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 # GNU Lesser General Public License for more details. 13 # 14 # You should have received a copy of the GNU Lesser General Public License 15 # along with charm-helpers. If not, see <http://www.gnu.org/licenses/>. 16 17 # Bootstrap charm-helpers, installing its dependencies if necessary using 18 # only standard libraries. 19 import subprocess 20 import sys 21 22 try: 23 import six # flake8: noqa 24 except ImportError: 25 if sys.version_info.major == 2: 26 subprocess.check_call(['apt-get', 'install', '-y', 'python-six']) 27 else: 28 subprocess.check_call(['apt-get', 'install', '-y', 'python3-six']) 29 import six # flake8: noqa 30 31 try: 32 import yaml # flake8: noqa 33 except ImportError: 34 if sys.version_info.major == 2: 35 subprocess.check_call(['apt-get', 'install', '-y', 'python-yaml']) 36 else: 37 subprocess.check_call(['apt-get', 'install', '-y', 'python3-yaml']) 38 import yaml # flake8: noqa