Blob Blame Raw
%if 0%{?rhel} && 0%{?rhel} <= 6
%{!?__python2:        %global __python2 /usr/bin/python2}
%{!?python2_sitelib:  %global python2_sitelib %(%{__python2} -c "from distutils.sysconfig import get_python_lib; print(get_python_lib())")}
%{!?python2_sitearch: %global python2_sitearch %(%{__python2} -c "from distutils.sysconfig import get_python_lib; print(get_python_lib(1))")}
%endif

%if 0%{?fedora}
%global with_python3 1
%endif

Name:           python-ZConfig
Version:        3.0.4
Release:        1%{?dist}
Summary:        Structured Configuration Library
Group:          Development/Languages
License:        ZPLv2.1
URL:            http://www.zope.org/Members/fdrake/zconfig/
Source0:        http://pypi.python.org/packages/source/Z/ZConfig/ZConfig-%{version}.tar.gz

BuildArch:      noarch

BuildRequires:  python2-devel
BuildRequires:  python-setuptools
# for tests, not available in Fedora
#BuildRequires:  python-zope-testrunner

%if 0%{?with_python3}
BuildRequires:  python3-devel
BuildRequires:  python3-setuptools
# for tests, not available in Fedora
#BuildRequires:  python3-zope-testrunner
%endif

%description
ZConfig is a configuration library intended for general use. It supports
a hierarchical schema-driven configuration model that allows a schema to
specify data conversion routines written in Python. ZConfig's model is
very different from the model supported by the ConfigParser module found
in Python's standard library, and is more suitable to
configuration-intensive applications.

%if 0%{?with_python3}
%package -n python3-ZConfig
Summary:        Structured Configuration Library
Group:          Development/Languages

%description -n python3-ZConfig
ZConfig is a configuration library intended for general use. It supports
a hierarchical schema-driven configuration model that allows a schema to
specify data conversion routines written in Python. ZConfig's model is
very different from the model supported by the ConfigParser module found
in Python's standard library, and is more suitable to
configuration-intensive applications.
%endif


%prep
%setup -q -n ZConfig-%{version}

%if 0%{?with_python3}
rm -rf %{py3dir}
cp -a . %{py3dir}
%endif

%build
%{__python2} setup.py build

%if 0%{?with_python3}
pushd %{py3dir}
%{__python3} setup.py build
popd
%endif

%install
%if 0%{?with_python3}
pushd %{py3dir}
%{__python3} setup.py install -O1 --skip-build --root %{buildroot}
rm -f %{buildroot}%{python3_sitelib}/ZConfig/*.txt
mv %{buildroot}%{_bindir}/zconfig %{buildroot}%{_bindir}/python3-zconfig
mv %{buildroot}%{_bindir}/zconfig_schema2html %{buildroot}%{_bindir}/python3-zconfig_schema2html
popd
%endif

%{__python2} setup.py install -O1 --skip-build --root %{buildroot}
rm -f %{buildroot}%{python2_sitelib}/ZConfig/*.txt

#%%check
# Tests require zope.testrunner not yet available in Fedora
#%{__python2} setup.py test
#
#%if 0%{?with_python3}
#pushd %{py3dir}
#%{__python3} setup.py test
#popd
#%endif

%files
%doc COPYRIGHT.txt LICENSE.txt README.txt doc/zconfig.pdf
%doc ZConfig/*.txt
%{python2_sitelib}/*
%exclude %{python2_sitelib}/ZConfig/tests/
%{_bindir}/zconfig
%{_bindir}/zconfig_schema2html

%if 0%{?with_python3}
%files -n python3-ZConfig
%doc COPYRIGHT.txt LICENSE.txt README.txt doc/zconfig.pdf
%doc ZConfig/*.txt
%{python3_sitelib}/*
%exclude %{python3_sitelib}/ZConfig/tests/
%{_bindir}/python3-zconfig
%{_bindir}/python3-zconfig_schema2html
%endif


%changelog
* Tue Jun 10 2014 Ralph Bean <rbean@redhat.com> - 3.0.4-1
- Latest upstream.
- Added python3 subpackage.
- Modernized python2 macros
* Sat Jun 07 2014 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 2.9.2-5
- Rebuilt for https://fedoraproject.org/wiki/Fedora_21_Mass_Rebuild

* Sun Aug 04 2013 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 2.9.2-4
- Rebuilt for https://fedoraproject.org/wiki/Fedora_20_Mass_Rebuild

* Thu Feb 14 2013 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 2.9.2-3
- Rebuilt for https://fedoraproject.org/wiki/Fedora_19_Mass_Rebuild

* Sat Jul 21 2012 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 2.9.2-2
- Rebuilt for https://fedoraproject.org/wiki/Fedora_18_Mass_Rebuild

* Mon Mar 12 2012 Robin Lee <cheeselee@fedoraproject.org> - 2.9.2-1
- Update to 2.9.2

* Sat Jan 14 2012 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 2.9.0-2
- Rebuilt for https://fedoraproject.org/wiki/Fedora_17_Mass_Rebuild

* Wed Mar 30 2011 Robin Lee <cheeselee@fedoraproject.org> - 2.9.0-1
- Update to 2.9.0 (#689762)
- Exclude the tests

* Tue Feb 08 2011 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 2.8.0-5
- Rebuilt for https://fedoraproject.org/wiki/Fedora_15_Mass_Rebuild

* Wed Jul 21 2010 David Malcolm <dmalcolm@redhat.com> - 2.8.0-4
- Rebuilt for https://fedoraproject.org/wiki/Features/Python_2.7/MassRebuild

* Wed Jun 16 2010 Robin Lee <robinlee.sysu@gmail.com> - 2.8.0-3
- Workaround of installation

* Wed Jun 16 2010 Robin Lee <robinlee.sysu@gmail.com> - 2.8.0-2
- Retag

* Wed Jun 16 2010 Robin Lee <robinlee.sysu@gmail.com> - 2.8.0-1
- 2.8.0
- BR: python-zope-testing removed
- More docs included

* Sun Jul 26 2009 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 2.7.1-2
- Rebuilt for https://fedoraproject.org/wiki/Fedora_12_Mass_Rebuild

* Thu Jun 18 2009 Conrad Meyer <konrad@tylerc.org> - 2.7.1-1
- New version.

* Sun Dec 14 2008 Conrad Meyer <konrad@tylerc.org> - 2.6.1-1
- Initial package.