Blob Blame History Raw
%if 0%{?fedora} > 12
%global with_python3 1
%else
%{!?python_sitearch: %global python_sitearch %(%{__python2} -c "from distutils.sysconfig import get_python_lib; print(get_python_lib(1))")}
%endif

%global upstream_name dockerpty

Name:           python-%{upstream_name}
Version:        0.2.3
Release:        1%{?dist}
Summary:        Python library to use the pseudo-tty of a docker container

Group:          Development/Libraries
License:        ASL 2.0
URL:            https://github.com/d11wtq/dockerpty
Source0:        https://pypi.python.org/packages/source/d/%{upstream_name}/%{upstream_name}-%{version}.tar.gz

BuildRequires:  python-devel python-setuptools 

%if 0%{?with_python3}
BuildRequires:  python3-devel python3-setuptools 
# For /usr/bin/2to3
BuildRequires:  python-tools
%endif # if with_python3

BuildArch:      noarch

%description
Provides the functionality needed to operate the pseudo-tty (PTY) allocated to
a docker container, using the Python client

%if 0%{?with_python3}
%package -n python3-%{upstream_name}
Summary:    Python library to use the pseudo-tty of a docker container
Group:      Development/Languages

%description -n python3-%{upstream_name}
Provides the functionality needed to operate the pseudo-tty (PTY) allocated to
a docker container, using the Python client
%endif #if with_python3

%prep
%setup -q -n %{upstream_name}-%{version}

%if 0%{?with_python3}
rm -rf %{py3dir}
cp -a . %{py3dir}
2to3 --write --nobackups %{py3dir}
%endif # with_python3

%build
CFLAGS="$RPM_OPT_FLAGS" %{__python2} setup.py build

%if 0%{?with_python3}
pushd %{py3dir}
CFLAGS="$RPM_OPT_FLAGS" %{__python3} setup.py build
popd
%endif # with_python3


%install
rm -rf $RPM_BUILD_ROOT
%{__python2} setup.py install -O1 --skip-build --root $RPM_BUILD_ROOT

%if 0%{?with_python3}
pushd %{py3dir}
%{__python3} setup.py install -O1 --skip-build --root $RPM_BUILD_ROOT
popd
%endif # with_python3

# no tests provided
%check
%{__python2} setup.py test

%if 0%{?with_python3}
pushd %{py3dir}
%{__python3} setup.py test
popd
%endif # with_python3

%files
%doc PKG-INFO README.md LICENSE.txt MANIFEST.in setup.cfg
%dir %{python2_sitelib}/dockerpty
%{python2_sitelib}/dockerpty/*
%dir %{python2_sitelib}/dockerpty-*.egg-info
%{python2_sitelib}/dockerpty-*.egg-info/*


%if 0%{?with_python3}
%files -n python3-%{upstream_name}
%doc PKG-INFO README.md LICENSE.txt MANIFEST.in setup.cfg
%dir %{python3_sitelib}/dockerpty
%{python3_sitelib}/dockerpty/*
%dir %{python3_sitelib}/dockerpty-*.egg-info
%{python3_sitelib}/dockerpty-*.egg-info/*
%endif # with_python3

%changelog
* Fri Aug 22 2014 Adam Miller <maxamillion@fedoraproject.org> - 0.2.3-1
- Update to latest upstream

* Mon Aug 11 2014 Adam Miller <maxamillion@fedoraproject.org> - 0.2.1-4
- Fixed egg-info dir listings, set noarch based on reviewer feedback

* Mon Aug 11 2014 Adam Miller <maxamillion@fedoraproject.org> - 0.2.1-3
- Fixed files section, fixed py3 summary listing

* Fri Aug 08 2014 Adam Miller <maxamillion@fedoraproject.org> - 0.2.1-2
- Fix __python vs __python2 macro usage and  __python3's description
- Set ExclusiveArch because of docker
- Remove clean section, not needed

* Wed Jul 23 2014 Adam Miller <maxamillion@fedoraproject.org> - 0.2.1-1
- Initial package for Fedora