Blame python-vcstool.spec

9ded68
%{?!_without_python2:%global with_python2 0%{?_with_python2:1} || (0%{?fedora} < 30 && 0%{?rhel} < 8)}
9ded68
%{?!_without_python3:%global with_python3 0%{?_with_python3:1} || !0%{?rhel} || 0%{?rhel} >= 7}
9ded68
%{?!_without_python3_other:%global with_python3_other 0%{?_with_python3_other:1} || 0%{?rhel} == 7}
9ded68
9ded68
%global srcname vcstool
9ded68
9ded68
Name:           python-%{srcname}
9ded68
Version:        0.1.39
9ded68
Release:        1%{?dist}
9ded68
Summary:        Tool to invoke vcs commands on multiple repositories
9ded68
9ded68
License:        ASL 2.0
9ded68
URL:            https://github.com/dirk-thomas/%{srcname}
9ded68
Source0:        https://github.com/dirk-thomas/%{srcname}/archive/%{version}/%{srcname}-%{version}.tar.gz
9ded68
9ded68
# Used only for testing
9ded68
Source1:        %{name}-0.1.37-older_git_syntax.sed
9ded68
9ded68
# Merged upstream, removes argparse requirement for py2.7
9ded68
Patch0:         %{name}-0.1.39-argparse.patch
9ded68
9ded68
BuildArch:      noarch
9ded68
9ded68
%description
9ded68
Vcstool is a version control system (VCS) tool, designed to make working with
9ded68
multiple repositories easier.
9ded68
9ded68
Note: This tool should not be confused with vcstools (with a trailing s) which
9ded68
provides a Python API for interacting with different version control systems.
9ded68
The biggest differences between the two are:
9ded68
9ded68
- vcstool doesn't use any state beside the repository working copies available
9ded68
  in the filesystem.
9ded68
- The file format of vcstool export uses the relative paths of the repositories
9ded68
  as keys in YAML which avoids collisions by design.
9ded68
- vcstool has significantly less lines of code than vcstools including the
9ded68
  command line tools built on top.
9ded68
9ded68
9ded68
%if 0%{?with_python2}
9ded68
%package -n python2-%{srcname}
9ded68
Summary:        %{summary}
9ded68
%{?python_provide:%python_provide python2-%{srcname}}
9ded68
BuildRequires:  git
9ded68
BuildRequires:  python2-devel
9ded68
BuildRequires:  python2-pytest
9ded68
BuildRequires:  python2-pyyaml
9ded68
BuildRequires:  python2-setuptools
9ded68
9ded68
%if %{undefined python_disable_dependency_generator}
9ded68
Requires:       python2-pyyaml
9ded68
Requires:       python2-setuptools
9ded68
%endif # python_disable_dependency_generator
9ded68
9ded68
%if 0%{?fedora}
9ded68
Recommends:     git
9ded68
%endif # fedora
9ded68
9ded68
%description -n python2-%{srcname}
9ded68
Vcstool is a version control system (VCS) tool, designed to make working with
9ded68
multiple repositories easier.
9ded68
9ded68
Note: This tool should not be confused with vcstools (with a trailing s) which
9ded68
provides a Python API for interacting with different version control systems.
9ded68
The biggest differences between the two are:
9ded68
9ded68
- vcstool doesn't use any state beside the repository working copies available
9ded68
  in the filesystem.
9ded68
- The file format of vcstool export uses the relative paths of the repositories
9ded68
  as keys in YAML which avoids collisions by design.
9ded68
- vcstool has significantly less lines of code than vcstools including the
9ded68
  command line tools built on top.
