From 0fefab66514ac10acaed754793df3106fca4c4a8 Mon Sep 17 00:00:00 2001 From: Toshio Kuratomi Date: Fri, 14 Mar 2014 11:37:24 -0700 Subject: [PATCH 1/5] Require a recent enough version of pycrypto and see that playbook and vault ues it. --- bin/ansible-playbook | 3 +++ bin/ansible-vault | 3 +++ setup.py | 2 +- 3 files changed, 7 insertions(+), 1 deletion(-) diff --git a/bin/ansible-playbook b/bin/ansible-playbook index 5aa020a924..8714f95ab9 100755 --- a/bin/ansible-playbook +++ b/bin/ansible-playbook @@ -18,6 +18,9 @@ ####################################################### +__requires__ = ['ansible'] +import pkg_resources + import sys import os import stat diff --git a/bin/ansible-vault b/bin/ansible-vault index 2c8094d13b..a2f40362a1 100755 --- a/bin/ansible-vault +++ b/bin/ansible-vault @@ -20,6 +20,9 @@ # example playbook to bootstrap this script in the examples/ dir which # installs ansible and sets it up to run on cron. +__requires__ = ['ansible'] +import pkg_resources + import os import sys import traceback diff --git a/setup.py b/setup.py index c537ee9766..34425e1f37 100644 --- a/setup.py +++ b/setup.py @@ -29,7 +29,7 @@ setup(name='ansible', author_email='michael@ansible.com', url='http://ansible.com/', license='GPLv3', - install_requires=['paramiko', 'jinja2', "PyYAML"], + install_requires=['paramiko', 'jinja2', "PyYAML", 'setuptools', 'pycrypto >= 2.6'], package_dir={ 'ansible': 'lib/ansible' }, packages=[ 'ansible', From 17f134ca023fff9c8e5b5ab3910dd034b37c0391 Mon Sep 17 00:00:00 2001 From: Toshio Kuratomi Date: Fri, 14 Mar 2014 12:38:01 -0700 Subject: [PATCH 2/5] distutils' requires parameter doesn't work with setuptools. Use setuptools' instal_requires instead --- setup.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/setup.py b/setup.py index 34425e1f37..3ae7cedef9 100644 --- a/setup.py +++ b/setup.py @@ -6,7 +6,7 @@ from glob import glob sys.path.insert(0, os.path.abspath('lib')) from ansible import __version__, __author__ -from distutils.core import setup +from setuptools import setup # find library modules from ansible.constants import DEFAULT_MODULE_PATH From e622074812a9af54cac7638630cccacfccd5637f Mon Sep 17 00:00:00 2001 From: Toshio Kuratomi Date: Wed, 2 Apr 2014 13:36:41 -0700 Subject: [PATCH 3/5] Prnt error message is unable to use setuptools when building --- setup.py | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/setup.py b/setup.py index 3ae7cedef9..166f754ac5 100644 --- a/setup.py +++ b/setup.py @@ -6,7 +6,17 @@ from glob import glob sys.path.insert(0, os.path.abspath('lib')) from ansible import __version__, __author__ -from setuptools import setup +try: + from setuptools import setup + raise ImportError +except ImportError: + print(''' +ansible now needs setuptools in order to build. + +Some scripts now need setuptools installed in order to run. + ''') + raise + # find library modules from ansible.constants import DEFAULT_MODULE_PATH From ff7492c2cc008110b890f320b10747bbae4f9b6a Mon Sep 17 00:00:00 2001 From: Toshio Kuratomi Date: Wed, 2 Apr 2014 13:37:16 -0700 Subject: [PATCH 4/5] Add Requires to the specfile for setuptools and the python-crypto2.6 forward compat package --- packaging/rpm/ansible.spec | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/packaging/rpm/ansible.spec b/packaging/rpm/ansible.spec index 298450d964..76767791b5 100644 --- a/packaging/rpm/ansible.spec +++ b/packaging/rpm/ansible.spec @@ -25,6 +25,12 @@ Requires: python26-paramiko Requires: python26-jinja2 Requires: python26-keyczar Requires: python26-httplib2 +Requires: python26-setuptools +%endif + +# RHEL == 6 +%if 0%{?rhel} == 6 +Requires: python-crypto2.6 %endif # RHEL > 5 @@ -35,6 +41,7 @@ Requires: python-paramiko Requires: python-jinja2 Requires: python-keyczar Requires: python-httplib2 +Requires: python-setuptools %endif # FEDORA > 17 @@ -45,6 +52,7 @@ Requires: python-paramiko Requires: python-jinja2 Requires: python-keyczar Requires: python-httplib2 +Requires: python-setuptools %endif # SuSE/openSuSE @@ -56,6 +64,7 @@ Requires: python-jinja2 Requires: python-keyczar Requires: python-yaml Requires: python-httplib2 +Requires: python-setuptools %endif Requires: sshpass From 8e66a6c811ecf8ed5993bb5b7ca12bc0a92671aa Mon Sep 17 00:00:00 2001 From: James Cammarata Date: Tue, 29 Apr 2014 14:53:44 -0500 Subject: [PATCH 5/5] Cleaning up the import testing around setuptools --- setup.py | 11 +++-------- 1 file changed, 3 insertions(+), 8 deletions(-) diff --git a/setup.py b/setup.py index 166f754ac5..61e650696b 100644 --- a/setup.py +++ b/setup.py @@ -8,15 +8,10 @@ sys.path.insert(0, os.path.abspath('lib')) from ansible import __version__, __author__ try: from setuptools import setup - raise ImportError except ImportError: - print(''' -ansible now needs setuptools in order to build. - -Some scripts now need setuptools installed in order to run. - ''') - raise - + print "Ansible now needs setuptools in order to build. " + \ + "Install it using your package manager (usually python-setuptools) or via pip (pip install setuptools)." + sys.exit(1) # find library modules from ansible.constants import DEFAULT_MODULE_PATH