python: move .cache/python/history -> .local/share/python/history

This commit is contained in:
Fernando Schauenburg 2020-12-15 23:46:14 +01:00
parent c361c78dd6
commit f2ed315579
2 changed files with 7 additions and 7 deletions

View file

@ -5,7 +5,7 @@
# 1. Set the Tab key as completion key. # 1. Set the Tab key as completion key.
# 2. Initialize readline (e.g. from .inputrc). # 2. Initialize readline (e.g. from .inputrc).
# 3. Register a history file, using: # 3. Register a history file, using:
# - $XDG_CACHE_HOME/python/history if XDG_CACHE_HOME iset # - $XDG_DATA_HOME/python/history if XDG_DATA_HOME iset
# - .python_history otherwise. # - .python_history otherwise.
def configure_readline(): def configure_readline():
import atexit import atexit
@ -42,8 +42,8 @@ def configure_readline():
# http://bugs.python.org/issue5845#msg198636 # http://bugs.python.org/issue5845#msg198636
history = os.path.join(os.path.expanduser('~'), '.python_history') history = os.path.join(os.path.expanduser('~'), '.python_history')
if 'XDG_CACHE_HOME' in os.environ: if 'XDG_DATA_HOME' in os.environ:
history = os.path.join(os.environ['XDG_CACHE_HOME'], 'python', 'history') history = os.path.join(os.environ['XDG_DATA_HOME'], 'python', 'history')
try: try:
readline.read_history_file(history) readline.read_history_file(history)

View file

@ -8,13 +8,13 @@
when: ansible_os_family == "Darwin" when: ansible_os_family == "Darwin"
homebrew: name=python3 state=latest homebrew: name=python3 state=latest
- name: Create the python config and cache directories - name: Create the python config and data directories
file: file:
path: "~/.{{ item }}/python" path: "{{ item }}"
state: directory state: directory
loop: loop:
- cache - ~/.config/python
- config - ~/.local/share/python
- name: Deploy python startup file - name: Deploy python startup file
file: file: