Blob Blame History Raw
%global commit 8b280d44ef9e7c89f63e5bd7b77702159582177f
%global shortcommit %(c=%{commit}; echo ${c:0:7})
%global module_name wstool

%if 0%{?fedora} > 12
%global with_python3 1
%else
%{!?__python2: %global __python2 /usr/bin/python2}
%{!?python2_sitelib: %global python2_sitelib %(%{__python2} -c "from distutils.sysconfig import get_python_lib; print (get_python_lib())")}
%endif

Name:           python-%{module_name}
Version:        0.1.5
Release:        1%{?dist}
Summary:        Tool for managing a workspace of multiple heterogeneous SCM repositories

License:        BSD
URL:            http://www.ros.org/wiki/%{module_name}
Source0:        https://github.com/vcstools/%{module_name}/archive/%{commit}/%{module_name}-%{version}-%{shortcommit}.tar.gz
Patch0:         %{name}-0.1.5-cwd-independent-tests.patch

BuildArch:      noarch

BuildRequires:  bzr
BuildRequires:  git
BuildRequires:  mercurial
BuildRequires:  python-coverage
BuildRequires:  python-dateutil
BuildRequires:  python2-devel
BuildRequires:  python-mock
BuildRequires:  python-nose
BuildRequires:  python-rosinstall
BuildRequires:  python-setuptools
BuildRequires:  python-vcstools >= 0.1.34
BuildRequires:  PyYAML
BuildRequires:  subversion

Requires:       bzr
Requires:       git
Requires:       mercurial
Requires:       python-dateutil
Requires:       python-rosinstall
Requires:       python-vcstools >= 0.1.34
Requires:       PyYAML
Requires:       subversion

%description
wstool provides commands to manage several local SCM repositories (supports
git, mercurial, subversion, bazaar) based on a single workspace definition file
(.rosinstall).

wstool replaces the rosws tool for catkin workspaces. As catkin workspaces
create their own setup file and environment, wstool is reduced to version
control functions only. So wstool does not have a "regenerate" command, and
does not allow adding non-version controlled elements to workspaces. In all
other respects, it behaves the same as rosws.

%if 0%{?with_python3}
%package -n python3-%{module_name}
Summary:        Tool for managing a workspace of multiple heterogeneous SCM repositories

BuildRequires:  python3-coverage
BuildRequires:  python3-dateutil
BuildRequires:  python3-devel
BuildRequires:  python3-mock
BuildRequires:  python3-nose
BuildRequires:  python-rosinstall
BuildRequires:  python3-setuptools
BuildRequires:  python3-vcstools >= 0.1.34
BuildRequires:  python3-PyYAML

Requires:       bzr
Requires:       git
Requires:       mercurial
Requires:       python3-dateutil
Requires:       python-rosinstall
Requires:       python3-vcstools >= 0.1.34
Requires:       python3-PyYAML
Requires:       subversion

%description -n python3-%{module_name}
wstool provides commands to manage several local SCM repositories (supports
git, mercurial, subversion, bazaar) based on a single workspace definition file
(.rosinstall).

wstool replaces the rosws tool for catkin workspaces. As catkin workspaces
create their own setup file and environment, wstool is reduced to version
control functions only. So wstool does not have a "regenerate" command, and
does not allow adding non-version controlled elements to workspaces. In all
other respects, it behaves the same as rosws.
%endif # with_python3

%prep
%setup -qn %{module_name}-%{commit}
%patch0 -p1

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

%build
%{__python2} setup.py build

%if 0%{?with_python3}
pushd %{py3dir}
%{__python3} setup.py build
mv -v build/scripts-%{python3_version}/%{module_name} build/scripts-%{python3_version}/python3-%{module_name}
popd
%endif # with_python3

%install
%{__python2} setup.py install --skip-build --root %{buildroot}

%if 0%{?with_python3}
pushd %{py3dir}
%{__python3} setup.py install --skip-build --root %{buildroot}
popd
%endif # with_python3

%check
export BZR_EMAIL="Foo Bar <foo@example.com>"
export GIT_AUTHOR_EMAIL="foo@example.com"
export GIT_AUTHOR_NAME="Foo Bar"
export GIT_COMMITTER_EMAIL="foo@example.com"
export GIT_COMMITTER_NAME="Foo Bar"

nosetests --with-coverage --cover-package=%{module_name} -w test

%if 0%{?with_python3}
pushd %{py3dir}
nosetests-%{python3_version} --with-coverage --cover-package=%{module_name} -w test
popd
%endif # with_python3 

%files
%doc LICENSE README.rst doc/changelog.rst
%{_bindir}/%{module_name}
%{python_sitelib}/%{module_name}/
%{python_sitelib}/%{module_name}-%{version}-py?.?.egg-info/

%if 0%{?with_python3}
%files -n python3-%{module_name}
%doc LICENSE README.rst doc/changelog.rst
%{_bindir}/python3-%{module_name}
%{python3_sitelib}/%{module_name}/
%{python3_sitelib}/%{module_name}-%{version}-py?.?.egg-info/
%endif # with_python3

%changelog
* Sun Dec 14 2014 Scott K Logan <logans@cottsay.net> - 0.1.5-1
- Update to 0.1.5
- Update to python packaging guidelines
- Add check section

* Thu Jul 31 2014 Scott K Logan <logans@cottsay.net> - 0.1.4-1
- Update to 0.1.4

* Mon May 19 2014 Scott K Logan <logans@cottsay.net> - 0.1.3-1
- Update to 0.1.3
- Add depend on PyYAML

* Sun Jan 12 2014 Rich Mattes <richmattes@gmail.com> - 0.1.1-1
- Update to 0.1.1

* Mon Aug 26 2013 Ankur Sinha <ankursinha AT fedoraproject DOT org> 0.0.3-1
- Rename python3 bin script

* Sun Aug 25 2013 Ankur Sinha <ankursinha AT fedoraproject DOT org> 0.0.3-1
- Update source to github source
- Add py3 support

* Sat Mar 16 2013 Ankur Sinha <ankursinha AT fedoraproject DOT org> 0.0.3-1
- Initial rpmbuild