%global pkgname anyconfig %global desc \ Python library provides common APIs to load and dump configuration files in\ various formats such like JSON, YAML and XML with some useful features such as\ contents merge, templates, query, schema validation and generation support. %bcond_with optionals %bcond_with tests %bcond_with doc %bcond_with extras %if 0%{?rhel} == 7 || 0%{?epel} == 7 %bcond_without python2 %else %bcond_with python2 %endif Name: python-%{pkgname} Version: 0.9.10 Release: 1%{?dist} Summary: Python library to load and dump configuration files in various formats License: MIT URL: https://github.com/ssato/python-anyconfig Source0: %{pkgname}-%{version}.tar.gz BuildArch: noarch %if %{with doc} BuildRequires: make BuildRequires: python3-docutils BuildRequires: python3-sphinx %endif %if %{with python2} BuildRequires: PyYAML BuildRequires: python2-toml BuildRequires: python2-devel BuildRequires: python2-setuptools %else BuildRequires: python3-toml BuildRequires: python3-yaml BuildRequires: python3-devel BuildRequires: python3-setuptools %endif %description %{desc} %if %{with python2} %package -n python2-%{pkgname} Summary: %{summary} Requires: PyYAML Requires: python2-setuptools %if %{with extras} Requires: python2-jinja2 Requires: python2-jsonschema Requires: python2-ruamel-yaml %endif %if %{with optionals} Requires: python2-configobj Requires: python2-toml %endif %{?python_provide:%python_provide python2-%{pkgname}} %description -n python2-%{pkgname} %{desc} %else %package -n python3-%{pkgname} Summary: %{summary} Requires: python3-PyYAML Requires: python3-setuptools %if %{with extras} Requires: python3-jinja2 Requires: python3-jsonschema Requires: python3-ruamel-yaml %endif %if %{with optionals} Requires: python3-configobj Requires: python3-toml %endif %{?python_provide:%python_provide python3-%{pkgname}} %description -n python3-%{pkgname} %{desc} %endif %if %{with doc} %package doc Summary: Documentation for %{name} %description doc HTML documentation for %{name}. %endif %prep %autosetup -n %{pkgname}-%{version} %build %if %{with python2} %py2_build %else %py3_build %endif %if %{with doc} make -C docs/ html rm -f docs/build/html/.buildinfo rm -frv docs/build/html/_sources %endif %install %if %{with python2} %py2_install test -d %{buildroot}/usr/bin || { install -d %{buildroot}/usr/bin cat << EOF > %{buildroot}/usr/bin/anyconfig_cli #! /usr/bin/python import sys from pkg_resources import load_entry_point if __name__ == '__main__': sys.exit( load_entry_point('anyconfig', 'console_scripts', 'anyconfig_cli')() ) EOF } chmod +x %{buildroot}/usr/bin/anyconfig_cli %else %py3_install %endif %if %{with tests} %check tox -e py$(python -c "import sys; sys.stdout.write(sys.version[:3].replace('.', ''))") %endif %if %{with python2} %files -n python2-%{pkgname} %doc README.rst NEWS AUTHORS.txt %license LICENSE.MIT %if 0%{?rhel} == 7 %{python_sitelib}/* %else %{python2_sitelib}/* %endif %else %files -n python3-%{pkgname} %doc README.rst NEWS AUTHORS.txt %license LICENSE.MIT %{python3_sitelib}/* %endif %{_bindir}/anyconfig* %{_mandir}/*/anyconfig*.*.gz %if %{with doc} %files doc %doc README.rst NEWS AUTHORS.txt %doc docs/build/html %endif %changelog * Tue Feb 13 2018 Satoru SATOH - 0.9.4-1 - move most changelog entries to NEWS to keep RPM SPEC simple * Fri Jun 29 2012 Satoru SATOH - 0.0.1-1 - Initial packaging