blob: 3b97c4759ecab9ab354f347b5023dedc6bbe0c20 [file] [log] [blame]
Ned Deily41ab6c32013-11-22 22:25:43 -08001#!/bin/sh
2#
3# Install/upgrade pip.
4#
5
6PYVER="@PYVER@"
7PYMAJOR="3"
8FWK="/Library/Frameworks/Python.framework/Versions/${PYVER}"
9RELFWKBIN="../../..${FWK}/bin"
10
11umask 022
12
13"${FWK}/bin/python${PYVER}" -m ensurepip --upgrade
14
15"${FWK}/bin/python${PYVER}" -Wi \
16 "${FWK}/lib/python${PYVER}/compileall.py" \
17 -f -x badsyntax \
18 "${FWK}/lib/python${PYVER}/site-packages"
19
20"${FWK}/bin/python${PYVER}" -Wi -O \
21 "${FWK}/lib/python${PYVER}/compileall.py" \
22 -f -x badsyntax \
23 "${FWK}/lib/python${PYVER}/site-packages"
24
25chgrp -R admin "${FWK}/lib/python${PYVER}/site-packages" "${FWK}/bin"
26chmod -R g+w "${FWK}/lib/python${PYVER}/site-packages" "${FWK}/bin"
27
28# We do not know if the user selected the Python command-line tools
29# package that installs symlinks to /usr/local/bin. So we assume
30# that the command-line tools package has already completed or was
31# not selected and we will only install /usr/local/bin symlinks for
32# pip et al if there are /usr/local/bin/python* symlinks to our
33# framework bin directory.
34
35if [ -d /usr/local/bin ] ; then
36 (
37 cd /usr/local/bin
38 # Create pipx.y and easy_install-x.y links if /usr/local/bin/pythonx.y
39 # is linked to this framework version
40 if [ "$(readlink -n ./python${PYVER})" = "${RELFWKBIN}/python${PYVER}" ] ; then
41 for fn in "pip${PYVER}" "easy_install-${PYVER}" ;
42 do
43 if [ -e "${RELFWKBIN}/${fn}" ] ; then
44 rm -f ./${fn}
45 ln -s "${RELFWKBIN}/${fn}" "./${fn}"
46 chgrp -h admin "./${fn}"
47 chmod -h g+w "./${fn}"
48 fi
49 done
50 fi
51 # Create pipx link if /usr/local/bin/pythonx is linked to this version
52 if [ "$(readlink -n ./python${PYMAJOR})" = "${RELFWKBIN}/python${PYMAJOR}" ] ; then
53 for fn in "pip${PYMAJOR}" ;
54 do
55 if [ -e "${RELFWKBIN}/${fn}" ] ; then
56 rm -f ./${fn}
57 ln -s "${RELFWKBIN}/${fn}" "./${fn}"
58 chgrp -h admin "./${fn}"
59 chmod -h g+w "./${fn}"
60 fi
61 done
62 fi
63 )
64fi
65exit 0