Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Move to using a requirements.txt to install the python packages. #21430

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
1 change: 1 addition & 0 deletions MANIFEST.in
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
prune ticket_stubs
prune hacking
include README.md COPYING
include requirements.txt
include examples/hosts
include examples/ansible.cfg
include lib/ansible/module_utils/powershell.ps1
Expand Down
8 changes: 5 additions & 3 deletions docs/docsite/rst/intro_installation.rst
Original file line number Diff line number Diff line change
Expand Up @@ -330,9 +330,11 @@ If you don't have pip installed in your version of Python, install pip::

$ sudo easy_install pip

Ansible also uses the following Python modules that need to be installed [1]_::
Ansible also uses the following Python modules that need to be installed [1]_:

$ sudo pip install paramiko PyYAML Jinja2 httplib2 six
.. code-block:: bash

$ sudo pip install -r ./requirements.txt

To update ansible checkouts, use pull-with-rebase so any local changes are replayed.

Expand Down Expand Up @@ -383,4 +385,4 @@ You can also use "sudo make install".
`irc.freenode.net <http://irc.freenode.net>`_
#ansible IRC chat channel

.. [1] If you have issues with the "pycrypto" package install on Mac OSX, which is included as a dependency for paramiko, then you may need to try "CC=clang sudo -E pip install pycrypto".
.. [1] If you have issues with the "pycrypto" package install on Mac OSX, then you may need to try ``CC=clang sudo -E pip install pycrypto``.
10 changes: 10 additions & 0 deletions requirements.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
# Note: this requirements.txt file is used to specify what dependencies are
# needed to make the package run rather than for deployment of a tested set of
# packages. Thus, this should be the loosest set possible (only required
# packages, not optional ones, and with the widest range of versions that could
# be suitable)
jinja2
PyYAML
paramiko
pycrypto >= 2.6
setuptools
9 changes: 8 additions & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,13 @@
" install setuptools).")
sys.exit(1)

with open('requirements.txt') as requirements_file:
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

CI failure due to python 2.4 syntax error:

2017-02-14 21:07:55 Compiling ./setup.py ...
2017-02-14 21:07:55   File "./setup.py", line 14
2017-02-14 21:07:55     with open('requirements.txt') as requirements_file:
2017-02-14 21:07:55             ^
2017-02-14 21:07:55 SyntaxError: invalid syntax

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

setup.py shouldn't be checked for py2.4 support. It will only run on py2.6+ as it is controller only

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah yes, good catch. It will need to be added to the python 2.4 compile skip list:

https://github.com/ansible/ansible/blob/devel/test/compile/python2.4-skip.txt

install_requirements = requirements_file.read().splitlines()
if not install_requirements:
print("Unable to read requirements from the requirements.txt file"
"That indicates this copy of the source code is incomplete.")
sys.exit(2)

setup(
name='ansible',
version=__version__,
Expand All @@ -21,7 +28,7 @@
license='GPLv3',
# Ansible will also make use of a system copy of python-six and
# python-selectors2 if installed but use a Bundled copy if it's not.
install_requires=['paramiko', 'jinja2', "PyYAML", 'setuptools', 'pycrypto >= 2.6'],
install_requires=install_requirements,
package_dir={ '': 'lib' },
packages=find_packages('lib'),
package_data={
Expand Down
1 change: 1 addition & 0 deletions test/compile/python2.4-skip.txt
Original file line number Diff line number Diff line change
Expand Up @@ -53,4 +53,5 @@
/lib/ansible/template/
/lib/ansible/utils/
/lib/ansible/vars/
/setup.py
/test/