summaryrefslogtreecommitdiff
path: root/setup.py
diff options
context:
space:
mode:
authorToshio Kuratomi <a.badger@gmail.com>2017-06-01 15:29:30 -0700
committerToshio Kuratomi <a.badger@gmail.com>2017-06-02 12:05:45 -0700
commit9bbd48ad5f4e082f77fc704215821e1448d8dc43 (patch)
tree1df798e5d3cf609cccc94038cbf5bef2e0f77a6c /setup.py
parent365d06c5389b669dd6b006c9b854b1f5720c5455 (diff)
downloadansible-9bbd48ad5f4e082f77fc704215821e1448d8dc43.tar.gz
Make setting of metadata for crypto backend settable at buildtime
Working on several separate ideas to make ansible work with both cryptography or pycrypto. This particular change will let a user installing ansible change which crypto backend gets encoded in the metadata (and hence, which backend is required by pkg_resource). This works with both setup.py and pip:: ANSIBLE_CRYPTO_BACKEND=cryptography pip install ansible ANSIBLE_CRYPTO_BACKEND=cryptography python2 ./setup.py Note that the code to use cryptography is not yet merged so using ANSIBLE_CRYPTO_BACKEND is not yet a good idea (as it can lead to not installing pycrypto and hence the current vault code will fail). Related to: #20566
Diffstat (limited to 'setup.py')
-rw-r--r--setup.py10
1 files changed, 10 insertions, 0 deletions
diff --git a/setup.py b/setup.py
index 11a15bd2b3..d43fd299ff 100644
--- a/setup.py
+++ b/setup.py
@@ -19,6 +19,16 @@ with open('requirements.txt') as requirements_file:
"That indicates this copy of the source code is incomplete.")
sys.exit(2)
+# pycrypto or cryptography. We choose a default but allow the user to
+# override it. This translates into pip install of the sdist deciding what
+# package to install and also the runtime dependencies that pkg_resources
+# knows about
+crypto_backend = os.environ.get('ANSIBLE_CRYPTO_BACKEND', None)
+if crypto_backend:
+ install_requirements = [r for r in install_requirements if not (r.lower().startswith('pycrypto') or r.lower().startswith('cryptography'))]
+ install_requirements.append(crypto_backend)
+
+
SYMLINKS = {'ansible': frozenset(('ansible-console',
'ansible-doc',
'ansible-galaxy',