Blob Blame History Raw
# Created by pyp2rpm-3.2.1
%global pypi_name mtg

Name:           python-%{pypi_name}
Version:        1.6.1
Release:        6%{?dist}
Summary:        Console-based access to the Gatherer Magic Card Database

License:        MIT
URL:            https://github.com/chigby/mtg

# Documentation, license, and unit tests aren't available from PyPI, so pull from github.
# Unfortunately, we have to modify the github tarball to remove Gatherer data. (tests/_data).
#Source0:        https://github.com/chigby/%{pypi_name}/archive/%{version}/%{pypi_name}-%{version}.tar.gz
Source0:        %{pypi_name}-%{version}.tar.gz

BuildArch:      noarch

BuildRequires:  python2-devel
BuildRequires:  python2-setuptools
BuildRequires:  python2-lxml, python2-cssselect, python2-nose

BuildRequires:  python3-devel
BuildRequires:  python3-setuptools
BuildRequires:  python3-lxml, python3-cssselect, python3-nose

%description
Search for Magic cards from the command line. Limit your results by card name,
color, type, rules text, converted mana cost, power, toughness, or expansion
set. Rulings and flavor text also available. Clean interface and output.

%package -n     python2-%{pypi_name}
Summary:        Console-based access to the Gatherer Magic Card Database
%{?python_provide:%python_provide python2-%{pypi_name}}

Requires:       python2-lxml
Requires:       python2-cssselect

%description -n python2-%{pypi_name}
Search for Magic cards from the command line. Limit your results by card name,
color, type, rules text, converted mana cost, power, toughness, or expansion
set. Rulings and flavor text also available. Clean interface and output.

%package -n     python3-%{pypi_name}
Summary:        Console-based access to the Gatherer Magic Card Database
%{?python_provide:%python_provide python3-%{pypi_name}}

Requires:       python3-lxml
Requires:       python3-cssselect

# This is (primarily) a CLI application; provide "mtg".
Provides:       mtg

%description -n python3-%{pypi_name}
Search for Magic cards from the command line. Limit your results by card name,
color, type, rules text, converted mana cost, power, toughness, or expansion
set. Rulings and flavor text also available. Clean interface and output.


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

# Remove unit tests that depend on _data (which is copyright WoTC and probably not shippable).
rm -f tests/card_extractor_test.py

%build
%py2_build
%py3_build

%install
# Must do the subpackages' install first because the scripts in /usr/bin are
# overwritten with every setup.py install.

# We don't need to provide the python2 version of the mtg binary.
%py2_install

%py3_install

# Since there's no potential collision, we don't need to version the mtg binary.
# cp %{buildroot}/%{_bindir}/mtg %{buildroot}/%{_bindir}/mtg-3
# ln -sf %{_bindir}/mtg-3 %{buildroot}/%{_bindir}/mtg-%{python3_version}

%check
export LC_ALL=en_US.UTF-8
nosetests-2 -v
nosetests-3 -v

%files -n python2-%{pypi_name}
%doc README.md
%license LICENSE
%{python2_sitelib}/mtglib
%{python2_sitelib}/%{pypi_name}-%{version}-py?.?.egg-info

%files -n python3-%{pypi_name}
%doc README.md
%license LICENSE
%{_bindir}/mtg
%{python3_sitelib}/mtglib
%{python3_sitelib}/%{pypi_name}-%{version}-py?.?.egg-info

%changelog
* Tue Jun 19 2018 Miro HronĨok <mhroncok@redhat.com> - 1.6.1-6
- Rebuilt for Python 3.7

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

* Thu Jan 25 2018 Iryna Shcherbina <ishcherb@redhat.com> - 1.6.1-4
- Update Python 2 dependency declarations to new packaging standards
  (See https://fedoraproject.org/wiki/FinalizingFedoraSwitchtoPython3)

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

* Sun Feb 26 2017 Ben Rosser <rosser.bjr@gmail.com> - 1.6.1-2
- Remove mtg-2* binaries, as they should behave the same as the python3 versions.
- Get rid of the versioned mtg-3 binaries, as there's no potential collision with python2 binaries.
- Remove card_extractor_test.py, as those tests require tests/_data directory.
- Remove tests/_data directory from tarball, as Fedora probably can't ship it in a source package.

* Wed Feb 22 2017 Ben Rosser <rosser.bjr@gmail.com> - 1.6.1-1
- Initial package.