15
0
forked from pool/python-fire

Accepting request 719775 from devel:languages:python

OBS-URL: https://build.opensuse.org/request/show/719775
OBS-URL: https://build.opensuse.org/package/show/openSUSE:Factory/python-fire?expand=0&rev=5
This commit is contained in:
2019-07-30 10:39:33 +00:00
committed by Git OBS Bridge
5 changed files with 30 additions and 64 deletions

View File

@@ -1,3 +0,0 @@
version https://git-lfs.github.com/spec/v1
oid sha256:c299d16064ff81cbb649b65988300d4a28b71ecfb789d1fb74d99ea98ae4d2eb
size 33274

3
fire-0.2.0.tar.gz Normal file
View File

@@ -0,0 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:cdae28ea728d6cad487c900d534426d2cd09ddd2993287a885ff7c8accb097c8
size 76135

View File

@@ -1,57 +0,0 @@
From 2cc070bb50577ec45fae640b56e02c69feb6f82c Mon Sep 17 00:00:00 2001
From: Andrew Au <cshung@gmail.com>
Date: Fri, 22 Feb 2019 16:23:03 -0800
Subject: [PATCH] Fix issue 164
---
fire/helputils_test.py | 1 -
fire/inspectutils.py | 10 ++++++----
fire/inspectutils_test.py | 2 --
3 files changed, 6 insertions(+), 7 deletions(-)
diff --git a/fire/helputils_test.py b/fire/helputils_test.py
index 0557122..c3d5055 100644
--- a/fire/helputils_test.py
+++ b/fire/helputils_test.py
@@ -88,7 +88,6 @@ def testHelpStringBuiltin(self):
helpstring = helputils.HelpString('test'.upper)
self.assertIn('Type: builtin_function_or_method', helpstring)
self.assertIn('String form: <built-in method upper of', helpstring)
- self.assertIn('Usage: [VARS ...] [--KWARGS ...]', helpstring)
def testHelpStringIntType(self):
helpstring = helputils.HelpString(int)
diff --git a/fire/inspectutils.py b/fire/inspectutils.py
index 45f7ce6..244a84f 100644
--- a/fire/inspectutils.py
+++ b/fire/inspectutils.py
@@ -74,10 +74,12 @@ class with an __init__ method.
if six.PY2 and hasattr(fn, '__init__'):
fn = fn.__init__
else:
- # If the function is a bound method, we skip the `self` argument.
- is_method = inspect.ismethod(fn)
- skip_arg = is_method and fn.__self__ is not None
-
+ if inspect.ismethod(fn):
+ # If the function is a bound method, we skip the `self` argument.
+ skip_arg = fn.__self__ is not None
+ elif inspect.isbuiltin(fn):
+ # If the function is a bound builtin, we skip the `self` argument.
+ skip_arg = fn.__self__ is not None
return fn, skip_arg
diff --git a/fire/inspectutils_test.py b/fire/inspectutils_test.py
index 8c6dd9a..ba42865 100644
--- a/fire/inspectutils_test.py
+++ b/fire/inspectutils_test.py
@@ -56,8 +56,6 @@ def testGetFullArgSpecFromBuiltin(self):
spec = inspectutils.GetFullArgSpec('test'.upper)
self.assertEqual(spec.args, [])
self.assertEqual(spec.defaults, ())
- self.assertEqual(spec.varargs, 'vars')
- self.assertEqual(spec.varkw, 'kwargs')
self.assertEqual(spec.kwonlyargs, [])
self.assertEqual(spec.kwonlydefaults, {})
self.assertEqual(spec.annotations, {})

View File

@@ -1,3 +1,26 @@
-------------------------------------------------------------------
Tue Jul 30 07:07:56 UTC 2019 - pgajdos@suse.com
- version update to 0.2.0
* Help and usage screens
* Help screens now have a man-page appearance and are shown with less-style pagination. Usage screens are shown when a user-error is encountered. The help and usage screens are considerably cleaner than the default output in previous versions of Fire.
* Custom serialization
* If you define a custom __str__ method on an object, that will be used to serialize the object when it is the final result of a Fire command. This means better support for numpy arrays, and better support for custom types.
* Docstring parsing
* Notably, docstrings are parsed in order to determine the descriptions to use for arguments in the help screens. We largely support (but not fully) Google, numpy, and RST style docstrings. These are the three most common styles of docstring used in Python code.
* Access --help naturally
* You no longer need to separate --help from your command with an extra --. Simply running command -h or command --help will give help, provided there isn't an argument named help in your component.
* NamedTuples can be indexed both by their field names and by their indexes.
* Callable objects can both be called, and their members can be accessed.
* You must use flag syntax to call a callable object; you cannot pass their arguments positionally.
* Single-hyphen flags are supported
* You can now specify -flag instead of --flag if preferred. Both work.
* Short-flags are permitted when their use is unambiguous
* E.g. if your function has argument alpha, then you can specify its value with -a.
* Fish completion support
- deleted patches
- fix-issue-164.patch (upstreamed)
-------------------------------------------------------------------
Sat Mar 9 00:26:12 CET 2019 - Matej Cepl <mcepl@suse.com>

View File

@@ -18,18 +18,18 @@
%{?!python_module:%define python_module() python-%{**} python3-%{**}}
Name: python-fire
Version: 0.1.3
Version: 0.2.0
Release: 0
Summary: A library for automatically generating command line interfaces
License: Apache-2.0
Group: Development/Languages/Python
URL: https://github.com/google/python-fire
Source: https://files.pythonhosted.org/packages/source/f/fire/fire-%{version}.tar.gz
Patch0: fix-issue-164.patch
BuildRequires: %{python_module setuptools}
BuildRequires: fdupes
BuildRequires: python-rpm-macros
Requires: python-six
Requires: python-termcolor
BuildArch: noarch
# SECTION test requirements
BuildRequires: %{python_module Levenshtein}
@@ -37,6 +37,7 @@ BuildRequires: %{python_module hypothesis}
BuildRequires: %{python_module mock}
BuildRequires: %{python_module pytest}
BuildRequires: %{python_module six}
BuildRequires: %{python_module termcolor}
# /SECTION
%python_subpackages
@@ -46,7 +47,6 @@ interfaces (CLIs) from a Python object.
%prep
%setup -q -n fire-%{version}
%autopatch -p1
%build
%python_build
@@ -56,7 +56,7 @@ interfaces (CLIs) from a Python object.
%python_expand %fdupes %{buildroot}%{$python_sitelib}
%check
%python_expand pytest-%{$python_bin_suffix} -v fire
%pytest
%files %{python_files}
%license LICENSE