#!/usr/bin/python3
#
# Copyright (c) 2017 Red Hat, Inc.
#
# This software is licensed to you under the GNU General Public License,
# version 3 (GPLv3). There is NO WARRANTY for this software, express or
# implied, including the implied warranties of MERCHANTABILITY or FITNESS
# FOR A PARTICULAR PURPOSE. You should have received a copy of GPLv3
# along with this software; if not, see
# https://www.gnu.org/licenses/gpl-3.0.txt.
#
"""Script for running qpc command line tool"""

from __future__ import print_function
import gettext
import os
import sys

if sys.version_info[0] < 3 or \
   (sys.version_info[0] == 3 and sys.version_info[1] < 4):
    print(('Error: qpc must be run with Python 3.4 or greater '
           '(current version is {0}.{1}, from {2}).').format(
               sys.version_info[0], sys.version_info[1], sys.executable))
    sys.exit(1)

BASE_QPC_DIR = os.path.abspath(
    os.path.normpath(
        os.path.join(os.path.dirname(sys.argv[0]), '..')))
QPC_PATH = os.path.join(BASE_QPC_DIR, 'quipucords')
sys.path.insert(0, QPC_PATH)

# pylint: disable=wrong-import-position
from qpc.cli import CLI  # noqa

gettext.install('qpc')

if __name__ == "__main__":
    CLI().main()
