d42df6d
%if (! 0%{?rhel}) || 0%{?rhel} > 7
aded0dc
%global with_python3 1
Matej Stuchlik 3e34703
%global build_wheel 1
Matej Stuchlik f50907e
%global with_tests 0
aded0dc
%endif
aded0dc
%if 0%{?rhel} && 0%{?rhel} < 6
aded0dc
%{!?python_sitelib: %global python_sitelib %(%{__python} -c "from distutils.sysconfig import get_python_lib; print(get_python_lib())")}
aded0dc
%endif
Peter Halliday fc2018e
Peter Halliday fc2018e
%global srcname pip
Matej Stuchlik dd9e7dc
%if 0%{?build_wheel}
Matej Stuchlik dd9e7dc
%global python2_wheelname %{srcname}-%{version}-py2.py3-none-any.whl
Matej Stuchlik dd9e7dc
%if 0%{?with_python3}
Matej Stuchlik dd9e7dc
%global python3_wheelname %python2_wheelname
Matej Stuchlik dd9e7dc
%endif
Matej Stuchlik dd9e7dc
%endif
Peter Halliday fc2018e
25a2de7
%global bashcompdir %(b=$(pkg-config --variable=completionsdir bash-completion 2>/dev/null); echo ${b:-%{_sysconfdir}/bash_completion.d})
25a2de7
%if "%{bashcompdir}" != "%{_sysconfdir}/bash_completion.d"
25a2de7
%global bashcomp2 1
25a2de7
%endif
25a2de7
Peter Halliday fc2018e
Name:           python-%{srcname}
b664d72
Version:        7.1.0
b664d72
Release:        1%{?dist}
f5a26f9
Summary:        A tool for installing and managing Python packages
Peter Halliday fc2018e
Peter Halliday fc2018e
Group:          Development/Libraries
Peter Halliday fc2018e
License:        MIT
74924e0
URL:            http://www.pip-installer.org
Peter Halliday fc2018e
Source0:        http://pypi.python.org/packages/source/p/pip/%{srcname}-%{version}.tar.gz
Matej Stuchlik a7c7b12
Matej Stuchlik 9297164
# to get tests:
Matej Stuchlik 9297164
# git clone https://github.com/pypa/pip && cd fig
Matej Stuchlik 9297164
# git checkout 1.5.6 && tar -czvf pip-1.5.6-tests.tar.gz tests/
Matej Stuchlik f50907e
%if 0%{?with_tests}
Matej Stuchlik f50907e
Source1:        pip-6.0.8-tests.tar.gz
Matej Stuchlik f50907e
%endif
Matej Stuchlik 9297164
Matej Stuchlik 9297164
Patch0:         pip-1.5rc1-allow-stripping-prefix-from-wheel-RECORD-files.patch
Matej Stuchlik a7c7b12
Peter Halliday fc2018e
BuildRoot:      %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)
Peter Halliday fc2018e
Peter Halliday fc2018e
BuildArch:      noarch
Peter Halliday fc2018e
BuildRequires:  python-devel
aded0dc
BuildRequires:  python-setuptools
4669cc9
%if 0%{?with_tests}
Matej Stuchlik 9297164
BuildRequires:  python-mock
Matej Stuchlik 9297164
BuildRequires:  pytest
Matej Stuchlik f50907e
BuildRequires:  python-pretend
Matej Stuchlik f50907e
BuildRequires:  python-freezegun
Matej Stuchlik 9297164
BuildRequires:  python-scripttest
Matej Stuchlik 9297164
BuildRequires:  python-virtualenv
4669cc9
%endif
Matej Stuchlik dd9e7dc
%if 0%{?build_wheel}
Matej Stuchlik dd9e7dc
BuildRequires:  python-pip
Matej Stuchlik dd9e7dc
BuildRequires:  python-wheel
Matej Stuchlik dd9e7dc
%endif
Peter Halliday 36e99b1
Requires:       python-setuptools
Peter Halliday fc2018e
Peter Halliday fc2018e
%description
Peter Halliday fc2018e
Pip is a replacement for `easy_install
Peter Halliday fc2018e
<http://peak.telecommunity.com/DevCenter/EasyInstall>`_.  It uses mostly the
Peter Halliday fc2018e
same techniques for finding packages, so packages that were made
Peter Halliday fc2018e
easy_installable should be pip-installable as well.
Peter Halliday fc2018e
aded0dc
aded0dc
%if 0%{?with_python3}
aded0dc
%package -n python3-pip
f5a26f9
Summary:        A tool for installing and managing Python3 packages
aded0dc
Group:          Development/Libraries
aded0dc
aded0dc
BuildRequires:  python3-devel
aded0dc
BuildRequires:  python3-setuptools
25a2de7
BuildRequires:  bash-completion
Matej Stuchlik f50907e
%if 0%{?with_tests}
Matej Stuchlik f50907e
BuildRequires:  python3-mock
Matej Stuchlik f50907e
BuildRequires:  python3-pytest
Matej Stuchlik f50907e
BuildRequires:  python3-pretend
Matej Stuchlik f50907e
BuildRequires:  python3-freezegun
Matej Stuchlik f50907e
BuildRequires:  python3-scripttest
Matej Stuchlik f50907e
BuildRequires:  python3-virtualenv
Matej Stuchlik f50907e
%endif
Matej Stuchlik dd9e7dc
%if 0%{?build_wheel}
Matej Stuchlik dd9e7dc
BuildRequires:  python3-pip
Matej Stuchlik dd9e7dc
BuildRequires:  python3-wheel
Matej Stuchlik dd9e7dc
%endif
aded0dc
Requires:  python3-setuptools
aded0dc
aded0dc
%description -n python3-pip
aded0dc
Pip is a replacement for `easy_install
aded0dc
<http://peak.telecommunity.com/DevCenter/EasyInstall>`_.  It uses mostly the
aded0dc
same techniques for finding packages, so packages that were made
aded0dc
easy_installable should be pip-installable as well.
aded0dc
%endif # with_python3
Peter Halliday fc2018e
Peter Halliday fc2018e
%prep
Peter Halliday fc2018e
%setup -q -n %{srcname}-%{version}
Matej Stuchlik f50907e
%if 0%{?with_tests}
Matej Stuchlik 9297164
tar -xf %{SOURCE1}
Matej Stuchlik f50907e
%endif
08349fb
08349fb
%patch0 -p1
08349fb
Peter Halliday 36e99b1
%{__sed} -i '1d' pip/__init__.py
Peter Halliday fc2018e
aded0dc
%if 0%{?with_python3}
aded0dc
cp -a . %{py3dir}
aded0dc
%endif # with_python3
aded0dc
f5a26f9
Peter Halliday fc2018e
%build
Matej Stuchlik dd9e7dc
%if 0%{?build_wheel}
Matej Stuchlik dd9e7dc
%{__python} setup.py bdist_wheel
Matej Stuchlik dd9e7dc
%else
Peter Halliday fc2018e
%{__python} setup.py build
Matej Stuchlik dd9e7dc
%endif
Peter Halliday fc2018e
aded0dc
%if 0%{?with_python3}
aded0dc
pushd %{py3dir}
Matej Stuchlik dd9e7dc
%if 0%{?build_wheel}
Matej Stuchlik dd9e7dc
%{__python3} setup.py bdist_wheel
Matej Stuchlik dd9e7dc
%else
aded0dc
%{__python3} setup.py build
Matej Stuchlik dd9e7dc
%endif
aded0dc
popd
aded0dc
%endif # with_python3
aded0dc
f5a26f9
Peter Halliday fc2018e
%install
Peter Halliday fc2018e
%{__rm} -rf %{buildroot}
aded0dc
aded0dc
%if 0%{?with_python3}
aded0dc
pushd %{py3dir}
Matej Stuchlik dd9e7dc
%if 0%{?build_wheel}
Matej Stuchlik dd9e7dc
pip3 install -I dist/%{python3_wheelname} --root %{buildroot} --strip-file-prefix %{buildroot}
Matej Stuchlik dd9e7dc
# TODO: we have to remove this by hand now, but it'd be nice if we wouldn't have to
Matej Stuchlik dd9e7dc
# (pip install wheel doesn't overwrite)
Matej Stuchlik dd9e7dc
rm %{buildroot}%{_bindir}/pip
Matej Stuchlik dd9e7dc
%else
08349fb
%{__python3} setup.py install --skip-build --root %{buildroot}
Matej Stuchlik dd9e7dc
%endif
aded0dc
%endif # with_python3
aded0dc
Matej Stuchlik dd9e7dc
%if 0%{?build_wheel}
Matej Stuchlik dd9e7dc
pip2 install -I dist/%{python2_wheelname} --root %{buildroot} --strip-file-prefix %{buildroot}
Matej Stuchlik dd9e7dc
%else
Peter Halliday fc2018e
%{__python} setup.py install -O1 --skip-build --root %{buildroot}
Matej Stuchlik dd9e7dc
%endif
aded0dc
25a2de7
mkdir -p %{buildroot}%{bashcompdir}
25a2de7
PYTHONPATH=%{buildroot}%{python_sitelib} \
25a2de7
    %{buildroot}%{_bindir}/pip completion --bash \
25a2de7
    > %{buildroot}%{bashcompdir}/pip
25a2de7
%if 0%{?with_python3}
25a2de7
PYTHONPATH=%{buildroot}%{python3_sitelib} \
25a2de7
    %{buildroot}%{_bindir}/pip3 completion --bash \
25a2de7
    > %{buildroot}%{bashcompdir}/pip3
25a2de7
%endif
25a2de7
pips2=pip
25a2de7
pips3=pip3
25a2de7
for pip in %{buildroot}%{_bindir}/pip*; do
25a2de7
    pip=$(basename $pip)
25a2de7
    case $pip in
25a2de7
        pip2*)
25a2de7
            pips2="$pips2 $pip"
25a2de7
%if 0%{?bashcomp2}
25a2de7
            ln -s pip %{buildroot}%{bashcompdir}/$pip
25a2de7
%endif
25a2de7
            ;;
25a2de7
%if 0%{?with_python3}
25a2de7
        pip3?*)
25a2de7
            pips3="$pips3 $pip"
25a2de7
%if 0%{?bashcomp2}
25a2de7
            ln -s pip3 %{buildroot}%{bashcompdir}/$pip
25a2de7
%endif
25a2de7
            ;;
25a2de7
%endif
25a2de7
    esac
25a2de7
done
25a2de7
%if 0%{?with_python3}
25a2de7
sed -i -e "s/^\\(complete.*\\) pip\$/\\1 $pips3/" \
25a2de7
    -e s/_pip_completion/_pip3_completion/ \
