Blob Blame Raw
%global pypi_name blessed
%global summary A thin, practical wrapper around terminal capabilities in Python
%global _description \
Blessed is a thin, practical wrapper around terminal styling, screen \
positioning, and keyboard input. \
\
It provides: \
- Styles, color, and maybe a little positioning without necessarily clearing \
  the whole screen first. \
- Works great with standard Python string formatting. \
- Provides up-to-the-moment terminal height and width, so you can respond \
  to terminal size changes. \
- Avoids making a mess if the output gets piped to a non-terminal: outputs \
  to any file-like object such as StringIO, files, or pipes. \
- Uses the terminfo(5) database so it works with any terminal type and \
  supports any terminal capability: No more C-like calls to tigetstr and \
  tparm. \
- Keeps a minimum of internal state, so you can feel free to mix and match \
  with calls to curses or whatever other terminal libraries you like. \
- Provides plenty of context managers to safely express terminal modes, \
  automatically restoring the terminal to a safe state on exit. \
- Act intelligently when somebody redirects your output to a file, omitting \
  all of the terminal sequences such as styling, colors, or positioning. \
- Dead-simple keyboard handling: safely decoding unicode input in your \
  system’s preferred locale and supports application/arrow keys. \
- Allows the printable length of strings containing sequences to be \
  determined.

%bcond_without python3

# Disable dependency generator until it has test code
%{?python_disable_dependency_generator}

# Drop Python 2 with Fedora 30 and EL8
%if (0%{?fedora} && 0%{?fedora} < 30) || (0%{?rhel} && 0%{?rhel} < 8)
  %bcond_without python2
%else
  %bcond_with python2
%endif

Name:       python-%{pypi_name}
Version:    1.15.0
Release:    9%{?dist}
Summary:    %{summary}

License:    MIT
URL:        https://github.com/jquast/blessed
Source0:    %{pypi_source}
BuildArch:      noarch

%if 0%{?el6}
Patch0:     el6_pytest_fixes.patch
Patch1:     el6_setup_fixes.patch
%endif

%if %{with python2}
BuildRequires:  python2-devel
BuildRequires:  python2-setuptools
BuildRequires:  python2-six
BuildRequires:  python2-wcwidth
BuildRequires:  python2-mock
BuildRequires:  python2-pytest
%endif

%if %{with python3}
BuildRequires:  python%{python3_pkgversion}-devel
BuildRequires:  python%{python3_pkgversion}-setuptools
BuildRequires:  python%{python3_pkgversion}-six
BuildRequires:  python%{python3_pkgversion}-wcwidth
BuildRequires:  python%{python3_pkgversion}-mock
BuildRequires:  python%{python3_pkgversion}-pytest
%endif

%if 0%{?with_python3_other}
BuildRequires:  python%{python3_other_pkgversion}-devel
BuildRequires:  python%{python3_other_pkgversion}-setuptools
BuildRequires:  python%{python3_other_pkgversion}-six
BuildRequires:  python%{python3_other_pkgversion}-wcwidth
BuildRequires:  python%{python3_other_pkgversion}-mock
BuildRequires:  python%{python3_other_pkgversion}-pytest
%endif

%description %{_description}


# Python 2 package
%if %{with python2}
%package -n     python2-%{pypi_name}
Summary:        %{summary}
%{?python_provide:%python_provide python2-%{pypi_name}}

Requires:       python2-six
Requires:       python2-wcwidth

%description -n python2-%{pypi_name} %{_description}
%endif

# Python 3 package
%if %{with python3}
%package -n     python%{python3_pkgversion}-%{pypi_name}
Summary:        %{summary}
%{?python_provide:%python_provide python%{python3_pkgversion}-%{pypi_name}}

Requires:       python%{python3_pkgversion}-six
Requires:       python%{python3_pkgversion}-wcwidth

%description -n python%{python3_pkgversion}-%{pypi_name} %{_description}
%endif

# Python 3 other package
%if 0%{?with_python3_other}
%package -n     python%{python3_other_pkgversion}-%{pypi_name}
Summary:        %{summary}
%{?python_provide:%python_provide python%{python3_other_pkgversion}-%{pypi_name}}

Requires:       python%{python3_other_pkgversion}-six
Requires:       python%{python3_other_pkgversion}-wcwidth

%description -n python%{python3_other_pkgversion}-%{pypi_name} %{_description}
%endif


%prep
%autosetup -p1 -n %{pypi_name}-%{version}

