python-pip/python-pip.spec
Jan Matejek 8e50cef319 Accepting request 460233 from devel:languages:python:singlespec
- update for singlespec
- fix alternative priorities
- drop cacert.pem and add pip-8.1.2-shipped-requests-cabundle.patch
  to ensure function without it
- add ca-certificates{,-mozilla} dependency to ensure existence of CA bundle
- add fdupes

OBS-URL: https://build.opensuse.org/request/show/460233
OBS-URL: https://build.opensuse.org/package/show/devel:languages:python/python-pip?expand=0&rev=46
2017-02-24 14:34:50 +00:00

120 lines
3.6 KiB
RPMSpec

#
# spec file for package python-pip
#
# Copyright (c) 2017 SUSE LINUX GmbH, Nuernberg, Germany.
#
# All modifications and additions to the file contributed by third parties
# remain the property of their copyright owners, unless otherwise agreed
# upon. The license for this file, and modifications and additions to the
# file, is the same license as for the pristine package itself (unless the
# license for the pristine package is not an Open Source License, in which
# case the license is the MIT License). An "Open Source License" is a
# license that conforms to the Open Source Definition (Version 1.9)
# published by the Open Source Initiative.
# Please submit bugfixes or comments via http://bugs.opensuse.org/
#
# NOTE(saschpe): git invocation and pythonpath issues with testrepository
# enable testing with a build conditional (off by default):
%bcond_with test
%{?!python_module:%define python_module() python-%{**} python3-%{**}}
Name: python-pip
Version: 9.0.1
Release: 0
Url: http://www.pip-installer.org
Summary: Pip installs packages. Python packages. An easy_install replacement
License: MIT
Group: Development/Languages/Python
Source: https://pypi.io/packages/source/p/pip/pip-%{version}.tar.gz
Patch0: pip-8.1.2-shipped-requests-cabundle.patch
BuildRoot: %{_tmppath}/%{name}-%{version}-build
BuildRequires: %{python_module devel}
BuildRequires: %{python_module setuptools}
BuildRequires: fdupes
BuildRequires: python-rpm-macros
%if %{with test}
# Test requirements:
BuildRequires: %{python_module mock}
BuildRequires: %{python_module pytest}
BuildRequires: %{python_module scripttest >= 1.3}
BuildRequires: %{python_module virtualenv >= 1.10}
%endif
Requires: ca-certificates
Requires: coreutils
Requires: python-setuptools
Requires: python-xml
Recommends: ca-certificates-mozilla
Requires(post): update-alternatives
Requires(postun): update-alternatives
BuildArch: noarch
%python_subpackages
%description
Pip is a replacement for easy_install. It uses mostly the same techniques for
finding packages, so packages that were made easy_installable should be
pip-installable as well.
%prep
%setup -q -n pip-%{version}
%patch0 -p1
find pip/_vendor -name *.py -exec \
sed -i "s|#!/usr/bin/env python||g" {} ";" # Fix non-executable script
#sed -i "s|#!/usr/bin/env python||g" pip/__init__.py # Fix non-executable script
rm pip/_vendor/requests/cacert.pem
%build
%python_build
%install
%python_install
%prepare_alternative pip
%fdupes %{buildroot}%{_prefix}
%if %{with test}
%check
%python_exec setup.py test
%endif
%pre
# Since /usr/bin/pip became ghosted to be used with update-alternatives, we have to get rid
# of the old binary resulting from the non-update-alternatives-ified package:
[ -h %{_bindir}/pip ] || rm -f %{_bindir}/pip
%post
# can't use `python_install_alternative` because it's pipX.Y, not pip-X.Y
PRIO=$(echo %{python_version} | tr -d .)
%ifpypy3
%install_alternative pip %{_bindir}/pip-%{pypy3_bin_suffix} $PRIO
%else
%install_alternative pip %{_bindir}/pip%{python_version} $PRIO
%endif
%preun
%ifpypy3
%uninstall_alternative pip %{_bindir}/pip-%{pypy3_bin_suffix}
%else
%uninstall_alternative pip %{_bindir}/pip%{python_version}
%endif
%files %{python_files}
%defattr(-,root,root,-)
%doc AUTHORS.txt CHANGES.txt LICENSE.txt README.rst
%{_bindir}/pip
%python2_only %{_bindir}/pip2
%python3_only %{_bindir}/pip3
%ifpypy3
%{_bindir}/pip-%{pypy3_bin_suffix}
%else
%{_bindir}/pip%{python_version}
%endif
%ghost %{_sysconfdir}/alternatives/pip
%{python_sitelib}/pip-%{version}-py%{python_version}.egg-info
%{python_sitelib}/pip
%changelog