%global srcname inigrep %if ( 0%{?rhel} && 0%{?rhel} == 6 ) || ( 0%{?centos} && 0%{?centos} == 6 ) %bcond_with python3 %bcond_without python2 %endif %if ( 0%{?rhel} && 0%{?rhel} == 7 ) || ( 0%{?centos} && 0%{?centos} == 7 ) %bcond_without python3 %bcond_without python2 %endif %if ( 0%{?rhel} && 0%{?rhel} > 7 ) || ( 0%{?centos} && 0%{?centos} > 7 ) %bcond_without python3 %bcond_with python2 %endif %if 0%{?fedora} %bcond_without python3 %bcond_with python2 %endif %if %{with python2} %{!?python_sitelib: %global python_sitelib %(%{__python} -c "from distutils.sysconfig import get_python_lib; print get_python_lib()")} %{!?pyver: %global pyver %(%{__python} -c "import sys ; print sys.version[:3]")} %global mkit_safever %(sh -c 'echo -n "0.2.1" | tr -c "a-zA-Z0-9._" _') %endif Name: python-inigrep Version: 0.2.1 Release: 1%{?dist} Summary: inigrep - grep for (some) INIs URL: https://gitlab.com/vornet/python/python-inigrep License: LGPLv2 Source0: %{name}-%{version}.tar.gz BuildArch: noarch BuildRequires: make %description inigrep is designed to read a particular simplistic dialect of INI configuration files. In a sense, it can be considered as a "grep for INIs", in that rather than parsing the file into a typed memory structure for later access, it passes file each time a query is done, and spits out relevant parts; treating everything as text. Hence, it's not intended as replacement for a full-blown configuration system but rather a quick & dirty "swiss axe" for quick & dirty scripts. %if %{with python2} %package -n python2-%{srcname} Summary: %{summary} BuildRequires: python2-devel Requires: python2-neaty %description -n python2-%{srcname} inigrep is designed to read a particular simplistic dialect of INI configuration files. In a sense, it can be considered as a "grep for INIs", in that rather than parsing the file into a typed memory structure for later access, it passes file each time a query is done, and spits out relevant parts; treating everything as text. Hence, it's not intended as replacement for a full-blown configuration system but rather a quick & dirty "swiss axe" for quick & dirty scripts. %endif %if %{with python3} %package -n python3-%{srcname} Summary: %{summary} BuildRequires: python3-devel BuildRequires: python3-setuptools Requires: python3-neaty %description -n python3-%{srcname} inigrep is designed to read a particular simplistic dialect of INI configuration files. In a sense, it can be considered as a "grep for INIs", in that rather than parsing the file into a typed memory structure for later access, it passes file each time a query is done, and spits out relevant parts; treating everything as text. Hence, it's not intended as replacement for a full-blown configuration system but rather a quick & dirty "swiss axe" for quick & dirty scripts. %endif %prep %setup -q %build make %{?_smp_mflags} PREFIX=/usr build_pystuff %if %{with python2} %{__python} setup.py build %endif %if %{with python3} %py3_build %endif %install %if %{with python2} %{__python} setup.py install \ -O1 \ --skip-build \ --root $RPM_BUILD_ROOT \ --install-data=%{_datadir} %endif %if %{with python3} %py3_install %endif %if %{with python2} %files -n python2-%{srcname} %{python_sitelib}/%{srcname}-%{mkit_safever}-py%{pyver}.egg-info %{python_sitelib}/%{srcname} %endif %if %{with python3} %files -n python3-%{srcname} %{python3_sitelib}/%{srcname}-*.egg-info %{python3_sitelib}/%{srcname}/ %endif %changelog # specfile built with MKit 0.0.53