Björn Esser 8de14b1
# Conditional for release and snapshot builds. Uncomment for release-builds.
Björn Esser 8de14b1
%global rel_build 1
Björn Esser 8de14b1
Björn Esser 8de14b1
# Setup _pkgdocdir if not defined already.
Björn Esser 8de14b1
%{!?_pkgdocdir:%global _pkgdocdir	%{_docdir}/%{name}-%{version}}
Björn Esser 8de14b1
%{!?_py3docdir:%global _py3docdir	%{_docdir}/python3-%{pypi_name}-%{version}}
Björn Esser 8de14b1
Björn Esser 8de14b1
# Settings used for build from snapshots.
Björn Esser 8de14b1
%{!?rel_build:%global commit		ab2dc2db9db979816a4a7c4fd269ad2f27ef2d0b}
Björn Esser 8de14b1
%{!?rel_build:%global commit_date	20150104}
Björn Esser 8de14b1
%{!?rel_build:%global shortcommit	%(c=%{commit};echo ${c:0:7})}
Björn Esser 8de14b1
%{!?rel_build:%global gitver		git%{commit_date}-%{shortcommit}}
Björn Esser 8de14b1
%{!?rel_build:%global gitrel		.git%{commit_date}.%{shortcommit}}
Björn Esser 8de14b1
Björn Esser 8de14b1
# Proper naming for the tarball from github.
Björn Esser 8de14b1
%global gittar %{name}-%{version}%{!?rel_build:-%{gitver}}.tar.gz
Björn Esser 8de14b1
Björn Esser 8de14b1
# Upstream name
Björn Esser d68e95b
%global pypi_name django-angular
Björn Esser d68e95b
Björn Esser 8de14b1
# Do we build a Python3-version?
Björn Esser 8de14b1
%if 0%{?fedora} >= 13 || 0%{?rhel} >= 8
Björn Esser 8de14b1
%global with_python3 1
Björn Esser 8de14b1
%endif # 0%%{?fedora} >= 13 || 0%%{?rhel} >= 8
Björn Esser 8de14b1
Björn Esser 8de14b1
Name:			python-%{pypi_name}
Björn Esser 8de14b1
Version:		0.7.10
Björn Esser 8de14b1
Release:		1%{?dist}
Björn Esser 8de14b1
Summary:		Classes and utility functions to integrate AngularJS with Django
Björn Esser d68e95b
Björn Esser 8de14b1
License:		MIT
Björn Esser 8de14b1
URL:			https://github.com/jrief/%{pypi_name}
Björn Esser 8de14b1
# Sources for release-builds.
Björn Esser 8de14b1
%{?rel_build:Source0:	%{url}/archive/%{version}.tar.gz#/%{gittar}}
Björn Esser 8de14b1
# Sources for snapshot-builds.
Björn Esser 8de14b1
%{!?rel_build:Source0:	%{url}/archive/%{commit}.tar.gz#/%{gittar}}
Björn Esser d68e95b
Björn Esser 8de14b1
BuildArch:		noarch
Björn Esser d68e95b
Björn Esser 8de14b1
BuildRequires:		python2-devel
Björn Esser 8de14b1
BuildRequires:		python-setuptools
Björn Esser 8de14b1
Björn Esser 8de14b1
Requires:		python-six
Björn Esser 8de14b1
Requires:		python-django
Björn Esser d68e95b
Björn Esser d68e95b
%description
Björn Esser 8de14b1
Django-Angular is a collection of utilities, which aim to ease the
Björn Esser 8de14b1
integration of Django with AngularJS by providing reusable components.
Björn Esser 8de14b1
Björn Esser d68e95b
Björn Esser 8de14b1
%package doc
Björn Esser 8de14b1
Summary:		Documentation-files for %{name}
Björn Esser 8de14b1
Björn Esser 8de14b1
BuildRequires:		dos2unix
Björn Esser 8de14b1
BuildRequires:		python-sphinx
Björn Esser 8de14b1
Björn Esser 8de14b1
%description doc
Björn Esser 8de14b1
This package contains the documentation-files for %{name}.
Björn Esser 8de14b1
Björn Esser 8de14b1
Björn Esser 8de14b1
%if 0%{?with_python3}
Björn Esser 8de14b1
%package -n python3-%{pypi_name}
Björn Esser 8de14b1
Summary:		Classes and utility functions to integrate AngularJS with Django
Björn Esser 8de14b1
Björn Esser 8de14b1
BuildRequires:		python3-devel
Björn Esser 8de14b1
BuildRequires:		python3-setuptools
Björn Esser 8de14b1
Björn Esser 8de14b1
Requires:		python3-six
Björn Esser 8de14b1
Requires:		python3-django
Björn Esser 8de14b1
Björn Esser 8de14b1
%description -n python3-%{pypi_name}
Björn Esser d68e95b
Django-Angular is a collection of utilities, which aim to ease the
Björn Esser d68e95b
integration of Django with AngularJS by providing reusable components.
Björn Esser d68e95b
Björn Esser d68e95b
Björn Esser 8de14b1
%package -n python3-%{pypi_name}-doc
Björn Esser 8de14b1
Summary:		Documentation-files for python3-%{pypi_name}
Björn Esser 8de14b1
Björn Esser 8de14b1
BuildRequires:		dos2unix
Björn Esser 8de14b1
BuildRequires:		python3-sphinx
Björn Esser 8de14b1
Björn Esser 8de14b1
%description -n python3-%{pypi_name}-doc
Björn Esser 8de14b1
This package contains the documentation-files for python3-%{pypi_name}.
Björn Esser 8de14b1
%endif # 0%%{?with_python3}
Björn Esser 8de14b1
Björn Esser 8de14b1
Björn Esser 8de14b1
%prep
Björn Esser 8de14b1
%setup -qn %{pypi_name}-%{?rel_build:%{version}}%{!?rel_build:%{commit}}
Björn Esser 8de14b1
Björn Esser 8de14b1
# Remove bundled egg-info and unneded files.
Björn Esser 8de14b1
%{__rm} -rf *.egg-info examples/.coveragerc
Björn Esser 8de14b1
Björn Esser 8de14b1
%if 0%{?with_python3}
Björn Esser 8de14b1
# Prepare sources for Python3-build.
Björn Esser 8de14b1
%{__rm} -rf %{py3dir}
Björn Esser 8de14b1
%{__mkdir} -p %{py3dir}
Björn Esser 8de14b1
%{__cp} -a . %{py3dir}
Björn Esser 8de14b1
%{__sed} -i -e 's!sphinx-build!&-%{python3_version}!' %{py3dir}/docs/Makefile
Björn Esser 8de14b1
Björn Esser 8de14b1
# Fix hashbangs.
Björn Esser 8de14b1
for _file in $(%{__grep} -Rle '^#![ \t]*/usr/bin/env[ \t]*python' %{py3dir})
Björn Esser 8de14b1
do
Björn Esser 8de14b1
  %{__sed} -e 's~^#![ \t]*/usr/bin/env[ \t]*python.*$~#!%{__python3}~'	\
Björn Esser 8de14b1
	< ${_file} > ${_file}.new
Björn Esser 8de14b1
  /bin/touch -r ${_file} ${_file}.new
Björn Esser 8de14b1
  %{__mv} -f ${_file}.new ${_file}
Björn Esser 8de14b1
done
Björn Esser 8de14b1
%endif # 0%%{?with_python3}
Björn Esser 8de14b1
Björn Esser 8de14b1
# Fix hashbangs.
Björn Esser 8de14b1
for _file in $(%{__grep} -Rle '^#![ \t]*/usr/bin/env[ \t]*python' .)
Björn Esser 8de14b1
do
Björn Esser 8de14b1
  %{__sed} -e 's~^#![ \t]*/usr/bin/env[ \t]*python.*$~#!%{__python2}~'	\
Björn Esser 8de14b1
	< ${_file} > ${_file}.new
Björn Esser 8de14b1
  /bin/touch -r ${_file} ${_file}.new
Björn Esser 8de14b1
  %{__mv} -f ${_file}.new ${_file}
Björn Esser 8de14b1
done
Björn Esser d68e95b
Björn Esser d68e95b
Björn Esser d68e95b
%build
Björn Esser d68e95b
%{__python2} setup.py build
Björn Esser d68e95b
Björn Esser 8de14b1
# Documentation
Björn Esser 8de14b1
pushd docs
Björn Esser 8de14b1
%{__make} html
Björn Esser 8de14b1
%{__rm} -f _build/html/{.buildinfo,objects.inv}
Björn Esser 8de14b1
%{_bindir}/find _build/html -type f -print0 |				\
Björn Esser 8de14b1
	%{_bindir}/xargs -0 %{_bindir}/dos2unix -k -o -s
Björn Esser 8de14b1
popd
Björn Esser 8de14b1
Björn Esser 8de14b1
%if 0%{?with_python3}
Björn Esser 8de14b1
pushd %{py3dir}
Björn Esser 8de14b1
%{__python3} setup.py build
Björn Esser 8de14b1
Björn Esser 8de14b1
# Documentation
Björn Esser 8de14b1
pushd docs
Björn Esser 8de14b1
%{__make} html
Björn Esser 8de14b1
%{__rm} -f _build/html/{.buildinfo,objects.inv}
Björn Esser 8de14b1
%{_bindir}/find _build/html -type f -print0 |				\
Björn Esser 8de14b1
	%{_bindir}/xargs -0 %{_bindir}/dos2unix -k -o -s
Björn Esser 8de14b1
popd
Björn Esser 8de14b1
popd
Björn Esser 8de14b1
%endif # 0%%{?with_python3}
Björn Esser 8de14b1
Björn Esser d68e95b
Björn Esser d68e95b
%install
Björn Esser d68e95b
%{__python2} setup.py install --skip-build --root %{buildroot}
Björn Esser d68e95b
Björn Esser 8de14b1
# Documentation
Björn Esser 8de14b1
%{__mkdir} -p %{buildroot}%{?_pkgdocdir}
Björn Esser 8de14b1
%{__cp} -a CONTRIBUTIONS.md LICENSE.txt README.md			\
Björn Esser 8de14b1
		docs/_build/html client examples			\
Björn Esser 8de14b1
		%{buildroot}%{?_pkgdocdir}
Björn Esser 8de14b1
Björn Esser 8de14b1
%if 0%{?with_python3}
Björn Esser 8de14b1
pushd %{py3dir}
Björn Esser 8de14b1
%{__python3} setup.py  install --skip-build --root %{buildroot}
Björn Esser 8de14b1
Björn Esser 8de14b1
# Documentation
Björn Esser 8de14b1
%{__mkdir} -p %{buildroot}%{?_py3docdir}
Björn Esser 8de14b1
%{__cp} -a CONTRIBUTIONS.md LICENSE.txt README.md			\
Björn Esser 8de14b1
		docs/_build/html client examples			\
Björn Esser 8de14b1
		%{buildroot}%{?_py3docdir}
Björn Esser 8de14b1
popd
Björn Esser 8de14b1
%endif # 0%%{?with_python3}
Björn Esser 8de14b1
Björn Esser 8de14b1
Björn Esser 8de14b1
%check
Björn Esser 8de14b1
# noop
Björn Esser 8de14b1
Björn Esser 8de14b1
%if 0%{?with_python3}
Björn Esser 8de14b1
# Final clean-up.
Björn Esser 8de14b1
%{__rm} -rf %{py3dir}
Björn Esser 8de14b1
%endif # 0%%{?with_python3}
Björn Esser d68e95b
Björn Esser d68e95b
Björn Esser d68e95b
%files
Björn Esser 8de14b1
%doc %dir %{?_pkgdocdir}
Björn Esser 8de14b1
%doc %{?_pkgdocdir}/LICENSE.txt
Björn Esser d68e95b
%{python2_sitelib}/djangular
Björn Esser 8de14b1
%{python2_sitelib}/django_angular-%{version}-py%{python2_version}.egg-info
Björn Esser 8de14b1
Björn Esser 8de14b1
%files doc
Björn Esser 8de14b1
%doc %{?_pkgdocdir}
Björn Esser 8de14b1
Björn Esser 8de14b1
%if 0%{?with_python3}
Björn Esser 8de14b1
%files -n python3-%{pypi_name}
Björn Esser 8de14b1
%doc %dir %{?_py3docdir}
Björn Esser 8de14b1
%doc %{?_py3docdir}/LICENSE.txt
Björn Esser 8de14b1
%{python3_sitelib}/djangular
Björn Esser 8de14b1
%{python3_sitelib}/django_angular-%{version}-py%{python3_version}.egg-info
Björn Esser 8de14b1
Björn Esser 8de14b1
%files -n python3-%{pypi_name}-doc
Björn Esser 8de14b1
%doc %{?_py3docdir}
Björn Esser 8de14b1
%endif # 0%%{?with_python3}
Björn Esser 8de14b1
Björn Esser d68e95b
Björn Esser d68e95b
%changelog
Björn Esser 8de14b1
* Thu Jan 15 2015 Björn Esser <bjoern.esser@gmail.com> - 0.7.10-1
Björn Esser 8de14b1
- new upstream release 0.7.10
Björn Esser 8de14b1
- added sphinx-documentation
Björn Esser 8de14b1
- added Python3-build
Björn Esser 8de14b1
- several improvements to spec-file
Björn Esser 8de14b1
Björn Esser d68e95b
* Thu Jan 15 2015 Björn Esser <bjoern.esser@gmail.com> - 0.7.1-3
Björn Esser d68e95b
- initial import (#1182533)
Björn Esser d68e95b
Björn Esser d68e95b
* Mon May 26 2014 Matthias Runge <mrunge@redhat.com> - 0.7.1-2
Björn Esser d68e95b
- require python-django
Björn Esser d68e95b
Björn Esser d68e95b
* Tue May 20 2014 Matthias Runge <mrunge@redhat.com> - 0.7.1-1
Björn Esser d68e95b
- Initial package.