Blob Blame History Raw
# Conditional for release and snapshot builds. Uncomment for release-builds.
%global rel_build 1

# Setup _pkgdocdir if not defined already.
%{!?_py2docdir:%global _py2docdir	%{_docdir}/python2-%{pypi_name}%{!?_pkgdocdir:-%{version}}}
%{!?_py3docdir:%global _py3docdir	%{_docdir}/python3-%{pypi_name}%{!?_pkgdocdir:-%{version}}}
%{!?_pkgdocdir:%global _pkgdocdir	%{_docdir}/%{name}-%{version}}

# Settings used for build from snapshots.
%{!?rel_build:%global commit		ab2dc2db9db979816a4a7c4fd269ad2f27ef2d0b}
%{!?rel_build:%global commit_date	20150104}
%{!?rel_build:%global shortcommit	%(c=%{commit};echo ${c:0:7})}
%{!?rel_build:%global gitver		git%{commit_date}-%{shortcommit}}
%{!?rel_build:%global gitrel		.git%{commit_date}.%{shortcommit}}

# Proper naming for the tarball from github.
%global gittar %{name}-%{version}%{!?rel_build:-%{gitver}}.tar.gz

# Upstream name
%global pypi_name django-angular

# Do we build a Python3-version?
%if 0%{?fedora} >= 13 || 0%{?rhel} >= 8
%global with_python3 1
%endif # 0%%{?fedora} >= 13 || 0%%{?rhel} >= 8

Name:			python-%{pypi_name}
Version:		1.1.2
Release:		1%{?gitrel}%{?dist}
Summary:		Classes and utility functions to integrate AngularJS with Django

