Allow ARA module to be run

Allows calling ARA as a module with "python -m ara ..." which
allows using it in cases where CLI executables are not installed
or not available. For example user could install module
using "pip install --user ara " and run ara using "python -m ara".

Change-Id: Ib2dde43fa7b3b16f24d4fe12c2ec906871c1cded
Signed-off-by: Sorin Sbarnea <ssbarnea@redhat.com>
This commit is contained in:
Sorin Sbarnea 2018-04-23 11:22:37 +01:00 committed by David Moreau Simard
parent 87272840bf
commit de0929f0c1
2 changed files with 33 additions and 1 deletions

23
ara/__main__.py Normal file
View File

@ -0,0 +1,23 @@
#!/usr/bin/env python
# Copyright (c) 2018 Red Hat, Inc.
#
# This file is part of ARA Records Ansible.
#
# ARA is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# ARA is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with ARA. If not, see <http://www.gnu.org/licenses/>.
from ara.shell import main
import sys
if __name__ == '__main__':
sys.exit(main(sys.argv[1:]))

View File

@ -54,4 +54,13 @@ Installing ARA from latest release on PyPi
::
pip install ara
pip install [--user] ara
When installing ARA using ``--user``, command line scripts will be installed
inside ``~/.local/bin`` folder which may not be in ``PATH``. You may want to
assure that this folder is in PATH or to use the alternative calling method
``pyhton -m ara`` which calls Ansible module directly.
The alternative calling method has the advantage that allows user to control
which python interpreter would be used. For example you could install ARA in
both python2 and python3 and call the one you want.