https://github.com/python/cpython/commit/5fa5b7facbcd1f725e51daf31c321e02b7db3f02
commit: 5fa5b7facbcd1f725e51daf31c321e02b7db3f02
branch: main
author: Andrew Cassidy <drewcass...@me.com>
committer: ned-deily <n...@python.org>
date: 2024-04-21T02:52:58-04:00
summary:

gh-91629 Use conf.d configs and fish_add_path to set the PATH when installing 
for the Fish shell. (GH-91630)

Co-authored-by: Erlend E. Aasland <erl...@python.org>

files:
A Misc/NEWS.d/next/macOS/2022-04-17-01-07-42.gh-issue-91629.YBGAAt.rst
M Mac/BuildScript/scripts/postflight.patch-profile

diff --git a/Mac/BuildScript/scripts/postflight.patch-profile 
b/Mac/BuildScript/scripts/postflight.patch-profile
index 68b8e4bb044e10..9caf62211ddd16 100755
--- a/Mac/BuildScript/scripts/postflight.patch-profile
+++ b/Mac/BuildScript/scripts/postflight.patch-profile
@@ -77,16 +77,17 @@ bash)
        fi
        ;;
 fish)
-       CONFIG_DIR="${HOME}/.config/fish"
-       RC="${CONFIG_DIR}/config.fish"
+       CONFIG_DIR="${HOME}/.config/fish/conf.d/"
+       RC="${CONFIG_DIR}/python-${PYVER}.fish"
        mkdir -p "$CONFIG_DIR"
        if [ -f "${RC}" ]; then
                cp -fp "${RC}" "${RC}.pysave"
        fi
-       echo "" >> "${RC}"
-       echo "# Setting PATH for Python ${PYVER}" >> "${RC}"
-       echo "# The original version is saved in ${RC}.pysave" >> "${RC}"
-       echo "set -x PATH \"${PYTHON_ROOT}/bin\" \"\$PATH\"" >> "${RC}"
+       echo "# Setting PATH for Python ${PYVER}" > "${RC}"
+       if [ -f "${RC}.pysave" ]; then
+               echo "# The original version is saved in ${RC}.pysave" >> 
"${RC}"
+       fi
+       echo "fish_add_path -g \"${PYTHON_ROOT}/bin\"" >> "${RC}"
        if [ `id -ur` = 0 ]; then
                chown "${USER}" "${RC}"
        fi
diff --git 
a/Misc/NEWS.d/next/macOS/2022-04-17-01-07-42.gh-issue-91629.YBGAAt.rst 
b/Misc/NEWS.d/next/macOS/2022-04-17-01-07-42.gh-issue-91629.YBGAAt.rst
new file mode 100644
index 00000000000000..13f3336c4a6ed8
--- /dev/null
+++ b/Misc/NEWS.d/next/macOS/2022-04-17-01-07-42.gh-issue-91629.YBGAAt.rst
@@ -0,0 +1 @@
+Use :file:`~/.config/fish/conf.d` configs and :program:`fish_add_path` to set 
:envvar:`PATH` when installing for the Fish shell.

_______________________________________________
Python-checkins mailing list -- python-checkins@python.org
To unsubscribe send an email to python-checkins-le...@python.org
https://mail.python.org/mailman3/lists/python-checkins.python.org/
Member address: arch...@mail-archive.com

Reply via email to