#35 Make /usr/bin/pip Python 3
Merged 2 months ago by churchyard. Opened 2 months ago by churchyard.
rpms/ churchyard/python-pip the_big_switch  into  master

file modified
+32 -29

@@ -240,6 +240,8 @@ 

  %{bundled 3}

  

  %{?python_provide:%python_provide python%{python3_pkgversion}-%{srcname}}

+ Provides:       pip = %{version}-%{release}

+ Conflicts:      python-pip < %{version}-%{release}

  

  %{crypt_compat_recommends 3}

  

@@ -327,22 +329,30 @@ 

  

  

  %install

+ %if %{with python2}

  %if %{without bootstrap}

- %py3_install_wheel %{python_wheelname}

+ %py2_install_wheel %{python_wheelname}

  %else

- %py3_install

+ %py2_install

  %endif

  

  # TODO: we have to remove this by hand now, but it'd be nice if we wouldn't have to

  # (pip install wheel doesn't overwrite)

  rm %{buildroot}%{_bindir}/pip

+ %endif # with python2

+ 

+ %if %{without bootstrap}

+ %py3_install_wheel %{python_wheelname}

+ %else

+ %py3_install

+ %endif

  

  %if %{with doc}

  pushd docs/build/man

  install -d %{buildroot}%{_mandir}/man1

  for MAN in *1; do

- %if %{with python2}

  install -pm0644 $MAN %{buildroot}%{_mandir}/man1/$MAN

+ %if %{with python2}

  install -pm0644 $MAN %{buildroot}%{_mandir}/man1/${MAN/pip/pip2}

  %endif

  install -pm0644 $MAN %{buildroot}%{_mandir}/man1/${MAN/pip/pip3}

@@ -350,14 +360,6 @@ 

  popd

  %endif # with doc

  

- %if %{with python2}

- %if %{without bootstrap}

- %py2_install_wheel %{python_wheelname}

- %else

- %py2_install

- %endif

- %endif # with python2

- 

  # before we ln -s anything, we apply Source10 patch to all pips:

  # we don't do this when bootstrapping because the entrypoints look different

  # this is not worth dealing with because we'll rebuild once more anyway

@@ -370,40 +372,40 @@ 

  mkdir -p %{buildroot}%{bashcompdir}

  %if %{with python2}

  PYTHONPATH=%{buildroot}%{python2_sitelib} \

-     %{buildroot}%{_bindir}/pip completion --bash \

-     > %{buildroot}%{bashcompdir}/pip

+     %{buildroot}%{_bindir}/pip2 completion --bash \

+     > %{buildroot}%{bashcompdir}/pip2

  %endif

  PYTHONPATH=%{buildroot}%{python3_sitelib} \

-     %{buildroot}%{_bindir}/pip3 completion --bash \

-     > %{buildroot}%{bashcompdir}/pip3

- pips2=pip

- pips3=pip3

+     %{buildroot}%{_bindir}/pip completion --bash \

+     > %{buildroot}%{bashcompdir}/pip

+ pips2=pip2

+ pips3=pip

  for pip in %{buildroot}%{_bindir}/pip*; do

      pip=$(basename $pip)

      case $pip in

- %if %{with python2}

-         pip2*)

-             pips2="$pips2 $pip"

+         pip3*)

+             pips3="$pips3 $pip"

  %if 0%{?bashcomp2}

              ln -s pip %{buildroot}%{bashcompdir}/$pip

  %endif

              ;;

- %endif

-         pip3?*)

-             pips3="$pips3 $pip"

+ %if %{with python2}

+         pip2?*)

+             pips2="$pips2 $pip"

  %if 0%{?bashcomp2}

-             ln -s pip3 %{buildroot}%{bashcompdir}/$pip

+             ln -s pip2 %{buildroot}%{bashcompdir}/$pip

  %endif

              ;;

+ %endif

      esac

  done

  sed -i -e "s/^\\(complete.*\\) pip\$/\\1 $pips3/" \

      -e s/_pip_completion/_pip3_completion/ \

-     %{buildroot}%{bashcompdir}/pip3

+     %{buildroot}%{bashcompdir}/pip

  

  %if %{with python2}

  sed -i -e "s/^\\(complete.*\\) pip\$/\\1 $pips2/" \

-     %{buildroot}%{bashcompdir}/pip

+     %{buildroot}%{bashcompdir}/pip2

  %endif

  

  # Provide symlinks to executables to comply with Fedora guidelines for Python

@@ -466,17 +468,14 @@ 

  %license LICENSE.txt

  %doc README.rst

  %if %{with doc}

- %{_mandir}/man1/pip.*

  %{_mandir}/man1/pip2.*

  %endif

- %{_bindir}/pip

  %{_bindir}/pip2

  %{_bindir}/pip-2

  %{_bindir}/pip%{python2_version}

  %{_bindir}/pip-%{python2_version}

  %{python2_sitelib}/pip*

  %dir %{bashcompdir}

- %{bashcompdir}/pip

  %if 0%{?bashcomp2}

  %{bashcompdir}/pip2*

  %dir %(dirname %{bashcompdir})

@@ -487,14 +486,17 @@ 

  %license LICENSE.txt

  %doc README.rst

  %if %{with doc}

+ %{_mandir}/man1/pip.*

  %{_mandir}/man1/pip3.*

  %endif

+ %{_bindir}/pip

  %{_bindir}/pip3

  %{_bindir}/pip-3

  %{_bindir}/pip%{python3_version}

  %{_bindir}/pip-%{python3_version}

  %{python3_sitelib}/pip*

  %dir %{bashcompdir}

+ %{bashcompdir}/pip

  %{bashcompdir}/pip3*

  %if 0%{?bashcomp2}

  %dir %(dirname %{bashcompdir})

@@ -518,6 +520,7 @@ 

  %changelog

  * Mon Jul 15 2019 Petr Viktorin <pviktori@redhat.com> - 19.1.1-3

  - Recommend libcrypt.so.1 for manylinux1 compatibility

+ - Make /usr/bin/pip Python 3

  

  * Mon Jun 10 2019 Miro Hrončok <mhroncok@redhat.com> - 19.1.1-2

  - Fix root warning when pip is invoked via python -m pip

no initial comment

rebased onto 1b22ace

2 months ago

This is good to merge. However, for --without python2 to work, the line

install -pm0644 $MAN %{buildroot}%{_mandir}/man1/$MAN

should be outside the %if %{with python2} block.
Do you want to do that here or in a separate PR?

rebased onto 8fc8d45

2 months ago

Pull-Request has been merged by churchyard

2 months ago