# Remove bundled egg-info
rm -rf %{pypi_name}.egg-info


%build
%if %{with python2}
%py2_build
%endif

%if %{with python3}
%py3_build
%endif

%if 0%{?with_python3_other}
%py3_other_build
%endif


%install
%if 0%{?with_python3_other}
%py3_other_install
%endif

%if %{with python3}
%py3_install
%endif

%if %{with python2}
%py2_install
%endif


%check
export PYTHONIOENCODING=UTF8
export TERM=xterm-256color
%if %{with python2}
%{__python2} -m pytest --strict --verbose --verbose --exitfirst
%endif

%if %{with python3}
%{__python3} -m pytest --strict --verbose --verbose --exitfirst
%endif

%if 0%{?with_python3_other}
%{__python3_other} -m pytest --strict --verbose --verbose --exitfirst
%endif


%if %{with python2}
%files -n python2-%{pypi_name}
%license LICENSE
%doc README.rst docs/*.rst
%{python2_sitelib}/%{pypi_name}
%{python2_sitelib}/%{pypi_name}-*.egg-info
%endif

%if %{with python3}
%files -n python%{python3_pkgversion}-%{pypi_name}
%license LICENSE
%doc README.rst docs/*.rst
%{python3_sitelib}/%{pypi_name}
%{python3_sitelib}/%{pypi_name}-*.egg-info
%endif

%if 0%{?with_python3_other}
%files -n python%{python3_other_pkgversion}-%{pypi_name}
%license LICENSE
%doc README.rst docs/*.rst
%{python3_other_sitelib}/%{pypi_name}
%{python3_other_sitelib}/%{pypi_name}-*.egg-info
%endif


%changelog
* Sat Feb 02 2019 Fedora Release Engineering <releng@fedoraproject.org> - 1.15.0-9
- Rebuilt for https://fedoraproject.org/wiki/Fedora_30_Mass_Rebuild

* Mon Dec 24 2018 Avram Lubkin <aviso@rockhopper.net> - 1.15.0-8
- Disable Python dependency generator until it has test code

* Mon Dec 24 2018 Avram Lubkin <aviso@rockhopper.net> - 1.15.0-7
- Remove Python 2 packages in Fedora 30+ (bz#1661354)
- Clean up spec

* Sun Nov 18 2018 Zbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl> - 1.15.0-6
- Drop explicit locale setting
  See https://fedoraproject.org/wiki/Changes/Remove_glibc-langpacks-all_from_buildroot

* Tue Nov 13 2018 Avram Lubkin <aviso@rockhopper.net> - 1.15.0-5
- Build Python 3 version on all platforms

* Fri Jul 13 2018 Fedora Release Engineering <releng@fedoraproject.org> - 1.15.0-4
- Rebuilt for https://fedoraproject.org/wiki/Fedora_29_Mass_Rebuild

* Mon Jul 02 2018 Miro Hrončok <mhroncok@redhat.com> - 1.15.0-3
- Rebuilt for Python 3.7

* Wed Jun 20 2018 Avram Lubkin <aviso@rockhopper.net> - 1.15.0-2
- Fixed spec changelog error

* Wed Jun 20 2018 Avram Lubkin <aviso@rockhopper.net>- 1.15.0-1
- Updated to 1.15.0 (Python 3.7 Support)
- Exit tests on first failure to avoid loops

* Tue Jun 19 2018 Miro Hrončok <mhroncok@redhat.com> - 1.14.1-7
- Rebuilt for Python 3.7

* Fri Feb 09 2018 Fedora Release Engineering <releng@fedoraproject.org> - 1.14.1-6
- Rebuilt for https://fedoraproject.org/wiki/Fedora_28_Mass_Rebuild

* Sun Dec 17 2017 Zbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl> - 1.14.1-5
- Fix creation of python2- subpackage

* Wed Oct 04 2017 Avram Lubkin <aviso@rockhopper.net> - 1.14.1-4
- Conflicting ordereddict requirements in EL6

* Wed Oct 04 2017 Avram Lubkin <aviso@rockhopper.net> - 1.14.1-3
- Add EL6 build support

* Thu Jul 27 2017 Fedora Release Engineering <releng@fedoraproject.org> - 1.14.1-2
- Rebuilt for https://fedoraproject.org/wiki/Fedora_27_Mass_Rebuild

* Mon Mar 13 2017 Aurelien Bompard <abompard@fedoraproject.org> - 1.14.1
- Initial package.