Blob Blame History Raw
# EPEL7 support: default Python is Python 2, and Python2 packages prefix
# is unversioned.
%if 0%{?rhel} && 0%{?rhel} <= 7
%global py2_namespace python
%global default_pyver 2
%else
%global py2_namespace python2
%global default_pyver 3
%endif

%global pkgname blessed
%global srcname 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 responds \
  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.


Name:       python-%{pkgname}
Version:    1.14.1
Release:    1%{?dist}
Summary:    %{summary}

Group:      Development/Libraries
License:    MIT
URL:        https://pypi.python.org/pypi/blessed
Source0:    https://files.pythonhosted.org/packages/source/b/%{pkgname}/%{pkgname}-%{version}.tar.gz

BuildArch:      noarch

BuildRequires:  %{py2_namespace}-devel
BuildRequires:  %{py2_namespace}-setuptools
BuildRequires:  %{py2_namespace}-six
BuildRequires:  %{py2_namespace}-wcwidth
# Unit tests
BuildRequires:  %{py2_namespace}-mock
%if 0%{?rhel} && 0%{?rhel} <= 7
BuildRequires:  pytest
%else
BuildRequires:  %{py2_namespace}-pytest
%endif
#BuildRequires:  %{py2_namespace}-pytest-xdist

Requires:       %{py2_namespace}-six
Requires:       %{py2_namespace}-wcwidth

%description %{_description}


%if %{py2_namespace} != python
%package -n %{py2_namespace}-%{pkgname}
Summary:        %{summary}
Group:          Development/Libraries
%{?python_provide:%python_provide %{py2_namespace}-%{pkgname}}

Requires:       %{py2_namespace}-six
Requires:       %{py2_namespace}-wcwidth

%description -n %{py2_namespace}-%{pkgname} %{_description}
%endif # py2_namespace != python


%package -n python%{python3_pkgversion}-%{pkgname}
Summary:        %{summary}
Group:          Development/Libraries

BuildRequires:  python%{python3_pkgversion}-devel
BuildRequires:  python%{python3_pkgversion}-setuptools
BuildRequires:  python%{python3_pkgversion}-six
BuildRequires:  python%{python3_pkgversion}-wcwidth
# Unit tests
BuildRequires:  python%{python3_pkgversion}-mock
BuildRequires:  python%{python3_pkgversion}-pytest

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

%description -n python%{python3_pkgversion}-%{pkgname} %{_description}

%if 0%{?with_python3_other}
%package -n python%{python3_other_pkgversion}-%{pkgname}
Summary:        %{summary}
Group:          Development/Libraries

BuildRequires:  python%{python3_other_pkgversion}-devel
BuildRequires:  python%{python3_other_pkgversion}-setuptools
BuildRequires:  python%{python3_other_pkgversion}-six
BuildRequires:  python%{python3_other_pkgversion}-wcwidth
# Unit tests
BuildRequires:  python%{python3_other_pkgversion}-mock
BuildRequires:  python%{python3_other_pkgversion}-pytest

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

%description -n python%{python3_other_pkgversion}-%{pkgname} %{_description}
%endif # with_python3_other


%prep
%autosetup -n %{pkgname}-%{version}


%build
%py2_build
%py3_build
%if 0%{?with_python3_other}
%py3_other_build
%endif


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


%check
export PYTHONIOENCODING=UTF8
export TERM=xterm-256color
export LANG=en_US.UTF-8
py.test-%{python2_version} --strict --verbose --verbose
py.test-%{python3_version} --strict --verbose --verbose
%if 0%{?with_python3_other}
py.test-%{python3_other_version} --strict --verbose --verbose
%endif


%files
%license LICENSE
%doc README.rst docs/*.rst
%{python2_sitelib}/%{srcname}
%{python2_sitelib}/%{srcname}-*.egg-info

%files -n python%{python3_pkgversion}-%{pkgname}
%license LICENSE
%doc README.rst docs/*.rst
%{python3_sitelib}/%{srcname}
%{python3_sitelib}/%{srcname}-*.egg-info

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


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