9ded68
%endif # with_python2
9ded68
9ded68
9ded68
%if 0%{?with_python3}
9ded68
%package -n python%{python3_pkgversion}-%{srcname}
9ded68
Summary:        %{summary}
9ded68
%{?python_provide:%python_provide python%{python3_pkgversion}-%{srcname}}
9ded68
BuildRequires:  git
9ded68
BuildRequires:  python%{python3_pkgversion}-devel
9ded68
BuildRequires:  python%{python3_pkgversion}-pytest
9ded68
BuildRequires:  python%{python3_pkgversion}-PyYAML
9ded68
BuildRequires:  python%{python3_pkgversion}-setuptools
9ded68
9ded68
%if %{undefined python_disable_dependency_generator}
9ded68
Requires:       python%{python3_pkgversion}-PyYAML
9ded68
Requires:       python%{python3_pkgversion}-setuptools
9ded68
%endif # python_disable_dependency_generator
9ded68
9ded68
%if 0%{?fedora}
9ded68
Recommends:     git
9ded68
%endif # fedora
9ded68
9ded68
%description -n python%{python3_pkgversion}-%{srcname}
9ded68
Vcstool is a version control system (VCS) tool, designed to make working with
9ded68
multiple repositories easier.
9ded68
9ded68
Note: This tool should not be confused with vcstools (with a trailing s) which
9ded68
provides a Python API for interacting with different version control systems.
9ded68
The biggest differences between the two are:
9ded68
9ded68
- vcstool doesn't use any state beside the repository working copies available
9ded68
  in the filesystem.
9ded68
- The file format of vcstool export uses the relative paths of the repositories
9ded68
  as keys in YAML which avoids collisions by design.
9ded68
- vcstool has significantly less lines of code than vcstools including the
9ded68
  command line tools built on top.
9ded68
%endif # with_python3
9ded68
9ded68
9ded68
%if 0%{?with_python3_other}
9ded68
%package -n python%{python3_other_pkgversion}-%{srcname}
9ded68
Summary:        %{summary}
9ded68
%{?python_provide:%python_provide python%{python3_other_pkgversion}-%{srcname}}
9ded68
BuildRequires:  git
9ded68
BuildRequires:  python%{python3_other_pkgversion}-devel
9ded68
BuildRequires:  python%{python3_other_pkgversion}-pytest
9ded68
BuildRequires:  python%{python3_other_pkgversion}-PyYAML
9ded68
BuildRequires:  python%{python3_other_pkgversion}-setuptools
9ded68
9ded68
%if %{undefined python_disable_dependency_generator}
9ded68
Requires:       python%{python3_other_pkgversion}-PyYAML
9ded68
Requires:       python%{python3_other_pkgversion}-setuptools
9ded68
%endif # python_disable_dependency_generator
9ded68
9ded68
%if 0%{?fedora}
9ded68
Recommends:     git
9ded68
%endif # fedora
9ded68
9ded68
%description -n python%{python3_other_pkgversion}-%{srcname}
9ded68
Vcstool is a version control system (VCS) tool, designed to make working with
9ded68
multiple repositories easier.
9ded68
9ded68
Note: This tool should not be confused with vcstools (with a trailing s) which
9ded68
provides a Python API for interacting with different version control systems.
9ded68
The biggest differences between the two are:
9ded68
9ded68
- vcstool doesn't use any state beside the repository working copies available
9ded68
  in the filesystem.
9ded68
- The file format of vcstool export uses the relative paths of the repositories
9ded68
  as keys in YAML which avoids collisions by design. 
9ded68
- vcstool has significantly less lines of code than vcstools including the
9ded68
  command line tools built on top.
