%if 0%{?fedora} || 0%{?rhel} > 7 %global with_python3 1 %endif %global pypi_name textfsm Name: python-%{pypi_name} Version: 0.3.2 Release: 1%{?dist} Summary: Python module for parsing semi-structured text into python tables License: ASL 2.0 URL: https://github.com/google/textfsm Source0: https://files.pythonhosted.org/packages/source/t/%{pypi_name}/%{pypi_name}-%{version}.tar.gz # https://github.com/google/textfsm/issues/26 Source1: COPYING BuildArch: noarch %description Python module which implements a template based state machine for parsing semi-formatted text. Originally developed to allow programmatic access to information returned from the command line interface (CLI) of networking devices. %package -n python2-%{pypi_name} Summary: %{summary} %{?python_provide:%python_provide python2-%{pypi_name}} BuildRequires: python2-devel BuildRequires: python2-setuptools Requires: python2-six %description -n python2-%{pypi_name} Python module which implements a template based state machine for parsing semi-formatted text. Originally developed to allow programmatic access to information returned from the command line interface (CLI) of networking devices. %if 0%{?with_python3} %package -n python3-%{pypi_name} Summary: %{summary} %{?python_provide:%python_provide python3-%{pypi_name}} BuildRequires: python3-devel BuildRequires: python3-setuptools Requires: python3-six %description -n python3-%{pypi_name} Python module which implements a template based state machine for parsing semi-formatted text. Originally developed to allow programmatic access to information returned from the command line interface (CLI) of networking devices. %endif %prep %autosetup -n %{pypi_name}-%{version} # Remove bundled egg-info rm -rf %{pypi_name}.egg-info # License is missing from the tarball, see https://github.com/google/textfsm/issues/26 cp %{SOURCE1} . %build %py2_build %if 0%{?with_python3} %py3_build %endif %install %if 0%{?with_python3} %py3_install %endif %py2_install %check %{__python2} setup.py test %if 0%{?with_python3} %{__python3} setup.py test %endif %files -n python2-%{pypi_name} %license COPYING %{python2_sitelib}/copyable_regex_object.py* %{python2_sitelib}/%{pypi_name}.py* %{python2_sitelib}/terminal.py* %{python2_sitelib}/clitable.py* %{python2_sitelib}/texttable.py* %{python2_sitelib}/%{pypi_name}-%{version}-py?.?.egg-info %if 0%{?with_python3} %files -n python3-%{pypi_name} %license COPYING %{python3_sitelib}/__pycache__/* %{python3_sitelib}/copyable_regex_object.py %{python3_sitelib}/%{pypi_name}.py %{python3_sitelib}/terminal.py %{python3_sitelib}/clitable.py %{python3_sitelib}/texttable.py %{python3_sitelib}/%{pypi_name}-%{version}-py?.?.egg-info %endif %changelog * Fri Mar 16 2018 Javier Peña - 0.3.2-1 - Initial package.