# Path: parm/_compat.py
# PY3 = sys.version_info[0] == 3
# PY2 = sys.version_info[0] == 2
# PY26 = sys.version_info[0:2] == (2, 6)
# PYPY = hasattr(sys, 'pypy_translation_info')
#     def reraise(tp, value, tb=None):
#     def u(s, encoding='utf8'):
#     def b(s):
#     def implements_iterator(cls):
#     def python_2_unicode_compatible(cls):
#     def u(s, encoding='utf8'):
#     def b(s, encoding='utf8'):
#     def exec_(code, globs=None, locs=None):
#     def next(it):
# def with_metaclass(meta, *bases):
#         def __new__(cls, name, this_bases, d):
# def import_(module, objects=None, via=None):
#     class metaclass(meta):


from ._compat import input, with_metaclass, string_types
from optparse import make_option, OptionParser, IndentedHelpFormatter
    from .commands import execute_command_line
import sys, os
import logging
import inspect
                    import traceback
        import shlex
                if not str(e).startswith('No module named'):
                    traceback.print_exc()
                continue
            
            find_mod_commands(mod)

    collect_commands()
    return __commands__
    
def register_command(kclass):
    global __commands__
    __commands__[kclass.name] = kclass

def call(prog_name, version, modules=None, args=None):
    
    modules = modules or []
    
    if isinstance(args, string_types):
        args = shlex.split(args)
    
    execute_command_line(args or sys.argv, get_commands(modules), prog_name, version)

class CommandMetaclass(type):
    def __init__(cls, name, bases, dct):
        option_list = list(dct.get('option_list', []))
        for c in bases:
            if hasattr(c, 'option_list') and isinstance(c.option_list, list):
                option_list.extend(c.option_list)
        cls.option_list = option_list
        

# Path: parm/_compat.py
# PY3 = sys.version_info[0] == 3
# PY2 = sys.version_info[0] == 2
# PY26 = sys.version_info[0:2] == (2, 6)
# PYPY = hasattr(sys, 'pypy_translation_info')
#     def reraise(tp, value, tb=None):
#     def u(s, encoding='utf8'):
#     def b(s):
#     def implements_iterator(cls):
#     def python_2_unicode_compatible(cls):
#     def u(s, encoding='utf8'):
#     def b(s, encoding='utf8'):
#     def exec_(code, globs=None, locs=None):
#     def next(it):
# def with_metaclass(meta, *bases):
#         def __new__(cls, name, this_bases, d):
# def import_(module, objects=None, via=None):
#     class metaclass(meta):


# Path: parm/commands.py
from ._compat import input, with_metaclass, string_types
from optparse import make_option, OptionParser, IndentedHelpFormatter
    from .commands import execute_command_line
import sys, os
import logging
import inspect
                    import traceback
        import shlex

                if not str(e).startswith('No module named'):
                    traceback.print_exc()
                continue
            
            find_mod_commands(mod)

    collect_commands()
    return __commands__
    
def register_command(kclass):
    global __commands__
    __commands__[kclass.name] = kclass

def call(prog_name, version, modules=None, args=None):
    
    modules = modules or []
    
    if isinstance(args, string_types):
        args = shlex.split(args)
    
    execute_command_line(args or sys.argv, get_commands(modules), prog_name, version)

class CommandMetaclass(type):
    def __init__(cls, name, bases, dct):
        option_list = list(dct.get('option_list', []))
        for c in bases:
            if hasattr(c, 'option_list') and isinstance(c.option_list, list):
                option_list.extend(c.option_list)
        cls.option_list = option_list
        

class Command(with_metaclass(CommandMetaclass)):