9ded68
%endif # with_python3_other
9ded68
9ded68
9ded68
%prep
9ded68
%autosetup -p1 -n %{srcname}-%{version}
9ded68
9ded68
%if 0%{?rhel} && 0%{?rhel} < 8
9ded68
# Test case touch-ups for older git versions
9ded68
sed -i -f %{SOURCE1} test/*.txt
9ded68
%endif
9ded68
9ded68
9ded68
%build
9ded68
%if 0%{?with_python2}
9ded68
%py2_build
9ded68
%endif # with_python2
9ded68
9ded68
%if 0%{?with_python3}
9ded68
%py3_build
9ded68
%endif # with_python3
9ded68
9ded68
%if 0%{?with_python3_other}
9ded68
%py3_other_build
9ded68
%endif # with_python3_other
9ded68
9ded68
9ded68
%install
9ded68
# There are three extra things we're doing here:
9ded68
# 1. Making each executable available with a -X and -X.Y suffix
9ded68
# 2. Giving each python version a directory of executables for %%check
9ded68
# 3. Integrating with the bash-completion package
9ded68
9ded68
install -d %{buildroot}%{_datadir}/bash-completion/completions %{buildroot}%{_bindir}
9ded68
9ded68
%if 0%{?with_python2}
9ded68
%py2_install -- --install-scripts %{_bindir}2
9ded68
9ded68
echo -n "" > py2_bins
9ded68
for f in `ls %{buildroot}%{_bindir}2`; do
9ded68
  mv %{buildroot}%{_bindir}2/$f %{buildroot}%{_bindir}/$f-%{python2_version}
9ded68
  ln -s $f-%{python2_version} %{buildroot}%{_bindir}/$f-2
9ded68
%if !(0%{?with_python3})
9ded68
  ln -s $f-%{python2_version} %{buildroot}%{_bindir}/$f
9ded68
  echo "%{_bindir}/$f" >> py2_bins
9ded68
%endif # with_python3
9ded68
  echo -e "%{_bindir}/$f-2\n%{_bindir}/$f-%{python2_version}" >> py2_bins
9ded68
done
9ded68
9ded68
# Integrate bash completion with the bash-completion package
9ded68
cp -f %{buildroot}%{_datadir}/%{srcname}-completion/vcs.bash %{buildroot}%{_datadir}/bash-completion/completions/vcs
9ded68
ln -sf vcs %{buildroot}%{_datadir}/bash-completion/completions/vcs-2
9ded68
ln -s vcs %{buildroot}%{_datadir}/bash-completion/completions/vcs-%{python2_version}
9ded68
%endif # with_python2
9ded68
9ded68
%if 0%{?with_python3}
9ded68
%py3_install -- --install-scripts %{_bindir}%{python3_pkgversion}
9ded68
9ded68
echo -n "" > py3_bins
9ded68
for f in `ls %{buildroot}%{_bindir}%{python3_pkgversion}`; do
9ded68
  mv %{buildroot}%{_bindir}%{python3_pkgversion}/$f %{buildroot}%{_bindir}/$f-%{python3_version}
9ded68
  ln -s $f-%{python3_version} %{buildroot}%{_bindir}/$f-3
9ded68
  ln -s $f-%{python3_version} %{buildroot}%{_bindir}/$f
9ded68
  echo -e "%{_bindir}/$f\n%{_bindir}/$f-3\n%{_bindir}/$f-%{python3_version}" >> py3_bins
9ded68
done
9ded68
9ded68
# Integrate bash completion with the bash-completion package
9ded68
cp -f %{buildroot}%{_datadir}/%{srcname}-completion/vcs.bash %{buildroot}%{_datadir}/bash-completion/completions/vcs
9ded68
ln -sf vcs %{buildroot}%{_datadir}/bash-completion/completions/vcs-3
9ded68
ln -s vcs %{buildroot}%{_datadir}/bash-completion/completions/vcs-%{python3_version}
9ded68
%endif # with_python3
9ded68
9ded68
%if 0%{?with_python3_other}
9ded68
%py3_other_install -- --install-scripts %{_bindir}%{python3_other_pkgversion}
9ded68
9ded68
echo -n "" > py3_other_bins
9ded68
for f in `ls %{buildroot}%{_bindir}%{python3_other_pkgversion}`; do
9ded68
  mv %{buildroot}%{_bindir}%{python3_other_pkgversion}/$f %{buildroot}%{_bindir}/$f-%{python3_other_version}
9ded68
%if !(0%{?with_python3})
9ded68
  ln -s $f-%{python3_other_version} %{buildroot}%{_bindir}/$f-3
9ded68
  echo "%{_bindir}/$f-3" >> py3_other_bins
9ded68
%if !(0%{?with_python2})
9ded68
  ln -s $f-%{python3_other_version} %{buildroot}%{_bindir}/$f
9ded68
  echo "%{_bindir}/$f" >> py3_other_bins
9ded68
%endif # with_python2
9ded68
%endif # with_python3
9ded68
  echo "%{_bindir}/$f-%{python3_other_version}" >> py3_other_bins
9ded68
done
9ded68
9ded68
# Integrate bash completion with the bash-completion package
9ded68
cp -f %{buildroot}%{_datadir}/%{srcname}-completion/vcs.bash %{buildroot}%{_datadir}/bash-completion/completions/vcs
9ded68
ln -sf vcs %{buildroot}%{_datadir}/bash-completion/completions/vcs-3
9ded68
ln -s vcs %{buildroot}%{_datadir}/bash-completion/completions/vcs-%{python3_other_version}
9ded68
%endif # with_python3_other
9ded68
9ded68
9ded68
%check
9ded68
# We skip two classes of test:
9ded68
# 1. Code style
9ded68
# 2. Tests which require network access
9ded68
%define pytest_options \\\
9ded68
  --ignore=test/test_flake8.py \\\
9ded68
  --ignore test/test_commands.py \\\
9ded68
  test
9ded68
9ded68
%if 0%{?with_python2}
9ded68
%{__python2} -m pytest %pytest_options
9ded68
%endif # with_python2
9ded68
9ded68
%if 0%{?with_python3}
9ded68
%{__python3} -m pytest %pytest_options
9ded68
%endif # with_python3
9ded68
9ded68
%if 0%{?with_python3_other}
9ded68
%{__python3_other} -m pytest %pytest_options
9ded68
%endif # with_python3_other
9ded68
9ded68
9ded68
%if 0%{?with_python2}
9ded68
%files -n python2-%{srcname} -f py2_bins
9ded68
%license LICENSE
9ded68
%doc CONTRIBUTING.md README.rst
9ded68
%{python2_sitelib}/%{srcname}/
9ded68
%{python2_sitelib}/%{srcname}-%{version}-py%{python2_version}.egg-info/
9ded68
%{_datadir}/%{srcname}-completion
9ded68
%{_datadir}/bash-completion/completions/vcs
9ded68
%{_datadir}/bash-completion/completions/vcs-2
9ded68
%{_datadir}/bash-completion/completions/vcs-%{python2_version}
9ded68
%endif # with_python2
9ded68
9ded68
9ded68
%if 0%{?with_python3}
9ded68
%files -n python%{python3_pkgversion}-%{srcname} -f py3_bins
9ded68
%license LICENSE
9ded68
%doc CONTRIBUTING.md README.rst
9ded68
%{python3_sitelib}/%{srcname}/
9ded68
%{python3_sitelib}/%{srcname}-%{version}-py%{python3_version}.egg-info/
9ded68
%{_datadir}/%{srcname}-completion
9ded68
%{_datadir}/bash-completion/completions/vcs
9ded68
%{_datadir}/bash-completion/completions/vcs-3
9ded68
%{_datadir}/bash-completion/completions/vcs-%{python3_version}
9ded68
%endif # with_python3
9ded68
9ded68
9ded68
%if 0%{?with_python3_other}
9ded68
%files -n python%{python3_other_pkgversion}-%{srcname} -f py3_other_bins
9ded68
%license LICENSE
9ded68
%doc CONTRIBUTING.md README.rst
9ded68
%{python3_other_sitelib}/%{srcname}/
9ded68
%{python3_other_sitelib}/%{srcname}-%{version}-py%{python3_other_version}.egg-info/
9ded68
%{_datadir}/%{srcname}-completion
9ded68
%{_datadir}/bash-completion/completions/vcs
9ded68
%{_datadir}/bash-completion/completions/vcs-3
9ded68
%{_datadir}/bash-completion/completions/vcs-%{python3_other_version}
9ded68
%endif # with_python3_other
9ded68
9ded68
9ded68
%changelog
9ded68
* Tue Feb 19 2019 Scott K Logan <logans@cottsay.net> - 0.1.39-1
9ded68
- Update to 0.1.39
9ded68
9ded68
* Thu Jan 17 2019 Scott K Logan <logans@cottsay.net> - 0.1.38-1
9ded68
- Update to 0.1.38
9ded68
9ded68
* Tue Oct 16 2018 Scott K Logan <logans@cottsay.net> - 0.1.37-1
9ded68
- Initial package