diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..cdf7318 --- /dev/null +++ b/.gitignore @@ -0,0 +1,26 @@ +*svn* +*.ipynb +*.pyc +*.pyo +.project +.pydevproject +*.swp +*.swo +build +dist +*.egg-info +pip-wheel-metadata/ +.settings +*.wpr +*.wpu +.idea +.coverage +cover +.DS_Store +*,cover +tags +.pytest_cache +.venv + +#VScode +.vscode/ diff --git a/bin/crhc-cli b/bin/crhc-cli new file mode 100644 index 0000000..30e4229 --- /dev/null +++ b/bin/crhc-cli @@ -0,0 +1,8 @@ +#!/usr/bin/env python +import os + +project_dir = os.path.dirname(os.path.dirname(__file__)) +os.sys.path.append(project_dir) + +from crhc_cli import crhc +crhc.parse.main_menu() \ No newline at end of file diff --git a/conf/__init__.py b/conf/__init__.py deleted file mode 100644 index e69de29..0000000 diff --git a/credential/__init__.py b/credential/__init__.py deleted file mode 100644 index e69de29..0000000 diff --git a/conf/conf.py b/crhc_cli/conf/conf.py similarity index 99% rename from conf/conf.py rename to crhc_cli/conf/conf.py index 43d5510..68ffa16 100644 --- a/conf/conf.py +++ b/crhc_cli/conf/conf.py @@ -48,5 +48,6 @@ # Items per page when doing the API call ITEMS_PER_PAGE = 50 + # Ansible has a max limit of 25 Items per page when doing the API call ANSIBLE_ITEMS_PER_PAGE = 25 diff --git a/credential/credential.py b/crhc_cli/credential/credential.py similarity index 100% rename from credential/credential.py rename to crhc_cli/credential/credential.py diff --git a/credential/token.py b/crhc_cli/credential/token.py similarity index 100% rename from credential/token.py rename to crhc_cli/credential/token.py diff --git a/crhc.py b/crhc_cli/crhc.py similarity index 86% rename from crhc.py rename to crhc_cli/crhc.py index dc0a971..439cddb 100755 --- a/crhc.py +++ b/crhc_cli/crhc.py @@ -6,7 +6,7 @@ console.redhat.com (Inventory, Subscription and much more) """ -from parse import parse +from crhc_cli.parse import parse if __name__ == "__main__": parse.main_menu() diff --git a/execution/execution.py b/crhc_cli/execution/execution.py similarity index 99% rename from execution/execution.py rename to crhc_cli/execution/execution.py index 93223f0..4adaaaa 100644 --- a/execution/execution.py +++ b/crhc_cli/execution/execution.py @@ -14,9 +14,9 @@ import time import requests import datetime -from report import report -from credential import token -from conf import conf +from crhc_cli.report import report +from crhc_cli.credential import token +from crhc_cli.conf import conf # FIELDS_TO_RETRIEVE = "?fields[system_profile]=number_of_sockets" FIELDS_TO_RETRIEVE = "" diff --git a/help/help_opt.py b/crhc_cli/help/help_opt.py similarity index 100% rename from help/help_opt.py rename to crhc_cli/help/help_opt.py diff --git a/parse/parse.py b/crhc_cli/parse/parse.py similarity index 99% rename from parse/parse.py rename to crhc_cli/parse/parse.py index 51da975..fecf30b 100644 --- a/parse/parse.py +++ b/crhc_cli/parse/parse.py @@ -6,12 +6,12 @@ import sys import json -from conf import conf -from execution import execution -from report import report -from credential import token -from troubleshoot import ts -from help import help_opt +from crhc_cli.conf import conf +from crhc_cli.execution import execution +from crhc_cli.report import report +from crhc_cli.credential import token +from crhc_cli.troubleshoot import ts +from crhc_cli.help import help_opt access_token = token.get_token() diff --git a/report/report.py b/crhc_cli/report/report.py similarity index 99% rename from report/report.py rename to crhc_cli/report/report.py index 43fc66d..a1197cb 100644 --- a/report/report.py +++ b/crhc_cli/report/report.py @@ -7,7 +7,7 @@ import csv import os import json -from conf import conf +from crhc_cli.conf import conf def check_for_installed_products(entries): diff --git a/troubleshoot/ts.py b/crhc_cli/troubleshoot/ts.py similarity index 99% rename from troubleshoot/ts.py rename to crhc_cli/troubleshoot/ts.py index 595dcb6..8da73a5 100644 --- a/troubleshoot/ts.py +++ b/crhc_cli/troubleshoot/ts.py @@ -8,9 +8,9 @@ import json import os from zipfile import ZipFile -from execution import execution -from report import report -from conf import conf +from crhc_cli.execution import execution +from crhc_cli.report import report +from crhc_cli.conf import conf def dump_inv_json(current_only): diff --git a/dist/crhc b/dist/crhc deleted file mode 100755 index 9ba8289..0000000 Binary files a/dist/crhc and /dev/null differ diff --git a/execution/__init__.py b/execution/__init__.py deleted file mode 100644 index e69de29..0000000 diff --git a/help/__init__.py b/help/__init__.py deleted file mode 100644 index e69de29..0000000 diff --git a/parse/__init__.py b/parse/__init__.py deleted file mode 100644 index e69de29..0000000 diff --git a/report/__init__.py b/report/__init__.py deleted file mode 100644 index e69de29..0000000 diff --git a/setup.py b/setup.py new file mode 100644 index 0000000..899039b --- /dev/null +++ b/setup.py @@ -0,0 +1,30 @@ +from setuptools import find_packages, setup + + +with open("README.md", "r") as fh: + long_description = fh.read() + +with open("requirements.txt", "r") as req: + requirements = req.readlines() + + +setup( + name="crhc-cli", + version="1.15.15", + author="Waldirio", + author_email="waldirio@gmail.com", + description="This project contains the crhc command line tool that simplifies the use of the C.RH.C API available at console.redhat.com", + long_description=long_description, + long_description_content_type="text/markdown", + install_requires=requirements, + url="https://github.com/C-RH-C/crhc-cli/", + packages=find_packages(), + python_requires=">=3.9", + scripts=['bin/crhc-cli'], + include_package_data=True, + classifiers=( + "Programming Language :: Python :: 3", + "License :: OSI Approved :: MIT License", + "Operating System :: OS Independent", + ), +) \ No newline at end of file diff --git a/tests/test_help.py b/tests/test_help.py index b3af856..490eb81 100644 --- a/tests/test_help.py +++ b/tests/test_help.py @@ -4,7 +4,7 @@ Module responsible for test the help menu content """ -from help import help_opt +from crhc_cli.help import help_opt def test_check_main_help_menu(): diff --git a/tests/test_report.py b/tests/test_report.py index 058686d..8e460b6 100644 --- a/tests/test_report.py +++ b/tests/test_report.py @@ -7,7 +7,7 @@ import csv import tempfile from pathlib import Path -from report import report +from crhc_cli.report import report INPUT_JSON = "tests/data/inventory.json" diff --git a/troubleshoot/__init__.py b/troubleshoot/__init__.py deleted file mode 100644 index e69de29..0000000