15
0
Files
python-humanfriendly/python-humanfriendly.spec

113 lines
3.5 KiB
RPMSpec
Raw Normal View History

#
# spec file for package python
#
- Update to 6.1: - Added a :pypy:`…` role for easy linking to packages on the Python Package Index, for details refer to :func:`humanfriendly.sphinx.pypi_role()`. - Wasted quite a bit of time debugging a MacOS failure on Travis CI caused by a broken man`pip` installation, fixed by using get-pip.py to bootstrap an installation that actually works wink. - Enable :class:`~humanfriendly.testing.MockedProgram` to customize the shell script code of mocked programs. This was added to make it easy to mock a program that is expected to generate specific output (I'm planning to use this in the :pypi:`linux-utils` test suite). - Defined __all__ for all public modules that previously lacked "export control" and decided to bump the major version number as a precaution: - These changes should not have any impact on backwards compatibility, unless I forgot entries, in which case callers can get :exc:`~exceptions.ImportError` exceptions... - Imports of public modules were previously exported (implicitly) and this pollutes code completion suggestions which in turn can encourage bad practices (not importing things using their "canonical" name). - I started developing the humanfriendly package years before I learned about the value of defining __all__ and so some modules lacked a definition until now. I decided that now was as good a time as any to add those definitions innocent. - Simplified the headings in docs/api.rst so that only the OBS-URL: https://build.opensuse.org/package/show/devel:languages:python/python-humanfriendly?expand=0&rev=25
2020-02-15 07:55:33 +00:00
# Copyright (c) 2020 SUSE LLC
#
# All modifications and additions to the file contributed by third parties
# remain the property of their copyright owners, unless otherwise agreed
# upon. The license for this file, and modifications and additions to the
# file, is the same license as for the pristine package itself (unless the
# license for the pristine package is not an Open Source License, in which
# case the license is the MIT License). An "Open Source License" is a
# license that conforms to the Open Source Definition (Version 1.9)
# published by the Open Source Initiative.
# Please submit bugfixes or comments via https://bugs.opensuse.org/
#
%global flavor @BUILD_FLAVOR@%{nil}
%if "%{flavor}" == "test"
%define psuffix test
%bcond_without test
%else
%define psuffix %{nil}
%bcond_with test
%endif
%bcond_without python2
%{?!python_module:%define python_module() python-%{**} python3-%{**}}
Name: python-humanfriendly%{psuffix}
Accepting request 789694 from home:mcalabkova:branches:devel:languages:python - Update to 8.1 * Make it possible to opt out of the output capturing that :func:`humanfriendly.testing.run_cli()` sets up by default. * Improve feature parity between :class:`humanfriendly.testing.CaptureOutput` and my :pypi:`capturer` package to the point where most of the :pypi:`humanfriendly` test suite can now run without :pypi:`capturer`. * Refactored the test suite to import all names separately instead of referring to identifiers via their modules (my preferences have changed since this code was written a long time ago). * Adopt :func:`functools.wraps()` to make decorator functions more robust. * Make the :class:`~humanfriendly.terminal.spinners.Spinner` class more customizable. The interval at which spinners are updated and the characters used to draw the animation of spinners can now be customized by callers. This was triggered by `executor issue #2`_. * Improve test skipping based on exception types. * The "deprecated imports" feature provided by :mod:`humanfriendly.deprecation` has been adopted to clean up the maze of (almost but not quite) cyclic import dependencies between modules. * HTML to ANSI functionality has been extracted to a new :mod:`humanfriendly.terminal.html` module. * Support for spinners has been extracted to a new :mod:`humanfriendly.terminal.spinners` module. * The use of positional arguments to initialize :class:`~humanfriendly.terminal.spinners.Spinner` objects has been deprecated using the new :func:`humanfriendly.deprecation.deprecated_args()` decorator function. * Added the :func:`humanfriendly.deprecation.deprecated_args()` decorator function which makes it easy to switch from positional arguments to keyword arguments without dropping backwards compatibility. * Accept pluralized disk size units (`#26`_). I'm not claiming this is a full OBS-URL: https://build.opensuse.org/request/show/789694 OBS-URL: https://build.opensuse.org/package/show/devel:languages:python/python-humanfriendly?expand=0&rev=28
2020-03-30 10:01:36 +00:00
Version: 8.1
Release: 0
Summary: Human friendly input/output for text interfaces using Python
License: MIT
URL: https://github.com/xolox/python-humanfriendly
Source: https://files.pythonhosted.org/packages/source/h/humanfriendly/humanfriendly-%{version}.tar.gz
BuildRequires: %{python_module setuptools}
BuildRequires: fdupes
BuildRequires: python-rpm-macros
Requires: python
Requires(post): update-alternatives
Requires(postun): update-alternatives
BuildArch: noarch
%if %{with test}
BuildRequires: %{python_module capturer >= 2.1}
BuildRequires: %{python_module coloredlogs >= 2}
- Update to 6.1: - Added a :pypy:`…` role for easy linking to packages on the Python Package Index, for details refer to :func:`humanfriendly.sphinx.pypi_role()`. - Wasted quite a bit of time debugging a MacOS failure on Travis CI caused by a broken man`pip` installation, fixed by using get-pip.py to bootstrap an installation that actually works wink. - Enable :class:`~humanfriendly.testing.MockedProgram` to customize the shell script code of mocked programs. This was added to make it easy to mock a program that is expected to generate specific output (I'm planning to use this in the :pypi:`linux-utils` test suite). - Defined __all__ for all public modules that previously lacked "export control" and decided to bump the major version number as a precaution: - These changes should not have any impact on backwards compatibility, unless I forgot entries, in which case callers can get :exc:`~exceptions.ImportError` exceptions... - Imports of public modules were previously exported (implicitly) and this pollutes code completion suggestions which in turn can encourage bad practices (not importing things using their "canonical" name). - I started developing the humanfriendly package years before I learned about the value of defining __all__ and so some modules lacked a definition until now. I decided that now was as good a time as any to add those definitions innocent. - Simplified the headings in docs/api.rst so that only the OBS-URL: https://build.opensuse.org/package/show/devel:languages:python/python-humanfriendly?expand=0&rev=25
2020-02-15 07:55:33 +00:00
BuildRequires: %{python_module docutils}
Accepting request 789694 from home:mcalabkova:branches:devel:languages:python - Update to 8.1 * Make it possible to opt out of the output capturing that :func:`humanfriendly.testing.run_cli()` sets up by default. * Improve feature parity between :class:`humanfriendly.testing.CaptureOutput` and my :pypi:`capturer` package to the point where most of the :pypi:`humanfriendly` test suite can now run without :pypi:`capturer`. * Refactored the test suite to import all names separately instead of referring to identifiers via their modules (my preferences have changed since this code was written a long time ago). * Adopt :func:`functools.wraps()` to make decorator functions more robust. * Make the :class:`~humanfriendly.terminal.spinners.Spinner` class more customizable. The interval at which spinners are updated and the characters used to draw the animation of spinners can now be customized by callers. This was triggered by `executor issue #2`_. * Improve test skipping based on exception types. * The "deprecated imports" feature provided by :mod:`humanfriendly.deprecation` has been adopted to clean up the maze of (almost but not quite) cyclic import dependencies between modules. * HTML to ANSI functionality has been extracted to a new :mod:`humanfriendly.terminal.html` module. * Support for spinners has been extracted to a new :mod:`humanfriendly.terminal.spinners` module. * The use of positional arguments to initialize :class:`~humanfriendly.terminal.spinners.Spinner` objects has been deprecated using the new :func:`humanfriendly.deprecation.deprecated_args()` decorator function. * Added the :func:`humanfriendly.deprecation.deprecated_args()` decorator function which makes it easy to switch from positional arguments to keyword arguments without dropping backwards compatibility. * Accept pluralized disk size units (`#26`_). I'm not claiming this is a full OBS-URL: https://build.opensuse.org/request/show/789694 OBS-URL: https://build.opensuse.org/package/show/devel:languages:python/python-humanfriendly?expand=0&rev=28
2020-03-30 10:01:36 +00:00
BuildRequires: %{python_module mock}
BuildRequires: %{python_module pytest >= 3.0.7}
BuildRequires: %{python_module pytest-cov >= 2.4.0}
BuildRequires: %{pythons}
%if %{with python2}
BuildRequires: python2-monotonic
%endif
%endif
%ifpython2
Requires: python-monotonic
%endif
%python_subpackages
%description
The functions and classes in the humanfriendly package can be used to make
text interfaces more user friendly.
Some example features:
* Parsing and formatting numbers, file sizes, pathnames and timespans in
simple, human friendly formats.
* Easy to use timers for long running operations, with human friendly
formatting of the resulting timespans.
* Prompting the user to select a choice from a list of options by typing
the options number or a unique substring of the option.
* Terminal interaction including text styling (ANSI escape sequences), user
friendly rendering of usage messages and querying the terminal for its size.
%prep
%setup -q -n humanfriendly-%{version}
%build
%python_build
%install
%if !%{with test}
%python_install
%python_clone -a %{buildroot}%{_bindir}/humanfriendly
%{python_expand chmod a+x %{buildroot}%{$python_sitelib}/humanfriendly/tests.py
sed -i "s|#!%{_bindir}/env python|#!%__$python|" %{buildroot}%{$python_sitelib}/humanfriendly/tests.py
$python -m compileall -d %{$python_sitelib} %{buildroot}%{$python_sitelib}/humanfriendly/
$python -O -m compileall -d %{$python_sitelib} %{buildroot}%{$python_sitelib}/humanfriendly/
%fdupes %{buildroot}%{$python_sitelib}
}
%endif
%if %{with test}
%check
%pytest humanfriendly/tests.py
%endif
%if !%{with test}
%post
%python_install_alternative humanfriendly
%postun
%python_uninstall_alternative humanfriendly
%files %{python_files}
%license LICENSE.txt
%doc README.rst
%python_alternative %{_bindir}/humanfriendly
%{python_sitelib}/humanfriendly
%{python_sitelib}/humanfriendly-%{version}-py*.egg-info
%endif
%changelog