License:		MIT
URL:			https://github.com/jrief/%{pypi_name}
# Sources for release-builds.
%{?rel_build:Source0:	%{url}/archive/%{version}.tar.gz#/%{gittar}}
# Sources for snapshot-builds.
%{!?rel_build:Source0:	%{url}/archive/%{commit}.tar.gz#/%{gittar}}

BuildArch:		noarch

%description
Django-Angular is a collection of utilities, which aim to ease the
integration of Django with AngularJS by providing reusable components.


%package -n python2-%{pypi_name}
Summary:		Classes and utility functions to integrate AngularJS with Django

BuildRequires:		python2-devel
BuildRequires:		python2-setuptools

Requires:		python2-six
Requires:		python2-django

%{?python_provide:%python_provide python2-%{pypi_name}}

%description -n python2-%{pypi_name}
Django-Angular is a collection of utilities, which aim to ease the
integration of Django with AngularJS by providing reusable components.


%package -n python2-%{pypi_name}-doc
Summary:		Documentation-files for %{name}

BuildRequires:		dos2unix
BuildRequires:		python2-sphinx

Obsoletes:		%{name}-doc	< 1.0.0
Provides:		%{name}-doc	= %{version}-%{release}

%description -n python2-%{pypi_name}-doc
This package contains the documentation-files for python2-%{pypi_name}.


%if 0%{?with_python3}
%package -n python3-%{pypi_name}
Summary:		Classes and utility functions to integrate AngularJS with Django

BuildRequires:		python3-devel
BuildRequires:		python3-setuptools

Requires:		python3-six
Requires:		python3-django

%{?python_provide:%python_provide python3-%{pypi_name}}


%description -n python3-%{pypi_name}
Django-Angular is a collection of utilities, which aim to ease the
integration of Django with AngularJS by providing reusable components.


%package -n python3-%{pypi_name}-doc
Summary:		Documentation-files for python3-%{pypi_name}

BuildRequires:		dos2unix
BuildRequires:		python3-sphinx

%description -n python3-%{pypi_name}-doc
This package contains the documentation-files for python3-%{pypi_name}.
%endif # 0%%{?with_python3}


%prep
%if 0%{?rel_build}
%autosetup -n %{pypi_name}-%{version} -p 1
%else
%autosetup -n %{pypi_name}-%{commit} -p 1
%endif

# Remove bundled egg-info and unneded files.
%{__rm} -rf *.egg-info examples/.coveragerc

%if 0%{?with_python3}
# Prepare sources for Python3-build.
%{__rm} -rf %{py3dir}
%{__mkdir} -p %{py3dir}
%{__cp} -a . %{py3dir}
%{__sed} -i -e 's!sphinx-build!&-%{python3_version}!' %{py3dir}/docs/Makefile

# Fix hashbangs.
for _file in $(%{__grep} -Rle '^#![ \t]*/usr/bin/env[ \t]*python' %{py3dir})
do
  %{__sed} -e 's~^#![ \t]*/usr/bin/env[ \t]*python.*$~#!%{__python3}~'	\
	< ${_file} > ${_file}.new
  /bin/touch -r ${_file} ${_file}.new
  %{__mv} -f ${_file}.new ${_file}
done
%endif # 0%%{?with_python3}

# Fix hashbangs.
for _file in $(%{__grep} -Rle '^#![ \t]*/usr/bin/env[ \t]*python' .)
do
  %{__sed} -e 's~^#![ \t]*/usr/bin/env[ \t]*python.*$~#!%{__python2}~'	\
	< ${_file} > ${_file}.new
  /bin/touch -r ${_file} ${_file}.new
  %{__mv} -f ${_file}.new ${_file}
done


%build
%py2_build

# Documentation
pushd docs
%make_build html
%{__rm} -f _build/html/{.buildinfo,objects.inv}
%{_bindir}/find _build/html -type f -print0 |				\
	%{_bindir}/xargs -0 %{_bindir}/dos2unix -k -o -s
popd

%if 0%{?with_python3}
pushd %{py3dir}
%py3_build

# Documentation
pushd docs
%make_build html
%{__rm} -f _build/html/{.buildinfo,objects.inv}
%{_bindir}/find _build/html -type f -print0 |				\
	%{_bindir}/xargs -0 %{_bindir}/dos2unix -k -o -s
popd
popd
%endif # 0%%{?with_python3}


%install
%py2_install

# Documentation
%{__mkdir} -p %{buildroot}%{?_py2docdir}
%{__cp} -a CONTRIBUTING.md README.md docs/_build/html client examples	\
		%{buildroot}%{?_py2docdir}
%if 0%{?rhel} && 0%{?rhel} <= 6
%{__cp} -a LICENSE.txt %{buildroot}%{?_py2docdir}
%endif

%if 0%{?with_python3}
pushd %{py3dir}
%py3_install

# Documentation
%{__mkdir} -p %{buildroot}%{?_py3docdir}
%{__cp} -a CONTRIBUTING.md README.md docs/_build/html client examples	\
		%{buildroot}%{?_py3docdir}
popd
%if 0%{?rhel} && 0%{?rhel} <= 6
%{__cp} -a LICENSE.txt %{buildroot}%{?_py3docdir}
%endif
%endif # 0%%{?with_python3}


%check
# noop

%if 0%{?with_python3}
# Final clean-up.
%{__rm} -rf %{py3dir}
%endif # 0%%{?with_python3}


%files -n python2-%{pypi_name}
%doc %dir %{?_py2docdir}
%if 0%{fedora} || 0%{?rhel} >= 7
%license LICENSE.txt
%else
%doc %{?_py2docdir}/LICENSE.txt
%endif
%{python2_sitelib}/djng
%{python2_sitelib}/django_angular-%{version}-py%{python2_version}.egg-info

%files -n python2-%{pypi_name}-doc
%if 0%{fedora} || 0%{?rhel} >= 7
%license %{_datadir}/licenses/python2-%{pypi_name}*
%endif
%doc %{?_py2docdir}

%if 0%{?with_python3}
%files -n python3-%{pypi_name}
%doc %dir %{?_py3docdir}
%if 0%{fedora} || 0%{?rhel} >= 7
%license LICENSE.txt
%else
%doc %{?_py3docdir}/LICENSE.txt
%endif
%{python3_sitelib}/djng
%{python3_sitelib}/django_angular-%{version}-py%{python3_version}.egg-info

%files -n python3-%{pypi_name}-doc
%if 0%{fedora} || 0%{?rhel} >= 7
%license %{_datadir}/licenses/python3-%{pypi_name}*
%endif
%doc %{?_py3docdir}
%endif # 0%%{?with_python3}


%changelog
* Thu Aug 24 2017 Björn Esser <besser82@fedoraproject.org> - 1.1.2-1
- Update to 1.1.2 (rhbz#1480933)

* Thu Jul 27 2017 Fedora Release Engineering <releng@fedoraproject.org> - 1.0.0-2
- Rebuilt for https://fedoraproject.org/wiki/Fedora_27_Mass_Rebuild

* Mon Jul 24 2017 Björn Esser <besser82@fedoraproject.org> - 1.0.0-1
- Update to 1.0.0 (rhbz#1474123)
- Update spec file to recent guidelines

* Sat Feb 11 2017 Fedora Release Engineering <releng@fedoraproject.org> - 0.8.3-3
- Rebuilt for https://fedoraproject.org/wiki/Fedora_26_Mass_Rebuild

* Mon Dec 19 2016 Miro Hrončok <mhroncok@redhat.com> - 0.8.3-2
- Rebuild for Python 3.6

* Wed Aug 31 2016 Matthias Runge <mrunge@redhat.com > - 0.8.3-1
- update to 0.8.3

* Tue Jul 19 2016 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 0.7.16-2
- https://fedoraproject.org/wiki/Changes/Automatic_Provides_for_Python_RPM_Packages

* Tue Feb 23 2016 Matthias Runge <mrunge@redhat.com> - 0.7.16-1
- update to 0.7.16 (rhbz#1310274)

* Thu Feb 04 2016 Fedora Release Engineering <releng@fedoraproject.org> - 0.7.15-3
- Rebuilt for https://fedoraproject.org/wiki/Fedora_24_Mass_Rebuild

* Tue Nov 10 2015 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 0.7.15-2
- Rebuilt for https://fedoraproject.org/wiki/Changes/python3.5

* Thu Jun 18 2015 Björn Esser <bjoern.esser@gmail.com> - 0.7.15-1
- Update to 0.7.15 (#1219993)

* Tue Mar 31 2015 Björn Esser <bjoern.esser@gmail.com> - 0.7.13-1
- new upstream release v0.7.13 (#1207442)

* Fri Jan 16 2015 Björn Esser <bjoern.esser@gmail.com> - 0.7.10-3.git20150104.ab2dc2d
- updated to latest post-release-snapshot

* Fri Jan 16 2015 Björn Esser <bjoern.esser@gmail.com> - 0.7.10-2
- fix versioning in %%{_py3docdir}

* Thu Jan 15 2015 Björn Esser <bjoern.esser@gmail.com> - 0.7.10-1
- new upstream release 0.7.10
- added sphinx-documentation
- added Python3-build
- several improvements to spec-file

* Thu Jan 15 2015 Björn Esser <bjoern.esser@gmail.com> - 0.7.1-3
- initial import (#1182533)

* Mon May 26 2014 Matthias Runge <mrunge@redhat.com> - 0.7.1-2
- require python-django

* Tue May 20 2014 Matthias Runge <mrunge@redhat.com> - 0.7.1-1
- Initial package.