%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 %if 0%{?fedora} || 0%{?rhel} > 7 || 0%{?epel} > 7 %bcond_without python3 %bcond_without doc %bcond_without extras %else %bcond_with python3 %bcond_with doc %bcond_with extras %endif Name: python-%{pkgname} Version: 0.9.8 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: python2-docutils BuildRequires: python2-sphinx BuildRequires: python2-configobj BuildRequires: python2-toml BuildRequires: PyYAML %endif BuildRequires: python2-devel BuildRequires: python2-setuptools %if %{with python3} BuildRequires: python3-devel BuildRequires: python3-setuptools %endif %description %{desc} %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} %if %{with python3} %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 %py2_build %if %{with python3} %py3_build %endif %if %{with doc} make -C docs/ html rm -f docs/build/html/.buildinfo rm -frv docs/build/html/_sources %endif %install %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 %if %{with python3} %py3_install %endif %if %{with tests} %check ./pkg/runtest.sh %endif %files -n python2-%{pkgname} %doc README.rst NEWS AUTHORS.txt %license LICENSE.MIT %if 0%{?rhel} == 7 %{python_sitelib}/* %else %{python2_sitelib}/* %endif %if %{with python3} %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