diff options
Diffstat (limited to 'python/.config')
-rw-r--r-- | python/.config/profile.d/20-python.sh | 2 | ||||
-rw-r--r-- | python/.config/python/startup.py | 8 |
2 files changed, 6 insertions, 4 deletions
diff --git a/python/.config/profile.d/20-python.sh b/python/.config/profile.d/20-python.sh index 65ea113..febd407 100644 --- a/python/.config/profile.d/20-python.sh +++ b/python/.config/profile.d/20-python.sh @@ -1,3 +1,5 @@ #!/bin/sh export PYTHONSTARTUP="$XDG_CONFIG_HOME/python/startup.py" +export PYTHONUSERBASE="$XDG_DATA_HOME/python" +export PYTHONPYCACHEPREFIX="$XDG_CACHE_HOME/python" diff --git a/python/.config/python/startup.py b/python/.config/python/startup.py index 15fe43c..9dc77b9 100644 --- a/python/.config/python/startup.py +++ b/python/.config/python/startup.py @@ -4,16 +4,16 @@ # Create the following .config/python/startup.py file # and export its path using PYTHONSTARTUP environment variable: # -# export PYTHONSTARTUP="${XDG_CONFIG_HOME:-$HOME/.config}/python/startup.py" +# export PYTHONSTARTUP="$XDG_CONFIG_HOME/python/startup.py" import atexit import os import readline -xdg_cache = os.getenv("XDG_CACHE_HOME", os.path.expanduser("~/.cache")) -xdg_python_history = os.path.join(xdg_cache, "python", "history") +xdg_state = os.getenv("XDG_STATE_HOME", os.path.expanduser("~/.local/state")) +histfile = os.getenv("PYTHONHISTFILE", os.path.join( + xdg_state, "python", "history")) -histfile = os.getenv("PYTHONHISTFILE", xdg_python_history) alt_histfile = os.path.expanduser("~/.python_history") if not os.path.exists(histfile) and os.path.exists(alt_histfile): |