Skip to content

Commit 980f855

Browse files
authored
[ENHANCEMENT] New structure to be able to install it via pip
* New structure to be able to install it via pip * removing the version from the binary script * updated the module path in the tests as well.
1 parent f6cdf65 commit 980f855

File tree

22 files changed

+81
-16
lines changed

22 files changed

+81
-16
lines changed

.gitignore

+26
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
*svn*
2+
*.ipynb
3+
*.pyc
4+
*.pyo
5+
.project
6+
.pydevproject
7+
*.swp
8+
*.swo
9+
build
10+
dist
11+
*.egg-info
12+
pip-wheel-metadata/
13+
.settings
14+
*.wpr
15+
*.wpu
16+
.idea
17+
.coverage
18+
cover
19+
.DS_Store
20+
*,cover
21+
tags
22+
.pytest_cache
23+
.venv
24+
25+
#VScode
26+
.vscode/

bin/crhc-cli

+8
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
#!/usr/bin/env python
2+
import os
3+
4+
project_dir = os.path.dirname(os.path.dirname(__file__))
5+
os.sys.path.append(project_dir)
6+
7+
from crhc_cli import crhc
8+
crhc.parse.main_menu()

conf/__init__.py

Whitespace-only changes.

credential/__init__.py

Whitespace-only changes.

conf/conf.py crhc_cli/conf/conf.py

+1
Original file line numberDiff line numberDiff line change
@@ -48,5 +48,6 @@
4848

4949
# Items per page when doing the API call
5050
ITEMS_PER_PAGE = 50
51+
5152
# Ansible has a max limit of 25 Items per page when doing the API call
5253
ANSIBLE_ITEMS_PER_PAGE = 25
File renamed without changes.
File renamed without changes.

crhc.py crhc_cli/crhc.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
console.redhat.com (Inventory, Subscription and much more)
77
"""
88

9-
from parse import parse
9+
from crhc_cli.parse import parse
1010

1111
if __name__ == "__main__":
1212
parse.main_menu()

execution/execution.py crhc_cli/execution/execution.py

+3-3
Original file line numberDiff line numberDiff line change
@@ -14,9 +14,9 @@
1414
import time
1515
import requests
1616
import datetime
17-
from report import report
18-
from credential import token
19-
from conf import conf
17+
from crhc_cli.report import report
18+
from crhc_cli.credential import token
19+
from crhc_cli.conf import conf
2020

2121
# FIELDS_TO_RETRIEVE = "?fields[system_profile]=number_of_sockets"
2222
FIELDS_TO_RETRIEVE = ""
File renamed without changes.

parse/parse.py crhc_cli/parse/parse.py

+6-6
Original file line numberDiff line numberDiff line change
@@ -6,12 +6,12 @@
66

77
import sys
88
import json
9-
from conf import conf
10-
from execution import execution
11-
from report import report
12-
from credential import token
13-
from troubleshoot import ts
14-
from help import help_opt
9+
from crhc_cli.conf import conf
10+
from crhc_cli.execution import execution
11+
from crhc_cli.report import report
12+
from crhc_cli.credential import token
13+
from crhc_cli.troubleshoot import ts
14+
from crhc_cli.help import help_opt
1515

1616
access_token = token.get_token()
1717

report/report.py crhc_cli/report/report.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
import csv
88
import os
99
import json
10-
from conf import conf
10+
from crhc_cli.conf import conf
1111

1212

1313
def check_for_installed_products(entries):

troubleshoot/ts.py crhc_cli/troubleshoot/ts.py

+3-3
Original file line numberDiff line numberDiff line change
@@ -8,9 +8,9 @@
88
import json
99
import os
1010
from zipfile import ZipFile
11-
from execution import execution
12-
from report import report
13-
from conf import conf
11+
from crhc_cli.execution import execution
12+
from crhc_cli.report import report
13+
from crhc_cli.conf import conf
1414

1515

1616
def dump_inv_json(current_only):

dist/crhc

-10.7 MB
Binary file not shown.

execution/__init__.py

Whitespace-only changes.

help/__init__.py

Whitespace-only changes.

parse/__init__.py

Whitespace-only changes.

report/__init__.py

Whitespace-only changes.

setup.py

+30
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
from setuptools import find_packages, setup
2+
3+
4+
with open("README.md", "r") as fh:
5+
long_description = fh.read()
6+
7+
with open("requirements.txt", "r") as req:
8+
requirements = req.readlines()
9+
10+
11+
setup(
12+
name="crhc-cli",
13+
version="1.15.15",
14+
author="Waldirio",
15+
author_email="[email protected]",
16+
description="This project contains the crhc command line tool that simplifies the use of the C.RH.C API available at console.redhat.com",
17+
long_description=long_description,
18+
long_description_content_type="text/markdown",
19+
install_requires=requirements,
20+
url="https://github.com/C-RH-C/crhc-cli/",
21+
packages=find_packages(),
22+
python_requires=">=3.9",
23+
scripts=['bin/crhc-cli'],
24+
include_package_data=True,
25+
classifiers=(
26+
"Programming Language :: Python :: 3",
27+
"License :: OSI Approved :: MIT License",
28+
"Operating System :: OS Independent",
29+
),
30+
)

tests/test_help.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
Module responsible for test the help menu content
55
"""
66

7-
from help import help_opt
7+
from crhc_cli.help import help_opt
88

99

1010
def test_check_main_help_menu():

tests/test_report.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
import csv
88
import tempfile
99
from pathlib import Path
10-
from report import report
10+
from crhc_cli.report import report
1111

1212

1313
INPUT_JSON = "tests/data/inventory.json"

troubleshoot/__init__.py

Whitespace-only changes.

0 commit comments

Comments
 (0)