From eb16c5c8466234fbacade2b56363b1aff1121fad Mon Sep 17 00:00:00 2001 From: abraham Date: Sat, 16 Nov 2019 00:39:09 -0500 Subject: [PATCH] Added. Single source for package about info Added version information to the cli Updated version to 0.7 --- .gitignore | 1 + nautacli/__about__.py | 19 +++++++++++++++++++ nautacli/nauta.py | 7 +++++-- setup.py | 39 +++++++++++++++++++++++---------------- 4 files changed, 48 insertions(+), 18 deletions(-) create mode 100644 nautacli/__about__.py diff --git a/.gitignore b/.gitignore index 2e899dd..6208787 100644 --- a/.gitignore +++ b/.gitignore @@ -1,5 +1,6 @@ build/ dist/ *.egg-info/ +.idea/ *.pyc diff --git a/nautacli/__about__.py b/nautacli/__about__.py new file mode 100644 index 0000000..e3ca312 --- /dev/null +++ b/nautacli/__about__.py @@ -0,0 +1,19 @@ +__all__ = [ + "__name__", + "__cli__", + "__author__", + "__email__", + "__version__", + "__url__", + "__description__", +] + +__name__ = "nauta-cli" +__cli__ = "nauta" +__version__ = "0.7" + +__author__ = "Abraham Toledo Sanchez" +__email__ = "abrahamtoledo90@gmail.com" +__url__ = "https://github.com/abrahamtoledo/nauta-cli" + +__description__ = "Utilidad en linea de comandos (CLI) para la gestion del portal cautivo Nauta de Cuba" \ No newline at end of file diff --git a/nautacli/nauta.py b/nautacli/nauta.py index 849efcb..7ff87cd 100644 --- a/nautacli/nauta.py +++ b/nautacli/nauta.py @@ -1,10 +1,8 @@ #!/usr/bin/env python3 -from pprint import pprint from textwrap import dedent from datetime import datetime -import subprocess import requests import argparse import json @@ -18,6 +16,9 @@ import logging +from .__about__ import __name__, __version__ + + CONFIG_DIR = os.path.expanduser("~/.local/share/nauta/") try: os.makedirs(CONFIG_DIR) @@ -454,6 +455,8 @@ def main(): help="show debug info" ) + parser.add_argument("--version", action="version", version="{} v{}".format(__name__, __version__)) + cards_parser = subparsers.add_parser('cards') cards_parser.set_defaults(func=cards) cards_parser.add_argument("-v", diff --git a/setup.py b/setup.py index b571c96..4aed837 100644 --- a/setup.py +++ b/setup.py @@ -2,31 +2,38 @@ from os import path from io import open + +about = {} +with open("nautacli/__about__.py") as fp: + exec(fp.read(), about) + + here = path.abspath(path.dirname(__file__)) # Get the long description from the README file -with open(path.join(here, 'README.md'), encoding='utf-8') as f: +with open(path.join(here, "README.md"), encoding="utf-8") as f: long_description = f.read() setup( - name="nauta-cli", - version=0.6, - description='Utilidad en linea de comandos (CLI) para la gestion del portal cautivo Nauta de Cuba', - long_description_content_type='text/markdown', - url='https://github.com/atscub/nauta-cli', - author='atscub', - author_email='atscubacel@yahoo.com', + name=about["__name__"], + version=about["__version__"], + description=about["__description__"], + long_description=long_description, + long_description_content_type="text/markdown", + url=about["__url__"], + author=about["__author__"], + author_email=about["__email__"], classifiers=[ - 'Development Status :: 3 - Alpha', - 'Intended Audience :: End Users/Desktop', - 'Topic :: Internet', - 'License :: OSI Approved :: MIT License', - 'Programming Language :: Python' + "Development Status :: 3 - Alpha", + "Intended Audience :: End Users/Desktop", + "Topic :: Internet", + "License :: OSI Approved :: MIT License", + "Programming Language :: Python" ], - keywords='nauta portal cautivo', + keywords="nauta portal cautivo", packages=find_packages(), - install_requires=['requests', 'bs4'], + install_requires=["requests", "bs4"], entry_points = { - 'console_scripts': ['nauta=nautacli:main'], + "console_scripts": [about["__cli__"] + "=nautacli:main"], } )