25a2de7
    %{buildroot}%{bashcompdir}/pip3
25a2de7
%endif
25a2de7
sed -i -e "s/^\\(complete.*\\) pip\$/\\1 $pips2/" \
25a2de7
    %{buildroot}%{bashcompdir}/pip
25a2de7
4669cc9
%if 0%{?with_tests}
Matej Stuchlik 9297164
%check
Matej Stuchlik f50907e
py.test -m 'not network'
Matej Stuchlik f50907e
pushd %{py3dir}
Matej Stuchlik f50907e
py.test-3.4 -m 'not network'
Matej Stuchlik f50907e
popd
4669cc9
%endif
Peter Halliday fc2018e
aded0dc
Peter Halliday fc2018e
%clean
Peter Halliday fc2018e
%{__rm} -rf %{buildroot}
Peter Halliday fc2018e
aded0dc
# unfortunately, pip's test suite requires virtualenv >= 1.6 which isn't in
aded0dc
# fedora yet. Once it is, check can be implemented
aded0dc
Peter Halliday fc2018e
%files
aded0dc
%defattr(-,root,root,-)
25a2de7
%{!?_licensedir:%global license %%doc}
25a2de7
%license LICENSE.txt
25a2de7
%doc README.rst docs
f5a26f9
%attr(755,root,root) %{_bindir}/pip
Matej Stuchlik dd9e7dc
%attr(755,root,root) %{_bindir}/pip2*
Peter Halliday fc2018e
%{python_sitelib}/pip*
25a2de7
%{bashcompdir}
25a2de7
%if 0%{?with_python3}
25a2de7
%exclude %{bashcompdir}/pip3*
25a2de7
%endif
25a2de7
%if 0%{?bashcomp2}
25a2de7
%dir %(dirname %{bashcompdir})
25a2de7
%endif
Peter Halliday fc2018e
aded0dc
%if 0%{?with_python3}
aded0dc
%files -n python3-pip
aded0dc
%defattr(-,root,root,-)
25a2de7
%license LICENSE.txt
25a2de7
%doc README.rst docs
Matej Stuchlik dd9e7dc
%attr(755,root,root) %{_bindir}/pip3*
aded0dc
%{python3_sitelib}/pip*
25a2de7
%dir %{bashcompdir}
25a2de7
%{bashcompdir}/pip3*
25a2de7
%if 0%{?bashcomp2}
25a2de7
%dir %(dirname %{bashcompdir})
25a2de7
%endif
aded0dc
%endif # with_python3
aded0dc
Peter Halliday fc2018e
%changelog
b664d72
* Wed Jul 01 2015 Slavek Kabrda <bkabrda@redhat.com> - 7.1.0-1
b664d72
- Update to 7.1.0
b664d72
25a2de7
* Tue Jun 30 2015 Ville Skyttä <ville.skytta@iki.fi> - 7.0.3-3
25a2de7
- Install bash completion
25a2de7
- Ship LICENSE.txt as %%license where available
25a2de7
fdbeb48
* Thu Jun 18 2015 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 7.0.3-2
fdbeb48
- Rebuilt for https://fedoraproject.org/wiki/Fedora_23_Mass_Rebuild
fdbeb48
Matej Stuchlik 319306c
* Thu Jun 04 2015 Matej Stuchlik <mstuchli@redhat.com> - 7.0.3-1
Matej Stuchlik 319306c
- Update to 7.0.3
Matej Stuchlik 319306c
Matej Stuchlik f50907e
* Fri Mar 06 2015 Matej Stuchlik <mstuchli@redhat.com> - 6.0.8-1
Matej Stuchlik f50907e
- Update to 6.0.8
Matej Stuchlik f50907e
4669cc9
* Thu Dec 18 2014 Slavek Kabrda <bkabrda@redhat.com> - 1.5.6-5
4669cc9
- Only enable tests on Fedora.
4669cc9
Matej Stuchlik 9297164
* Mon Dec 01 2014 Matej Stuchlik <mstuchli@redhat.com> - 1.5.6-4
Matej Stuchlik 9297164
- Add tests
Matej Stuchlik 9297164
- Add patch skipping tests requiring Internet access
Matej Stuchlik 9297164
Matej Stuchlik a7c7b12
* Tue Nov 18 2014 Matej Stuchlik <mstuchli@redhat.com> - 1.5.6-3
Matej Stuchlik a7c7b12
- Added patch for local dos with predictable temp dictionary names
Matej Stuchlik a7c7b12
  (http://seclists.org/oss-sec/2014/q4/655)
Matej Stuchlik a7c7b12
e24e478
* Sat Jun 07 2014 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 1.5.6-2
e24e478
- Rebuilt for https://fedoraproject.org/wiki/Fedora_21_Mass_Rebuild
e24e478
Matej Stuchlik 56b65b2
* Sun May 25 2014 Matej Stuchlik <mstuchli@redhat.com> - 1.5.6-1
Matej Stuchlik 56b65b2
- Update to 1.5.6
Matej Stuchlik 56b65b2
Matej Stuchlik 3e34703
* Fri Apr 25 2014 Matej Stuchlik <mstuchli@redhat.com> - 1.5.4-4
Matej Stuchlik 3e34703
- Rebuild as wheel for Python 3.4
Matej Stuchlik 3e34703
Matej Stuchlik 5d7f894
* Thu Apr 24 2014 Matej Stuchlik <mstuchli@redhat.com> - 1.5.4-3
Matej Stuchlik 5d7f894
- Disable build_wheel
Matej Stuchlik 5d7f894
Matej Stuchlik a48e4cb
* Thu Apr 24 2014 Matej Stuchlik <mstuchli@redhat.com> - 1.5.4-2
Matej Stuchlik a48e4cb
- Rebuild as wheel for Python 3.4
Matej Stuchlik a48e4cb
Matej Stuchlik dd9e7dc
* Mon Apr 07 2014 Matej Stuchlik <mstuchli@redhat.com> - 1.5.4-1
Matej Stuchlik dd9e7dc
- Updated to 1.5.4
Matej Stuchlik dd9e7dc
42d5421
* Mon Oct 14 2013 Tim Flink <tflink@fedoraproject.org> - 1.4.1-1
42d5421
- Removed patch for CVE 2013-2099 as it has been included in the upstream 1.4.1 release
42d5421
- Updated version to 1.4.1
42d5421
6064dd1
* Sun Aug 04 2013 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 1.3.1-5
6064dd1
- Rebuilt for https://fedoraproject.org/wiki/Fedora_20_Mass_Rebuild
6064dd1
08349fb
* Tue Jul 16 2013 Toshio Kuratomi <toshio@fedoraproject.org> - 1.3.1-4
08349fb
- Fix for CVE 2013-2099
08349fb
f5a26f9
* Thu May 23 2013 Tim Flink <tflink@fedoraproject.org> - 1.3.1-3
f5a26f9
- undo python2 executable rename to python-pip. fixes #958377
f5a26f9
- fix summary to match upstream
f5a26f9
Kevin Kofler 9a8af72
* Mon May 06 2013 Kevin Kofler <Kevin@tigcc.ticalc.org> - 1.3.1-2
Kevin Kofler 9a8af72
- Fix main package Summary, it's for Python 2, not 3 (#877401)
Kevin Kofler 9a8af72
53e39cd
* Fri Apr 26 2013 Jon Ciesla <limburgher@gmail.com> - 1.3.1-1
53e39cd
- Update to 1.3.1, fix for CVE-2013-1888.
53e39cd
2052a45
* Thu Feb 14 2013 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 1.2.1-3
2052a45
- Rebuilt for https://fedoraproject.org/wiki/Fedora_19_Mass_Rebuild
2052a45
3a2d5ed
* Tue Oct 09 2012 Tim Flink <tflink@fedoraproject.org> - 1.2.1-2
3a2d5ed
- Fixing files for python3-pip
3a2d5ed
a74e1e0
* Thu Oct 04 2012 Tim Flink <tflink@fedoraproject.org> - 1.2.1-1
a74e1e0
- Update to upstream 1.2.1
a74e1e0
- Change binary from pip-python to python-pip (RHBZ#855495)
a74e1e0
- Add alias from python-pip to pip-python, to be removed at a later date
13c1fa2
3a898a9
* Tue May 15 2012 Tim Flink <tflink@fedoraproject.org> - 1.1.0-1
3a898a9
- Update to upstream 1.1.0
3a898a9
3c8c959
* Sat Jan 14 2012 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 1.0.2-2
3c8c959
- Rebuilt for https://fedoraproject.org/wiki/Fedora_17_Mass_Rebuild
3c8c959
aded0dc
* Sat Oct 22 2011 Tim Flink <tflink@fedoraproject.org> - 1.0.2-1
aded0dc
- update to 1.0.2 and added python3 subpackage
aded0dc
74924e0
* Wed Jun 22 2011 Tim Flink <tflink@fedoraproject.org> - 0.8.3-1
74924e0
- update to 0.8.3 and project home page
74924e0
8709b73
* Tue Feb 08 2011 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 0.8.2-2
8709b73
- Rebuilt for https://fedoraproject.org/wiki/Fedora_15_Mass_Rebuild
8709b73
Luke Macken 9557dd6
* Mon Dec 20 2010 Luke Macken <lmacken@redhat.com> - 0.8.2-1
Luke Macken 9557dd6
- update to 0.8.2 of pip
Peter Halliday 3155cdf
* Mon Aug 30 2010 Peter Halliday <phalliday@excelsiorsystems.net> - 0.8-1
Peter Halliday 3155cdf
- update to 0.8 of pip
089f2c5
* Thu Jul 22 2010 David Malcolm <dmalcolm@redhat.com> - 0.7.2-5
089f2c5
- Rebuilt for https://fedoraproject.org/wiki/Features/Python_2.7/MassRebuild
089f2c5
Peter Halliday 6b45ab4
* Wed Jul 7 2010 Peter Halliday <phalliday@excelsiorsystems.net> - 0.7.2-1
Peter Halliday 6b45ab4
- update to 0.7.2 of pip
Peter Halliday 36e99b1
* Sun May 23 2010 Peter Halliday <phalliday@excelsiorsystems.net> - 0.7.1-1
Peter Halliday 6b45ab4
- update to 0.7.1 of pip
Peter Halliday 36e99b1
* Fri Jan 1 2010 Peter Halliday <phalliday@excelsiorsystems.net> - 0.6.1.4
Peter Halliday 97657b9
- fix dependency issue
Matej Stuchlik dd9e7dc
* Fri Dec 18 2009 Peter Halliday <phalliday@excelsiorsystems.net> - 0.6.1-2
Peter Halliday 365f19e
- fix spec file 
Matej Stuchlik dd9e7dc
* Thu Dec 17 2009 Peter Halliday <phalliday@excelsiorsystems.net> - 0.6.1-1
Peter Halliday 365f19e
- upgrade to 0.6.1 of pip
Peter Halliday fc2018e
* Mon Aug 31 2009 Peter Halliday <phalliday@excelsiorsystems.net> - 0.4-1
Peter Halliday fc2018e
- Initial package
Peter Halliday 365f19e