mirror of
https://github.com/python/cpython.git
synced 2025-09-19 07:00:59 +00:00
MacOSX: add more logic to recognize the correct startup file to patch to the
shell profile patching post-install script.
This commit is contained in:
parent
d6272a3cf6
commit
b80b6e1e12
1 changed files with 15 additions and 8 deletions
|
@ -47,22 +47,29 @@ done
|
||||||
echo "${PYTHON_ROOT}/bin is not on your PATH or at least not early enough"
|
echo "${PYTHON_ROOT}/bin is not on your PATH or at least not early enough"
|
||||||
case "${BSH}" in
|
case "${BSH}" in
|
||||||
*csh)
|
*csh)
|
||||||
# Create backup copy before patching
|
if [ -f "${HOME}/.tcshrc" ]; then
|
||||||
if [ -f "${HOME}/.cshrc" ]; then
|
RC="${HOME}/.tcshrc"
|
||||||
cp -fp "${HOME}/.cshrc" "${HOME}/.cshrc.pysave"
|
else
|
||||||
|
RC="${HOME}/.cshrc"
|
||||||
fi
|
fi
|
||||||
echo "" >> "${HOME}/.cshrc"
|
# Create backup copy before patching
|
||||||
echo "# Setting PATH for MacPython ${PYVER}" >> "${HOME}/.cshrc"
|
if [ -f "${RC}" ]; then
|
||||||
echo "# The orginal version is saved in .cshrc.pysave" >> "${HOME}/.cshrc"
|
cp -fp "${RC}" "${RC}.pysave"
|
||||||
echo "set path=(${PYTHON_ROOT}/bin "'$path'")" >> "${HOME}/.cshrc"
|
fi
|
||||||
|
echo "" >> "${RC}"
|
||||||
|
echo "# Setting PATH for MacPython ${PYVER}" >> "${RC}"
|
||||||
|
echo "# The orginal version is saved in .cshrc.pysave" >> "${RC}"
|
||||||
|
echo "set path=(${PYTHON_ROOT}/bin "'$path'")" >> "${RC}"
|
||||||
if [ `id -ur` = 0 ]; then
|
if [ `id -ur` = 0 ]; then
|
||||||
chown "${USER}" "${HOME}/.cshrc"
|
chown "${USER}" "${RC}"
|
||||||
fi
|
fi
|
||||||
exit 0
|
exit 0
|
||||||
;;
|
;;
|
||||||
bash)
|
bash)
|
||||||
if [ -e "${HOME}/.bash_profile" ]; then
|
if [ -e "${HOME}/.bash_profile" ]; then
|
||||||
PR="${HOME}/.bash_profile"
|
PR="${HOME}/.bash_profile"
|
||||||
|
elif [ -e "${HOME}/.bash_login" ]; then
|
||||||
|
PR="${HOME}/.bash_login"
|
||||||
elif [ -e "${HOME}/.profile" ]; then
|
elif [ -e "${HOME}/.profile" ]; then
|
||||||
PR="${HOME}/.profile"
|
PR="${HOME}/.profile"
|
||||||
else
|
else
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue