annotate Mac/BuildScript/scripts/postflight.patch-profile @ 39042:c02fa187e0f4 legacy-trunk

Part of SF patch #1484695. This removes dead code. The chksum was already verified in .frombuf() on the lines above. If there was a problem an exception is raised, so there was no way this condition could have been true.
author Neal Norwitz <nnorwitz@gmail.com>
date Mon, 10 Jul 2006 00:23:17 +0000
parents a3668e94fc6d
children 2f221bdd9f44
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
38252
75bdd44f85dc An improved script for building the binary distribution on MacOSX.
Ronald Oussoren <ronaldoussoren@mac.com>
parents:
diff changeset
1 #!/bin/sh
75bdd44f85dc An improved script for building the binary distribution on MacOSX.
Ronald Oussoren <ronaldoussoren@mac.com>
parents:
diff changeset
2
75bdd44f85dc An improved script for building the binary distribution on MacOSX.
Ronald Oussoren <ronaldoussoren@mac.com>
parents:
diff changeset
3 echo "This script will update your shell profile when the 'bin' directory"
75bdd44f85dc An improved script for building the binary distribution on MacOSX.
Ronald Oussoren <ronaldoussoren@mac.com>
parents:
diff changeset
4 echo "of python is not early enough of the PATH of your shell."
75bdd44f85dc An improved script for building the binary distribution on MacOSX.
Ronald Oussoren <ronaldoussoren@mac.com>
parents:
diff changeset
5 echo "These changes will be effective only in shell windows that you open"
75bdd44f85dc An improved script for building the binary distribution on MacOSX.
Ronald Oussoren <ronaldoussoren@mac.com>
parents:
diff changeset
6 echo "after running this script."
75bdd44f85dc An improved script for building the binary distribution on MacOSX.
Ronald Oussoren <ronaldoussoren@mac.com>
parents:
diff changeset
7
75bdd44f85dc An improved script for building the binary distribution on MacOSX.
Ronald Oussoren <ronaldoussoren@mac.com>
parents:
diff changeset
8 PYVER=@PYVER@
75bdd44f85dc An improved script for building the binary distribution on MacOSX.
Ronald Oussoren <ronaldoussoren@mac.com>
parents:
diff changeset
9 PYTHON_ROOT="/Library/Frameworks/Python.framework/Versions/Current"
75bdd44f85dc An improved script for building the binary distribution on MacOSX.
Ronald Oussoren <ronaldoussoren@mac.com>
parents:
diff changeset
10
75bdd44f85dc An improved script for building the binary distribution on MacOSX.
Ronald Oussoren <ronaldoussoren@mac.com>
parents:
diff changeset
11 # Make sure the directory ${PYTHON_ROOT}/bin is on the users PATH.
75bdd44f85dc An improved script for building the binary distribution on MacOSX.
Ronald Oussoren <ronaldoussoren@mac.com>
parents:
diff changeset
12 BSH="`basename "${SHELL}"`"
75bdd44f85dc An improved script for building the binary distribution on MacOSX.
Ronald Oussoren <ronaldoussoren@mac.com>
parents:
diff changeset
13 case "${BSH}" in
75bdd44f85dc An improved script for building the binary distribution on MacOSX.
Ronald Oussoren <ronaldoussoren@mac.com>
parents:
diff changeset
14 bash|ksh|sh|*csh)
75bdd44f85dc An improved script for building the binary distribution on MacOSX.
Ronald Oussoren <ronaldoussoren@mac.com>
parents:
diff changeset
15 P="`${SHELL} -c 'echo $PATH'`"
75bdd44f85dc An improved script for building the binary distribution on MacOSX.
Ronald Oussoren <ronaldoussoren@mac.com>
parents:
diff changeset
16 ;;
75bdd44f85dc An improved script for building the binary distribution on MacOSX.
Ronald Oussoren <ronaldoussoren@mac.com>
parents:
diff changeset
17 *)
75bdd44f85dc An improved script for building the binary distribution on MacOSX.
Ronald Oussoren <ronaldoussoren@mac.com>
parents:
diff changeset
18 echo "Sorry, I don't know how to patch $BSH shells"
75bdd44f85dc An improved script for building the binary distribution on MacOSX.
Ronald Oussoren <ronaldoussoren@mac.com>
parents:
diff changeset
19 exit 0
75bdd44f85dc An improved script for building the binary distribution on MacOSX.
Ronald Oussoren <ronaldoussoren@mac.com>
parents:
diff changeset
20 ;;
75bdd44f85dc An improved script for building the binary distribution on MacOSX.
Ronald Oussoren <ronaldoussoren@mac.com>
parents:
diff changeset
21 esac
75bdd44f85dc An improved script for building the binary distribution on MacOSX.
Ronald Oussoren <ronaldoussoren@mac.com>
parents:
diff changeset
22
75bdd44f85dc An improved script for building the binary distribution on MacOSX.
Ronald Oussoren <ronaldoussoren@mac.com>
parents:
diff changeset
23 # Now ensure that our bin directory is on $P and before /usr/bin at that
75bdd44f85dc An improved script for building the binary distribution on MacOSX.
Ronald Oussoren <ronaldoussoren@mac.com>
parents:
diff changeset
24 for elem in `echo $P | tr ':' ' '`
75bdd44f85dc An improved script for building the binary distribution on MacOSX.
Ronald Oussoren <ronaldoussoren@mac.com>
parents:
diff changeset
25 do
75bdd44f85dc An improved script for building the binary distribution on MacOSX.
Ronald Oussoren <ronaldoussoren@mac.com>
parents:
diff changeset
26 if [ "${elem}" == "${PYTHON_ROOT}/bin" ]; then
75bdd44f85dc An improved script for building the binary distribution on MacOSX.
Ronald Oussoren <ronaldoussoren@mac.com>
parents:
diff changeset
27 echo "All right, you're a python lover already"
75bdd44f85dc An improved script for building the binary distribution on MacOSX.
Ronald Oussoren <ronaldoussoren@mac.com>
parents:
diff changeset
28 exit 0
75bdd44f85dc An improved script for building the binary distribution on MacOSX.
Ronald Oussoren <ronaldoussoren@mac.com>
parents:
diff changeset
29 elif [ "${elem}" == "/usr/bin" ]; then
75bdd44f85dc An improved script for building the binary distribution on MacOSX.
Ronald Oussoren <ronaldoussoren@mac.com>
parents:
diff changeset
30 break
75bdd44f85dc An improved script for building the binary distribution on MacOSX.
Ronald Oussoren <ronaldoussoren@mac.com>
parents:
diff changeset
31 fi
75bdd44f85dc An improved script for building the binary distribution on MacOSX.
Ronald Oussoren <ronaldoussoren@mac.com>
parents:
diff changeset
32 done
75bdd44f85dc An improved script for building the binary distribution on MacOSX.
Ronald Oussoren <ronaldoussoren@mac.com>
parents:
diff changeset
33
75bdd44f85dc An improved script for building the binary distribution on MacOSX.
Ronald Oussoren <ronaldoussoren@mac.com>
parents:
diff changeset
34 echo "${PYTHON_ROOT}/bin is not on your PATH or at least not early enough"
75bdd44f85dc An improved script for building the binary distribution on MacOSX.
Ronald Oussoren <ronaldoussoren@mac.com>
parents:
diff changeset
35 case "${BSH}" in
75bdd44f85dc An improved script for building the binary distribution on MacOSX.
Ronald Oussoren <ronaldoussoren@mac.com>
parents:
diff changeset
36 *csh)
75bdd44f85dc An improved script for building the binary distribution on MacOSX.
Ronald Oussoren <ronaldoussoren@mac.com>
parents:
diff changeset
37 # Create backup copy before patching
75bdd44f85dc An improved script for building the binary distribution on MacOSX.
Ronald Oussoren <ronaldoussoren@mac.com>
parents:
diff changeset
38 if [ -f "${HOME}/.cshrc" ]; then
75bdd44f85dc An improved script for building the binary distribution on MacOSX.
Ronald Oussoren <ronaldoussoren@mac.com>
parents:
diff changeset
39 cp -fp "${HOME}/.cshrc" "${HOME}/.cshrc.pysave"
75bdd44f85dc An improved script for building the binary distribution on MacOSX.
Ronald Oussoren <ronaldoussoren@mac.com>
parents:
diff changeset
40 fi
75bdd44f85dc An improved script for building the binary distribution on MacOSX.
Ronald Oussoren <ronaldoussoren@mac.com>
parents:
diff changeset
41 echo "" >> "${HOME}/.cshrc"
75bdd44f85dc An improved script for building the binary distribution on MacOSX.
Ronald Oussoren <ronaldoussoren@mac.com>
parents:
diff changeset
42 echo "# Setting PATH for MacPython ${PYVER}" >> "${HOME}/.cshrc"
75bdd44f85dc An improved script for building the binary distribution on MacOSX.
Ronald Oussoren <ronaldoussoren@mac.com>
parents:
diff changeset
43 echo "# The orginal version is saved in .cshrc.pysave" >> "${HOME}/.cshrc"
38343
c8e4b3b39774 Fix buglet in postinstall script, it would generate an invalid .cshrc file.
Ronald Oussoren <ronaldoussoren@mac.com>
parents: 38252
diff changeset
44 echo "set path=(${PYTHON_ROOT}/bin "'$path'")" >> "${HOME}/.cshrc"
38252
75bdd44f85dc An improved script for building the binary distribution on MacOSX.
Ronald Oussoren <ronaldoussoren@mac.com>
parents:
diff changeset
45 exit 0
75bdd44f85dc An improved script for building the binary distribution on MacOSX.
Ronald Oussoren <ronaldoussoren@mac.com>
parents:
diff changeset
46 ;;
75bdd44f85dc An improved script for building the binary distribution on MacOSX.
Ronald Oussoren <ronaldoussoren@mac.com>
parents:
diff changeset
47 bash)
75bdd44f85dc An improved script for building the binary distribution on MacOSX.
Ronald Oussoren <ronaldoussoren@mac.com>
parents:
diff changeset
48 if [ -e "${HOME}/.profile" ]; then
75bdd44f85dc An improved script for building the binary distribution on MacOSX.
Ronald Oussoren <ronaldoussoren@mac.com>
parents:
diff changeset
49 PR="${HOME}/.profile"
75bdd44f85dc An improved script for building the binary distribution on MacOSX.
Ronald Oussoren <ronaldoussoren@mac.com>
parents:
diff changeset
50 else
75bdd44f85dc An improved script for building the binary distribution on MacOSX.
Ronald Oussoren <ronaldoussoren@mac.com>
parents:
diff changeset
51 PR="${HOME}/.bash_profile"
75bdd44f85dc An improved script for building the binary distribution on MacOSX.
Ronald Oussoren <ronaldoussoren@mac.com>
parents:
diff changeset
52 fi
75bdd44f85dc An improved script for building the binary distribution on MacOSX.
Ronald Oussoren <ronaldoussoren@mac.com>
parents:
diff changeset
53 ;;
75bdd44f85dc An improved script for building the binary distribution on MacOSX.
Ronald Oussoren <ronaldoussoren@mac.com>
parents:
diff changeset
54 *sh)
75bdd44f85dc An improved script for building the binary distribution on MacOSX.
Ronald Oussoren <ronaldoussoren@mac.com>
parents:
diff changeset
55 PR="${HOME}/.profile"
75bdd44f85dc An improved script for building the binary distribution on MacOSX.
Ronald Oussoren <ronaldoussoren@mac.com>
parents:
diff changeset
56 ;;
75bdd44f85dc An improved script for building the binary distribution on MacOSX.
Ronald Oussoren <ronaldoussoren@mac.com>
parents:
diff changeset
57 esac
75bdd44f85dc An improved script for building the binary distribution on MacOSX.
Ronald Oussoren <ronaldoussoren@mac.com>
parents:
diff changeset
58
75bdd44f85dc An improved script for building the binary distribution on MacOSX.
Ronald Oussoren <ronaldoussoren@mac.com>
parents:
diff changeset
59 # Create backup copy before patching
75bdd44f85dc An improved script for building the binary distribution on MacOSX.
Ronald Oussoren <ronaldoussoren@mac.com>
parents:
diff changeset
60 if [ -f "${PR}" ]; then
75bdd44f85dc An improved script for building the binary distribution on MacOSX.
Ronald Oussoren <ronaldoussoren@mac.com>
parents:
diff changeset
61 cp -fp "${PR}" "${PR}.pysave"
75bdd44f85dc An improved script for building the binary distribution on MacOSX.
Ronald Oussoren <ronaldoussoren@mac.com>
parents:
diff changeset
62 fi
75bdd44f85dc An improved script for building the binary distribution on MacOSX.
Ronald Oussoren <ronaldoussoren@mac.com>
parents:
diff changeset
63 echo "" >> "${PR}"
75bdd44f85dc An improved script for building the binary distribution on MacOSX.
Ronald Oussoren <ronaldoussoren@mac.com>
parents:
diff changeset
64 echo "# Setting PATH for MacPython ${PYVER}" >> "${PR}"
75bdd44f85dc An improved script for building the binary distribution on MacOSX.
Ronald Oussoren <ronaldoussoren@mac.com>
parents:
diff changeset
65 echo "# The orginal version is saved in `basename ${PR}`.pysave" >> "${PR}"
75bdd44f85dc An improved script for building the binary distribution on MacOSX.
Ronald Oussoren <ronaldoussoren@mac.com>
parents:
diff changeset
66 echo 'PATH="'"${PYTHON_ROOT}/bin"':${PATH}"' >> "${PR}"
75bdd44f85dc An improved script for building the binary distribution on MacOSX.
Ronald Oussoren <ronaldoussoren@mac.com>
parents:
diff changeset
67 echo 'export PATH' >> "${PR}"
75bdd44f85dc An improved script for building the binary distribution on MacOSX.
Ronald Oussoren <ronaldoussoren@mac.com>
parents:
diff changeset
68 if [ `id -ur` = 0 ]; then
75bdd44f85dc An improved script for building the binary distribution on MacOSX.
Ronald Oussoren <ronaldoussoren@mac.com>
parents:
diff changeset
69 chown "${LOGNAME}" "${PR}"
75bdd44f85dc An improved script for building the binary distribution on MacOSX.
Ronald Oussoren <ronaldoussoren@mac.com>
parents:
diff changeset
70 fi
75bdd44f85dc An improved script for building the binary distribution on MacOSX.
Ronald Oussoren <ronaldoussoren@mac.com>
parents:
diff changeset
71 exit 0