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

New structure to be able to install it via pip #231

Merged
merged 3 commits into from
Feb 23, 2024
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.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
26 changes: 26 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -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/
8 changes: 8 additions & 0 deletions bin/crhc-cli
Original file line number Diff line number Diff line change
@@ -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()
Empty file removed conf/__init__.py
Empty file.
Empty file removed credential/__init__.py
Empty file.
1 change: 1 addition & 0 deletions conf/conf.py → crhc_cli/conf/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
File renamed without changes.
File renamed without changes.
2 changes: 1 addition & 1 deletion crhc.py → crhc_cli/crhc.py
Original file line number Diff line number Diff line change
Expand Up @@ -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()
6 changes: 3 additions & 3 deletions execution/execution.py → crhc_cli/execution/execution.py
Original file line number Diff line number Diff line change
Expand Up @@ -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 = ""
Expand Down
File renamed without changes.
12 changes: 6 additions & 6 deletions parse/parse.py → crhc_cli/parse/parse.py
Original file line number Diff line number Diff line change
Expand Up @@ -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()

Expand Down
2 changes: 1 addition & 1 deletion report/report.py → crhc_cli/report/report.py
Original file line number Diff line number Diff line change
Expand Up @@ -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):
Expand Down
6 changes: 3 additions & 3 deletions troubleshoot/ts.py → crhc_cli/troubleshoot/ts.py
Original file line number Diff line number Diff line change
Expand Up @@ -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):
Expand Down
Binary file removed dist/crhc
Binary file not shown.
Empty file removed execution/__init__.py
Empty file.
Empty file removed help/__init__.py
Empty file.
Empty file removed parse/__init__.py
Empty file.
Empty file removed report/__init__.py
Empty file.
30 changes: 30 additions & 0 deletions setup.py
Original file line number Diff line number Diff line change
@@ -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",
),
)
2 changes: 1 addition & 1 deletion tests/test_help.py
Original file line number Diff line number Diff line change
Expand Up @@ -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():
Expand Down
2 changes: 1 addition & 1 deletion tests/test_report.py
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
Empty file removed troubleshoot/__init__.py
Empty file.
Loading