Blob Blame History Raw
%global srcname hgdistver

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


Name:           python-hgdistver
Version:        0.21
Release:        4%{?dist}
Summary:        A Python library to generate package version info from mercurial tags

License:        MIT
URL:            https://bitbucket.org/RonnyPfannschmidt/hgdistver/
Source0:        http://pypi.python.org/packages/source/h/%{srcname}/%{srcname}-%{version}.tar.gz
BuildArch:      noarch

BuildRequires:  python2-devel
BuildRequires:  python-setuptools

%if 0%{?with_python3}
BuildRequires:  python3-devel
BuildRequires:  python3-setuptools
%endif

%description
hgdistver is a simple drop-in to support setup.py in mercurial based projects.
It's supposed to generate version numbers from mercurial's meta-data. It tries
to use the current tag and falls back to the next reachable tagged ancestor
and using the distance to it as .post marker.


%if 0%{?with_python3}
%package -n python3-%{srcname}
Summary:        A Python library to generate package version info from mercurial tags

%description -n python3-%{srcname}
hgdistver is a simple drop-in to support setup.py in mercurial based projects.
It's supposed to generate version numbers from mercurial's meta-data. It tries
to use the current tag and falls back to the next reachable tagged ancestor
and using the distance to it as .post marker.
%endif

%prep
%setup -q -n %{srcname}-%{version}
rm -rf %{srcname}.egg-info
find -name '*.py' | xargs sed -i '1s|^#!python|#!%{__python2}|'
%if 0%{?with_python3}
rm -rf %{py3dir}
cp -a . %{py3dir}
find %{py3dir} -name '*.py' | xargs sed -i '1s|^#!python|#!%{__python3}|'
%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}
popd
%endif
%{__python2} setup.py install -O1 --skip-build --root=%{buildroot}

%files
%doc README.txt
%{python2_sitelib}/%{srcname}.*
%{python2_sitelib}/%{srcname}*.egg-info

%if 0%{?with_python3}
%files -n python3-%{srcname}
%doc README.txt
%{python3_sitelib}/%{srcname}.py
%{python3_sitelib}/%{srcname}*.egg-info
%{python3_sitelib}/__pycache__/%{srcname}*
%endif

%changelog
* Thu Jun 18 2015 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 0.21-4
- Rebuilt for https://fedoraproject.org/wiki/Fedora_23_Mass_Rebuild

* Tue Feb 17 2015 Ken Dreyer <ktdreyer@ktdreyer.com> - 0.21-3
- Activate python3 package

* Fri Oct 03 2014 Fabian Affolter <mail@fabian-affolter.ch> - 0.21-2
- Add python3 package

* Sun Sep 14 2014 Fabian Affolter <mail@fabian-affolter.ch> - 0.21-1
- Update URL
- Update to new upstream release 0.21

* Fri Sep 12 2014 Fabian Affolter <mail@fabian-affolter.ch> - 0.20-1
- Update to new upstream release 0.20

* Wed Sep 03 2014 Fabian Affolter <mail@fabian-affolter.ch> - 0.19-1
- Update to new upstream release 0.19

* Sat Jun 07 2014 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 0.16-5
- Rebuilt for https://fedoraproject.org/wiki/Fedora_21_Mass_Rebuild

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

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

* Thu Nov 01 2012 Fabian Affolter <mail@fabian-affolter.ch> - 0.16-2
- Bundled egg-info removed

* Sun Oct 21 2012 Fabian Affolter <mail@fabian-affolter.ch> - 0.16-1
- Update to new upstream release 0.16

* Fri Jun 08 2012 Fabian Affolter <mail@fabian-affolter.ch> - 0.15-1
- Initial package