diff options
| author | james.page@ubuntu.com <> | 2015-04-22 14:24:09 +0100 |
|---|---|---|
| committer | james.page@ubuntu.com <> | 2015-04-22 14:24:09 +0100 |
| commit | fabcb8eb1defb287abe55ef81888eadff105c9f6 (patch) | |
| tree | 465991ebc2660c6698bbd1943beb2c966284fa75 /hooks | |
| parent | fc2b9488f9db69302eb063369f2069289c932e91 (diff) | |
Deal with yaml import if need be
Diffstat (limited to 'hooks')
| -rwxr-xr-x | hooks/hooks.py | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/hooks/hooks.py b/hooks/hooks.py index 95a67d6..941caed 100755 --- a/hooks/hooks.py +++ b/hooks/hooks.py @@ -13,7 +13,15 @@ import socket import subprocess import sys import time -import yaml + +try: + import yaml # flake8: noqa +except ImportError: + if sys.version_info.major == 2: + subprocess.check_call(['apt-get', 'install', '-y', 'python-yaml']) + else: + subprocess.check_call(['apt-get', 'install', '-y', 'python3-yaml']) + import yaml # flake8: noqa from os import chmod from os import remove |
