From 74911e80ce244e46f61a48d824a59aaf1b1ad24d Mon Sep 17 00:00:00 2001 From: Sergio Oliveira Date: Thu, 31 Jul 2014 19:46:08 -0300 Subject: [PATCH] Install pkg_resource before using it --- puppet/bootstrap.py | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/puppet/bootstrap.py b/puppet/bootstrap.py index 9b4fa0f..64e94b2 100644 --- a/puppet/bootstrap.py +++ b/puppet/bootstrap.py @@ -8,9 +8,16 @@ import subprocess import urllib from distutils.version import StrictVersion -from pkg_resources import parse_requirements from shutil import copyfile +try: + from pkg_resources import parse_requirements +except ImportError: + # Needed dependency for import pkg_resources + pkg_res = ['apt-get', 'install', 'python-pkg-resources', '-y'] + subprocess.call(pkg_res) + from pkg_resources import parse_requirements + PUPPET_TARGET_VERSION = "3.6.2" PUPPET_DIR = os.path.join(os.path.dirname(__file__)) MODULES_FILE_PATH = os.path.join(PUPPET_DIR, 'modules.txt') @@ -129,9 +136,6 @@ def main(): update = ['apt-get', 'update', '-y'] install = ['apt-get', 'install', 'puppet', '-y'] - # Needed dependency for import pkg_resources - pkg_res = ['apt-get', 'install', 'python-pkg-resources', '-y'] - subprocess.call(pkg_res) else: print('This distribuition is currently not supported!') print('exiting...') -- libgit2 0.21.2