Blob Blame History Raw
Name:           python-hgapi
Version:        1.7.2
Release:        7%{?dist}
Summary:        Python API to Mercurial using the command-line interface

License:        MIT
URL:            https://bitbucket.org/haard/hgapi
Source0:        https://pypi.python.org/packages/source/h/hgapi/hgapi-%{version}.tar.gz
Source1:        LICENSE
# A path defined in the test suite supposes that the tests are launched with an hgapi folder.
# Also remove two tests that don't pass in mock.
Patch0:         %{name}-%{version}-test_suite.patch

BuildArch:      noarch
BuildRequires:  python2-devel python-setuptools mercurial
Requires:       mercurial

%description
hgapi is a pure-Python API to Mercurial, that uses the command-line interface
instead of the internal Mercurial API. The rationale for this is twofold: the
internal API is unstable, and it is GPL.

hgapi works for all versions of Mercurial, and will instantly reflect any
changes to the repository (including hgrc).

%package -n     python3-hgapi
Summary:        Python 3 API to Mercurial using the command-line interface
BuildRequires:  python3-devel python3-setuptools
Requires:       mercurial

%description -n python3-hgapi
hgapi is a pure-Python API to Mercurial, that uses the command-line interface
instead of the internal Mercurial API. The rationale for this is twofold: the
internal API is unstable, and it is GPL.

hgapi works for all versions of Mercurial, and will instantly reflect any
changes to the repository (including hgrc).

%prep
%setup -q -n hgapi-%{version}
cp %{SOURCE1} .
# Remove egg
rm -r hgapi.egg-info
# Apply patch
sed -i 's/\r$//' hgapi/testhgapi.py
%patch0
# Correct end of line encoding for README.rst
sed -i 's/\r$//' README.rst
#  Remove empty file
rm hgapi/jython_in_practice.py

rm -rf %{py3dir}
cp -a . %{py3dir}

%build
pushd %{py3dir}
%{__python3} setup.py build
popd

%{__python2} setup.py build


%install
pushd %{py3dir}
%{__python3} setup.py install -O1 --skip-build --root $RPM_BUILD_ROOT
popd

%{__python2} setup.py install -O1 --skip-build --root $RPM_BUILD_ROOT


%check
pushd %{py3dir}
pwd
%{__python3} setup.py test
popd

%{__python2} setup.py test


%files
%doc README.rst LICENSE
%{python2_sitelib}/hgapi-%{version}-py%{python2_version}.egg-info
%{python2_sitelib}/hgapi/

%files -n python3-hgapi
%doc README.rst LICENSE
%{python3_sitelib}/hgapi-%{version}-py%{python3_version}.egg-info
%{python3_sitelib}/hgapi/

%changelog
* Sat Feb 11 2017 Fedora Release Engineering <releng@fedoraproject.org> - 1.7.2-7
- Rebuilt for https://fedoraproject.org/wiki/Fedora_26_Mass_Rebuild

* Mon Dec 19 2016 Miro HronĨok <mhroncok@redhat.com> - 1.7.2-6
- Rebuild for Python 3.6

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

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

* Thu Nov 5 2015 Julien Enselme <jujens@jujens.eu> - 1.7.2-3
- Rebuilt for python 3.5

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

* Thu Aug 14 2014 Julien Enselme <jujens@jujens.eu> - 1.7.2-1
- Update to 1.7.2

* Thu Aug 14 2014 Julien Enselme <jujens@jujens.eu> - 1.7.1-3
- Remove egg-info from upstream.

* Thu Aug 14 2014 Julien Enselme <jujens@jujens.eu> - 1.7.1-2
- Add mercurial as a BuildRequires in order for the tests to succeed.

* Sun Aug 03 2014 Julien Enselme <jujens@jujens.eu> - 1.7.1-1
- Initial packaging