mirror of
https://github.com/ItsDrike/dotfiles.git
synced 2024-11-10 02:39:40 +00:00
Set XDG vars for python
This commit is contained in:
parent
08973fb001
commit
be2013e4d4
18
home/.config/python/pythonrc.py
Normal file
18
home/.config/python/pythonrc.py
Normal file
|
@ -0,0 +1,18 @@
|
||||||
|
import atexit
|
||||||
|
import os
|
||||||
|
import readline
|
||||||
|
from pathlib import Path
|
||||||
|
|
||||||
|
cache_xdg_dir = Path(os.environ.get("XDG_CACHE_HOME", str(Path("~/.cache"))))
|
||||||
|
cache_xdg_dir.mkdir(exist_ok=True, parents=True)
|
||||||
|
|
||||||
|
history_file = cache_xdg_dir.joinpath("python_history")
|
||||||
|
|
||||||
|
readline.read_history_file(history_file)
|
||||||
|
|
||||||
|
|
||||||
|
def write_history() -> None:
|
||||||
|
readline.write_history_file(history_file)
|
||||||
|
|
||||||
|
|
||||||
|
atexit.register(write_history)
|
|
@ -44,6 +44,9 @@ export NPM_CONFIG_USERCONFIG="$XDG_CONFIG_HOME/npm/npmrc"
|
||||||
export NUGET_PACKAGES="$XDG_CACHE_HOME/NuGetPackages"
|
export NUGET_PACKAGES="$XDG_CACHE_HOME/NuGetPackages"
|
||||||
export PARALLEL_HOME="$XDG_CONFIG_HOME/parallel"
|
export PARALLEL_HOME="$XDG_CONFIG_HOME/parallel"
|
||||||
export RANDFILE="$XDG_CACHE_HOME/rnd"
|
export RANDFILE="$XDG_CACHE_HOME/rnd"
|
||||||
|
export PYTHONSTARTUP="$XDG_CONFIG_HOME/python/pythonrc.py"
|
||||||
|
export PYTHONPYCACHEPREFIX="$XDG_CACHE_HOME/python"
|
||||||
|
export PYTHONUSERBASE="$XDG_DATA_HOME/python"
|
||||||
# Less commonly used applications
|
# Less commonly used applications
|
||||||
export _ZL_DATA="$XDG_DATA_HOME/zlua"
|
export _ZL_DATA="$XDG_DATA_HOME/zlua"
|
||||||
export SQLITE_HISTORY="$XDG_DATA_HOME/sqlite_history"
|
export SQLITE_HISTORY="$XDG_DATA_HOME/sqlite_history"
|
||||||
|
|
|
@ -1 +0,0 @@
|
||||||
.cache/python_history
|
|
|
@ -62,8 +62,7 @@ pyenv install -l | cut -d' ' -f3 | grep -E '^3\.6\.[0-9]+$' | tail -n 1 | xargs
|
||||||
# Copy other user configurations
|
# Copy other user configurations
|
||||||
mkdir -p ~/.local
|
mkdir -p ~/.local
|
||||||
cp -ra home/.local/bin ~/.local
|
cp -ra home/.local/bin ~/.local
|
||||||
cp -a home/.python_history ~
|
cp -ra home/.config/python ~/.config
|
||||||
touch ~/.cache/python_history
|
|
||||||
install -m 700 -d ~/.local/share/gnupg
|
install -m 700 -d ~/.local/share/gnupg
|
||||||
mkdir -p ~/.local/share/npm/lib
|
mkdir -p ~/.local/share/npm/lib
|
||||||
cp -ra home/.config/btop ~/.config
|
cp -ra home/.config/btop ~/.config
|
||||||
|
|
Loading…
Reference in a new issue