Blob Blame History Raw
# what it's called on pypi
%global srcname pdir2
# what it's imported as
%global libname pdir
# name of egg info directory
%global eggname pdir2
# package name fragment
%global pkgname pdir2

%global common_description %{expand:
An improved version of dir() with better output.  Attributes are grouped by
types/functionalities, with beautiful colors.  Supports ipython, ptpython,
bpython, and Jupyter Notebook.}

%if (%{defined fedora} && 0%{?fedora} < 30) || (%{defined rhel} && 0%{?rhel} < 8)
%bcond_without  python2
%bcond_without  python2_tests
%endif

%bcond_without  python3
%if %{defined fedora}
# missing python36-pandas in EPEL
%bcond_without  python3_tests
%endif

# Upstream tag doesn't match the version
%global tag 0.3.1


Name:           python-%{pkgname}
Version:        0.3.1.post2
Release:        1%{?dist}
Summary:        Pretty dir() printing with joy
License:        MIT
URL:            https://github.com/laike9m/pdir2
# PyPI tarball doesn't have tests
Source0:        %{url}/archive/v%{tag}/%{srcname}-%{version}.tar.gz
# https://github.com/laike9m/pdir2/issues/31
Patch0:         remove-environment-markers.patch
# The latest upstream release doesn't work with pytest 4.  It's fixed in
# master, but the upstream fix also drops support for pytest 2, which is the
# version we have in EL7.  This downstream only patch combines pytest 2 and 4
# support so we can work on EPEL7 through Rawhide.
# https://github.com/laike9m/pdir2/commit/787195841c86980562c81fc81df65d4096a73f09#diff-e2b79530c0a804d26dfec15c6f85f757
Patch1:         pytest-compat.patch
BuildArch:      noarch


%description %{common_description}


%if %{with python2}
%package -n python2-%{pkgname}
Summary:        %{summary}
BuildRequires:  python2-devel
BuildRequires:  python2-setuptools
%if %{with python2_tests}
BuildRequires:  python2-pytest >= 2.4
BuildRequires:  python2-pandas
BuildRequires:  python2-enum34
%endif
Requires:       python2-enum34
%{?python_provide:%python_provide python2-%{pkgname}}


%description -n python2-%{pkgname} %{common_description}
%endif


%if %{with python3}
%package -n python%{python3_pkgversion}-%{pkgname}
Summary:        %{summary}
BuildRequires:  python%{python3_pkgversion}-devel
BuildRequires:  python%{python3_pkgversion}-setuptools
%if %{with python3_tests}
BuildRequires:  python%{python3_pkgversion}-pytest >= 2.4
BuildRequires:  python%{python3_pkgversion}-pandas
%endif
%{?python_provide:%python_provide python%{python3_pkgversion}-%{pkgname}}


%description -n python%{python3_pkgversion}-%{pkgname} %{common_description}
%endif


%prep
%autosetup -n %{srcname}-%{tag} -p 1


%build
%{?with_python2:%py2_build}
%{?with_python3:%py3_build}


%install
%{?with_python2:%py2_install}
%{?with_python3:%py3_install}


%check
%{?with_python2_tests:PYTHONPATH=%{buildroot}%{python2_sitelib} py.test-%{python2_version} --verbose}
%{?with_python3_tests:PYTHONPATH=%{buildroot}%{python3_sitelib} py.test-%{python3_version} --verbose}


%if %{with python2}
%files -n python2-%{pkgname}
%license LICENSE
%doc README.md HISTORY.md
%{python2_sitelib}/%{libname}
%{python2_sitelib}/%{eggname}-%{version}-py%{python2_version}.egg-info
%endif


%if %{with python3}
%files -n python%{python3_pkgversion}-%{pkgname}
%license LICENSE
%doc README.md HISTORY.md
%{python3_sitelib}/%{libname}
%{python3_sitelib}/%{eggname}-%{version}-py%{python3_version}.egg-info
%endif


%changelog
* Fri May 03 2019 Carl George <carl@george.computer> - 0.3.1.post2-1
- Latest upstream
- Drop python3_other subpackage
- Disable python2 subpackage on EL8
- Run python2 tests on EL7
- Add patch for pytest 4 compatibility rhbz#1706163

* Sat Feb 02 2019 Fedora Release Engineering <releng@fedoraproject.org> - 0.3.0-6
- Rebuilt for https://fedoraproject.org/wiki/Fedora_30_Mass_Rebuild

* Fri Sep 21 2018 Carl George <carl@george.computer> - 0.3.0-5
- Disable python2 subpackage on F30+
- Enable python36 subpackage on EPEL7

* Sat Jul 14 2018 Fedora Release Engineering <releng@fedoraproject.org> - 0.3.0-4
- Rebuilt for https://fedoraproject.org/wiki/Fedora_29_Mass_Rebuild

* Mon Jun 25 2018 Carl George <carl@george.computer> - 0.3.0-3
- Add patch1 to mark test_pdir_class as an expected fail
- Share doc and license dir between subpackages
- Update URL

* Tue Jun 19 2018 Miro HronĨok <mhroncok@redhat.com> - 0.3.0-2
- Rebuilt for Python 3.7

* Wed Feb 28 2018 Carl George <carl@george.computer> - 0.3.0-1
- Latest upstream

* Tue Feb 27 2018 Iryna Shcherbina <ishcherb@redhat.com> - 0.2.2-3
- Update Python 2 dependency declarations to new packaging standards
  (See https://fedoraproject.org/wiki/FinalizingFedoraSwitchtoPython3)

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

* Fri Oct 20 2017 Carl George <carl@george.computer> - 0.2.2-1
- Latest upstream
- Remove environment markers from setup.py to allow using older setuptools
- EPEL compatibility

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

* Wed Jul 05 2017 Carl George <carl@george.computer> - 0.2.1-1
- Latest upstream
- Remove patch100 and patch101

* Thu Jun 29 2017 Carl George <carl@george.computer> - 0.2.0-1
- Initial package