Hello community, here is the log from the commit of package python-argh for openSUSE:Factory checked in at 2012-11-25 13:22:28 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Comparing /work/SRC/openSUSE:Factory/python-argh (Old) and /work/SRC/openSUSE:Factory/.python-argh.new (New) ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Package is "python-argh", Maintainer is "" Changes: -------- --- /work/SRC/openSUSE:Factory/python-argh/python-argh.changes 2012-06-10 21:52:12.000000000 +0200 +++ /work/SRC/openSUSE:Factory/.python-argh.new/python-argh.changes 2012-11-25 13:22:31.000000000 +0100 @@ -1,0 +2,6 @@ +Fri Nov 23 10:45:39 UTC 2012 - saschpe@suse.de + +- Update to version 0.17.2: + + Upstream provides no changelog + +------------------------------------------------------------------- @@ -4 +10,2 @@ -- Update to 0.15.1 +- Update to version 0.15.1: + + Upstream provides no changelog Old: ---- argh-0.15.1.tar.gz New: ---- argh-0.17.2.tar.gz ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ python-argh.spec ++++++ --- /var/tmp/diff_new_pack.jbj0EA/_old 2012-11-25 13:22:32.000000000 +0100 +++ /var/tmp/diff_new_pack.jbj0EA/_new 2012-11-25 13:22:32.000000000 +0100 @@ -17,7 +17,7 @@ Name: python-argh -Version: 0.15.1 +Version: 0.17.2 Release: 0 Url: http://bitbucket.org/neithere/argh/ Summary: A simple argparse wrapper ++++++ argh-0.15.1.tar.gz -> argh-0.17.2.tar.gz ++++++ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/argh-0.15.1/MANIFEST.in new/argh-0.17.2/MANIFEST.in --- old/argh-0.15.1/MANIFEST.in 2011-10-10 21:46:28.000000000 +0200 +++ new/argh-0.17.2/MANIFEST.in 1970-01-01 01:00:00.000000000 +0100 @@ -1 +0,0 @@ -include _version.py diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/argh-0.15.1/PKG-INFO new/argh-0.17.2/PKG-INFO --- old/argh-0.15.1/PKG-INFO 2012-03-10 16:33:20.000000000 +0100 +++ new/argh-0.17.2/PKG-INFO 2012-11-20 12:32:11.000000000 +0100 @@ -1,10 +1,10 @@ Metadata-Version: 1.1 Name: argh -Version: 0.15.1 +Version: 0.17.2 Summary: A simple argparse wrapper. Home-page: http://bitbucket.org/neithere/argh/ Author: Andrey Mikhaylenko -Author-email: andy@neithere.net +Author-email: neithere@gmail.com License: GNU Lesser General Public License (LGPL), Version 3 Download-URL: http://bitbucket.org/neithere/argh/src/ Description: Agrh, argparse! @@ -44,12 +44,25 @@ A very simple application with one command:: + from argh import * + + @dispatch_command + @arg('name') + def main(args): + return 'Hello ' + args.name + + An application with multiple commands:: + @command def echo(text='hello'): print text + @command + def another_echo(text='hi there'): + print text + parser = ArghParser() - parser.add_commands([echo]) + parser.add_commands([echo, another_echo]) if __name__ == '__main__': parser.dispatch() @@ -93,16 +106,18 @@ Real-life usage --------------- - Among applications that use `argh` are Tool_, OrgTool_, Watchdog_, Poni_, Pyg_ - and more. Well, there's probably no need to keep a complete and up-to-date - list. Still, please let me know anyway if you use `argh` in your project. I'll - be glad to know. :-) + Among applications that use `argh` are Tool_, OrgTool_, Watchdog_, Poni_, Pyg_, + Barman_ and more. Well, there's probably no need to keep a complete + and up-to-date list. + Still, please let me know anyway if you use `argh` in your project. + I'll be glad to know. :-) .. _Tool: http://pypi.python.org/pypi/tool .. _OrgTool: http://pypi.python.org/pypi/orgtool .. _Watchdog: https://github.com/gorakhargosh/watchdog/ .. _Poni: https://github.com/melor/poni/commit/14e8ccbb50e9e17b95a2f2a0d2cd0af5d90ca22... .. _Pyg: https://github.com/rubik/pyg/commit/a201de1d70536e7e4637a6079f03174b7b493ffa + .. _Barman: http://pgbarman.org Licensing --------- @@ -130,6 +145,6 @@ Classifier: Programming Language :: Python Classifier: Topic :: Software Development :: User Interfaces Classifier: Topic :: Software Development :: Libraries :: Python Modules -Requires: python (>= 2.5) -Requires: argparse (>=1.1) +Requires: python(>=2.5) +Requires: argparse(>=1.1) Provides: argh diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/argh-0.15.1/README new/argh-0.17.2/README --- old/argh-0.15.1/README 2012-02-14 02:24:35.000000000 +0100 +++ new/argh-0.17.2/README 2012-11-19 22:45:20.000000000 +0100 @@ -35,12 +35,25 @@ A very simple application with one command:: + from argh import * + + @dispatch_command + @arg('name') + def main(args): + return 'Hello ' + args.name + +An application with multiple commands:: + @command def echo(text='hello'): print text + @command + def another_echo(text='hi there'): + print text + parser = ArghParser() - parser.add_commands([echo]) + parser.add_commands([echo, another_echo]) if __name__ == '__main__': parser.dispatch() @@ -84,16 +97,18 @@ Real-life usage --------------- -Among applications that use `argh` are Tool_, OrgTool_, Watchdog_, Poni_, Pyg_ -and more. Well, there's probably no need to keep a complete and up-to-date -list. Still, please let me know anyway if you use `argh` in your project. I'll -be glad to know. :-) +Among applications that use `argh` are Tool_, OrgTool_, Watchdog_, Poni_, Pyg_, +Barman_ and more. Well, there's probably no need to keep a complete +and up-to-date list. +Still, please let me know anyway if you use `argh` in your project. +I'll be glad to know. :-) .. _Tool: http://pypi.python.org/pypi/tool .. _OrgTool: http://pypi.python.org/pypi/orgtool .. _Watchdog: https://github.com/gorakhargosh/watchdog/ .. _Poni: https://github.com/melor/poni/commit/14e8ccbb50e9e17b95a2f2a0d2cd0af5d90ca22... .. _Pyg: https://github.com/rubik/pyg/commit/a201de1d70536e7e4637a6079f03174b7b493ffa +.. _Barman: http://pgbarman.org Licensing --------- diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/argh-0.15.1/_version.py new/argh-0.17.2/_version.py --- old/argh-0.15.1/_version.py 2012-03-10 16:29:53.000000000 +0100 +++ new/argh-0.17.2/_version.py 1970-01-01 01:00:00.000000000 +0100 @@ -1 +0,0 @@ -version = '0.15.1' diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/argh-0.15.1/argh/__init__.py new/argh-0.17.2/argh/__init__.py --- old/argh-0.15.1/argh/__init__.py 2012-02-13 04:24:43.000000000 +0100 +++ new/argh-0.17.2/argh/__init__.py 2012-11-19 22:45:20.000000000 +0100 @@ -25,3 +25,5 @@ from .exceptions import * from .helpers import * from .decorators import * + +__version__ = '0.17.2' diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/argh-0.15.1/argh/decorators.py new/argh-0.17.2/argh/decorators.py --- old/argh-0.15.1/argh/decorators.py 2012-02-14 01:13:36.000000000 +0100 +++ new/argh-0.17.2/argh/decorators.py 2012-11-19 22:45:20.000000000 +0100 @@ -62,7 +62,7 @@ ...is equivalent to:: - @argh('filename') + @arg('filename') def load(args): print json.load(args.filename) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/argh-0.15.1/argh/helpers.py new/argh-0.17.2/argh/helpers.py --- old/argh-0.15.1/argh/helpers.py 2012-03-10 16:27:05.000000000 +0100 +++ new/argh-0.17.2/argh/helpers.py 2012-11-19 22:45:20.000000000 +0100 @@ -25,14 +25,43 @@ ATTR_ALIAS, ATTR_ARGS, ATTR_NO_NAMESPACE, ATTR_WRAPPED_EXCEPTIONS ) + if PY3: def raw_input(text): return input(text.decode()) + __all__ = [ - 'ArghParser', 'add_commands', 'autocomplete', 'dispatch', 'confirm', + 'ArghParser', 'add_commands', 'autocomplete', 'confirm', 'dispatch', + 'dispatch_command', 'dispatch_commands', 'set_default_command', 'wrap_errors' ] + + +def set_default_command(parser, function): + """ Sets default command (i.e. a function) for given parser. + + If `parser.description` is empty and the function has a docstring, it is + used as the description. + + .. note:: + + An attempt to set default command to a parser which already has + subparsers (e.g. added with :func:`~argh.helpers.add_commands`) + results in a `RuntimeError`. + + """ + if parser._subparsers: + raise RuntimeError('Cannot set default command to a parser with ' + 'existing subparsers') + + for a_args, a_kwargs in getattr(function, ATTR_ARGS, []): + parser.add_argument(*a_args, **a_kwargs) + if function.__doc__ and not parser.description: + parser.description = function.__doc__ + parser.set_defaults(function=function) + + def add_commands(parser, functions, namespace=None, title=None, description=None, help=None): """Adds given functions as commands to given parser. @@ -93,7 +122,16 @@ stable. If some implementation details would change and break `argh`, we'll simply add a workaround a keep it compatibile. + .. note:: + + An attempt to add commands to a parser which already has a default + function (e.g. added with :func:`~argh.helpers.set_default_command`) + results in a `RuntimeError`. + """ + if 'function' in parser._defaults: + raise RuntimeError('Cannot add commands to a single-command parser') + subparsers = get_subparsers(parser, create=True) if namespace: @@ -111,11 +149,58 @@ for func in functions: # XXX we could add multiple aliases here but it's a bit of a hack cmd_name = getattr(func, ATTR_ALIAS, func.__name__.replace('_','-')) - cmd_help = func.__doc__ - command_parser = subparsers.add_parser(cmd_name, help=cmd_help) - for a_args, a_kwargs in getattr(func, ATTR_ARGS, []): - command_parser.add_argument(*a_args, **a_kwargs) - command_parser.set_defaults(function=func) + command_parser = subparsers.add_parser(cmd_name) + set_default_command(command_parser, func) + + +def dispatch_command(function, *args, **kwargs): + """ A wrapper for :func:`dispatch` that creates a one-command parser. + + This:: + + dispatch_command(foo) + + ...is a shortcut for:: + + parser = ArghParser() + parser.set_default_command(foo) + parser.dispatch() + + This function can also be used as a decorator. Here's a more or less + sensible example:: + + from argh import * + + @dispatch_command + @arg('name') + def main(args): + return args.name + + """ + parser = ArghParser() + parser.set_default_command(function) + parser.dispatch(*args, **kwargs) + + +def dispatch_commands(functions, *args, **kwargs): + """ A wrapper for :func:`dispatch` that creates a parser, adds commands to + the parser and dispatches them. + + This:: + + dispatch_commands([foo, bar]) + + ...is a shortcut for:: + + parser = ArgumentParser() + parser.add_commands(parser, [foo, bar]) + parser.dispatch(parser) + + """ + parser = ArghParser() + parser.add_commands(functions) + parser.dispatch(*args, **kwargs) + def dispatch(parser, argv=None, add_help_command=True, encoding=None, completion=True, pre_call=None, output_file=sys.stdout, @@ -215,6 +300,7 @@ f.seek(0) return f.read() + def _encode(line, output_file, encoding=None): """Converts given string to given encoding. If no encoding is specified, it is determined from terminal settings or, if none, from system settings. @@ -236,6 +322,7 @@ # Convert string from Unicode to the output encoding return line.encode(encoding) + def _execute_command(args): """Asserts that ``args.function`` is present and callable. Tries different approaches to calling the function (with an `argparse.Namespace` object or @@ -295,6 +382,10 @@ wrappers for stand-alone functions :func:`add_commands` , :func:`autocomplete` and :func:`dispatch`. """ + def set_default_command(self, *args, **kwargs): + "Wrapper for :func:`set_default_command`." + return set_default_command(self, *args, **kwargs) + def add_commands(self, *args, **kwargs): "Wrapper for :func:`add_commands`." return add_commands(self, *args, **kwargs) @@ -372,6 +463,7 @@ return default return None + def wrap_errors(*exceptions): """Decorator. Wraps given exceptions into :class:`CommandError`. Usage:: diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/argh-0.15.1/argh.egg-info/PKG-INFO new/argh-0.17.2/argh.egg-info/PKG-INFO --- old/argh-0.15.1/argh.egg-info/PKG-INFO 2012-03-10 16:33:20.000000000 +0100 +++ new/argh-0.17.2/argh.egg-info/PKG-INFO 2012-11-20 12:32:10.000000000 +0100 @@ -1,10 +1,10 @@ Metadata-Version: 1.1 Name: argh -Version: 0.15.1 +Version: 0.17.2 Summary: A simple argparse wrapper. Home-page: http://bitbucket.org/neithere/argh/ Author: Andrey Mikhaylenko -Author-email: andy@neithere.net +Author-email: neithere@gmail.com License: GNU Lesser General Public License (LGPL), Version 3 Download-URL: http://bitbucket.org/neithere/argh/src/ Description: Agrh, argparse! @@ -44,12 +44,25 @@ A very simple application with one command:: + from argh import * + + @dispatch_command + @arg('name') + def main(args): + return 'Hello ' + args.name + + An application with multiple commands:: + @command def echo(text='hello'): print text + @command + def another_echo(text='hi there'): + print text + parser = ArghParser() - parser.add_commands([echo]) + parser.add_commands([echo, another_echo]) if __name__ == '__main__': parser.dispatch() @@ -93,16 +106,18 @@ Real-life usage --------------- - Among applications that use `argh` are Tool_, OrgTool_, Watchdog_, Poni_, Pyg_ - and more. Well, there's probably no need to keep a complete and up-to-date - list. Still, please let me know anyway if you use `argh` in your project. I'll - be glad to know. :-) + Among applications that use `argh` are Tool_, OrgTool_, Watchdog_, Poni_, Pyg_, + Barman_ and more. Well, there's probably no need to keep a complete + and up-to-date list. + Still, please let me know anyway if you use `argh` in your project. + I'll be glad to know. :-) .. _Tool: http://pypi.python.org/pypi/tool .. _OrgTool: http://pypi.python.org/pypi/orgtool .. _Watchdog: https://github.com/gorakhargosh/watchdog/ .. _Poni: https://github.com/melor/poni/commit/14e8ccbb50e9e17b95a2f2a0d2cd0af5d90ca22... .. _Pyg: https://github.com/rubik/pyg/commit/a201de1d70536e7e4637a6079f03174b7b493ffa + .. _Barman: http://pgbarman.org Licensing --------- @@ -130,6 +145,6 @@ Classifier: Programming Language :: Python Classifier: Topic :: Software Development :: User Interfaces Classifier: Topic :: Software Development :: Libraries :: Python Modules -Requires: python (>= 2.5) -Requires: argparse (>=1.1) +Requires: python(>=2.5) +Requires: argparse(>=1.1) Provides: argh diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/argh-0.15.1/argh.egg-info/SOURCES.txt new/argh-0.17.2/argh.egg-info/SOURCES.txt --- old/argh-0.15.1/argh.egg-info/SOURCES.txt 2012-03-10 16:33:20.000000000 +0100 +++ new/argh-0.17.2/argh.egg-info/SOURCES.txt 2012-11-20 12:32:11.000000000 +0100 @@ -1,6 +1,4 @@ -MANIFEST.in README -_version.py setup.cfg setup.py argh/__init__.py @@ -14,4 +12,5 @@ argh.egg-info/PKG-INFO argh.egg-info/SOURCES.txt argh.egg-info/dependency_links.txt +argh.egg-info/requires.txt argh.egg-info/top_level.txt \ No newline at end of file diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/argh-0.15.1/argh.egg-info/requires.txt new/argh-0.17.2/argh.egg-info/requires.txt --- old/argh-0.15.1/argh.egg-info/requires.txt 1970-01-01 01:00:00.000000000 +0100 +++ new/argh-0.17.2/argh.egg-info/requires.txt 2012-11-20 12:32:10.000000000 +0100 @@ -0,0 +1 @@ +argparse>=1.1 \ No newline at end of file diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/argh-0.15.1/setup.cfg new/argh-0.17.2/setup.cfg --- old/argh-0.15.1/setup.cfg 2012-03-10 16:33:20.000000000 +0100 +++ new/argh-0.17.2/setup.cfg 2012-11-20 12:32:11.000000000 +0100 @@ -10,6 +10,6 @@ [egg_info] tag_build = -tag_date = 0 tag_svn_revision = 0 +tag_date = 0 diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/argh-0.15.1/setup.py new/argh-0.17.2/setup.py --- old/argh-0.15.1/setup.py 2011-10-10 21:46:28.000000000 +0200 +++ new/argh-0.17.2/setup.py 2012-11-19 22:45:20.000000000 +0100 @@ -21,12 +21,32 @@ import os -from setuptools import setup -from _version import version + +# Why distutils? +# +# We could bundle distribute_setup.py and call it as recommended: +# http://packages.python.org/distribute/using.html +# However, `distribute` seems to break PyPy (at least 1.6 thru 1.9). +# So we'll simply fall back to plain distutils. +try: + from setuptools import setup +except: + from distutils.core import setup + +# Importing `__version__` from `argh` would trigger a cascading import +# of `argparse`. We need to avoid this as Python < 2.7 ships without argparse. +__version__ = None +with open('argh/__init__.py') as f: + for line in f: + if line.startswith('__version__'): + exec(line) + break +assert __version__, 'argh.__version__ must be imported correctly' readme = open(os.path.join(os.path.dirname(__file__), 'README')).read() + setup( # overview name = 'argh', @@ -34,14 +54,15 @@ long_description = readme, # technical info - version = version, + version = __version__, packages = ['argh'], - requires = ['python (>= 2.5)', 'argparse (>=1.1)'], provides = ['argh'], + requires = ['python(>=2.5)', 'argparse(>=1.1)'], + install_requires = ['argparse>=1.1'], # for Python 2.6 (no bundled argparse; setuptools is likely to exist) # copyright author = 'Andrey Mikhaylenko', - author_email = 'andy@neithere.net', + author_email = 'neithere@gmail.com', license = 'GNU Lesser General Public License (LGPL), Version 3', # more info -- To unsubscribe, e-mail: opensuse-commit+unsubscribe@opensuse.org For additional commands, e-mail: opensuse-commit+help@opensuse.org