Add script in setup and improve script info

This commit is contained in:
Daniel Pizetta 2018-10-25 16:43:17 -03:00
parent d909ed47f9
commit 7b6d423dc8
2 changed files with 21 additions and 17 deletions

View File

@ -1,16 +1,15 @@
#!/usr/bin/env python
# -*- coding: utf-8 -*-
from qdarkstyle import qt_bindings, qt_abstractions, information, __version__
import qdarkstyle
from example import example
import argparse
import sys
from os.path import abspath, dirname
sys.path.insert(0, abspath(dirname(abspath(__file__)) + '/..'))
from example import example
import qdarkstyle
from qdarkstyle import qt_bindings, qt_abstractions, information, __version__
def print_list_md(info):
"""Print a list of information, line by line."""
@ -22,40 +21,42 @@ def main():
"""Execute QDarkStyle example."""
parser = argparse.ArgumentParser(description=__doc__,
formatter_class=argparse.RawDescriptionHelpFormatter)
parser.add_argument('--information', action='store_true',
parser.add_argument('-i', '--information', action='store_true',
help="Show information about environment (important for bug report)")
parser.add_argument('--bindings', action='store_true',
help="Show available bindings for Qt.")
parser.add_argument('--abstractions', action='store_true',
parser.add_argument('-b', '--bindings', action='store_true',
help="Show available bindings for Qt")
parser.add_argument('-a', '--abstractions', action='store_true',
help="Show available abstraction layers for Qt bindings")
parser.add_argument('--all', action='store_true',
help="Show all previous options at once")
parser.add_argument('--example', action='store_true',
parser.add_argument('-e', '--example', action='store_true',
help="Show qdarkstyle example")
parser.add_argument('--version', action='store_true',
parser.add_argument('-v', '--version', action='store_true',
help="Show qdarkstyle version")
parser.add_argument('--all', action='store_true',
help="Show all information options at once")
# parsing arguments from command line
args = parser.parse_args()
parser.print_help()
if args.information or args.all:
info = information()
print('Information about your environment:')
print('\nInformation about your current environment setup:')
print_list_md(info)
if args.bindings or args.all:
info = qt_bindings()
print('Qt bindings available:')
print('\nQt bindings available:')
print_list_md(info)
if args.abstractions or args.all:
info = qt_abstractions()
print('Qt abstraction layers available:')
print('\nQt abstraction layers available:')
print_list_md(info)
if args.version:
info = __version__
print('Version: %s' % info)
print('\nVersion: %s' % info)
if args.example:
example.main()

View File

@ -30,4 +30,7 @@ setup(
'Programming Language :: Python :: 3.5',
'Programming Language :: Python :: 3.6',
'Topic :: Software Development :: Libraries :: Application Frameworks'
])
],
zip_safe=False, # don't use eggs
entry_points={"console_scripts": ["qdarkstyle=qdarkstyle.__main__:main"]}
)